[vlc-devel] [PATCH 1/2] avformat: mux: handle text subtitle SPU_ES track

Alexandre Janniaux ajanni at videolabs.io
Tue Nov 26 23:54:49 CET 2019


Text subtitles, aka VLC_CODEC_SUBT, can be muxed in avformat with the
codec AV_CODEC_ID_TEXT. Some information are also added through the
metadata dictionary attached to the stream object.
---
 modules/demux/avformat/mux.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/modules/demux/avformat/mux.c b/modules/demux/avformat/mux.c
index b9d9c378c8..76a3c1da4a 100644
--- a/modules/demux/avformat/mux.c
+++ b/modules/demux/avformat/mux.c
@@ -263,6 +263,13 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
         }
         break;
 
+    case SPU_ES:
+        codecpar->codec_type = AVMEDIA_TYPE_SUBTITLE;
+        codecpar->codec_id = AV_CODEC_ID_TEXT;
+        av_dict_set( &stream->metadata, "title", fmt->psz_description, 0 );
+        av_dict_set( &stream->metadata, "language", fmt->psz_language, 0 );
+        break;
+
     case VIDEO_ES:
         if( !fmt->video.i_frame_rate || !fmt->video.i_frame_rate_base ) {
             msg_Warn( p_mux, "Missing frame rate, assuming 25fps" );
-- 
2.24.0



More information about the vlc-devel mailing list