[vlc-devel] [PATCH 1/2] avformat: mux: handle subtitle metadata

Alexandre Janniaux ajanni at videolabs.io
Wed Dec 11 16:23:13 CET 2019


Some information are added through the metadata dictionary attached
to the stream object. In these information, the following keys are
used by the avformat Matroska muxer:

+ title: correspond to the TrackName, we're putting it in
  psz_description field in the Matroska parser module.

+ language: correspond to the TrackLanguage, we're putting it in
  the psz_language field in the Matroska parser module.

Replicate the behaviour so that these metadata are not lost after
remuxing.
---
 modules/demux/avformat/mux.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/modules/demux/avformat/mux.c b/modules/demux/avformat/mux.c
index b9d9c378c8..723974cd89 100644
--- a/modules/demux/avformat/mux.c
+++ b/modules/demux/avformat/mux.c
@@ -263,6 +263,12 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
         }
         break;
 
+    case SPU_ES:
+        codecpar->codec_type = AVMEDIA_TYPE_SUBTITLE;
+        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.1



More information about the vlc-devel mailing list