[FFmpeg-devel] [PATCH] ffmpeg: init input streams before opening encoders

Marton Balint cus at passwd.hu
Wed Feb 17 20:36:41 CET 2016


Codec options of streams detected during avformat_find_stream_info are not set
therefore without this patch we initialize the encoders with decoder info
based on decoders without options.

This cause problems for probed DVB teletext streams where
avctx->subtitle_header depend on the txt_format setting.

Signed-off-by: Marton Balint <cus at passwd.hu>
---
 ffmpeg.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index a5ec3c3..91ed7ab 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -3194,13 +3194,6 @@ static int transcode_init(void)
         }
     }
 
-    /* open each encoder */
-    for (i = 0; i < nb_output_streams; i++) {
-        ret = init_output_stream(output_streams[i], error, sizeof(error));
-        if (ret < 0)
-            goto dump_format;
-    }
-
     /* init input streams */
     for (i = 0; i < nb_input_streams; i++)
         if ((ret = init_input_stream(i, error, sizeof(error))) < 0) {
@@ -3211,6 +3204,13 @@ static int transcode_init(void)
             goto dump_format;
         }
 
+    /* open each encoder */
+    for (i = 0; i < nb_output_streams; i++) {
+        ret = init_output_stream(output_streams[i], error, sizeof(error));
+        if (ret < 0)
+            goto dump_format;
+    }
+
     /* discard unused programs */
     for (i = 0; i < nb_input_files; i++) {
         InputFile *ifile = input_files[i];
-- 
2.6.2



More information about the ffmpeg-devel mailing list