ffmpeg: Favor filter graph based duration over ost->frame_rate in fps code
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 16 Jan 2015 19:43:57 +0000 (20:43 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 19 Jan 2015 02:13:16 +0000 (03:13 +0100)
The fate change adds a last frame with a subtitle not displayed in the previous

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
ffmpeg.c
tests/ref/fate/sub2video

index 2501e2c6a768da16f7ba5d8db87b3ffa29d56b08..633daddeea5e47a684471901badb95acef3e48da 100644 (file)
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -900,15 +900,12 @@ static void do_video_out(AVFormatContext *s,
     if (ost->source_index >= 0)
         ist = input_streams[ost->source_index];
 
-    if(ist && ist->st->start_time != AV_NOPTS_VALUE && ist->st->first_dts != AV_NOPTS_VALUE && ost->frame_rate.num)
-        duration = 1/(av_q2d(ost->frame_rate) * av_q2d(enc->time_base));
-
-    // We take the conservative approuch here and take the minimum even though
-    // this should be correct on its own but a value too small is harmless, one
-    // too big can lead to errors
     if (filter->inputs[0]->frame_rate.num > 0 &&
         filter->inputs[0]->frame_rate.den > 0)
-        duration = FFMIN(duration, 1/(av_q2d(filter->inputs[0]->frame_rate) * av_q2d(enc->time_base)));
+        duration = 1/(av_q2d(filter->inputs[0]->frame_rate) * av_q2d(enc->time_base));
+
+    if(ist && ist->st->start_time != AV_NOPTS_VALUE && ist->st->first_dts != AV_NOPTS_VALUE && ost->frame_rate.num)
+        duration = FFMIN(duration, 1/(av_q2d(ost->frame_rate) * av_q2d(enc->time_base)));
 
     if (!ost->filters_script &&
         !ost->filters &&
index 1c6cdaf1210bd17d133f649beaba41d0a2eca688..5c2c46a6fcfde83ef10daec01a176db99f94d5a6 100644 (file)
@@ -52,6 +52,7 @@
 0,         47,         47,        1,   518400, 0xde69683f
 0,         48,         48,        1,   518400, 0x7df08fba
 0,         49,         49,        1,   518400, 0xbab197ea
+0,         50,         50,        1,   518400, 0x902285d9
 1,      15355,      15355,     4733,     2094, 0x3c171425, F=0x0
 1,      48797,      48797,     2560,     2480, 0x7c0edf21, F=0x0
 1,      51433,      51433,     2366,     3059, 0xc95b8a05, F=0x0