aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-12-16 05:09:23 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-12-16 05:21:29 +0100
commit718eab527b9af53582c0370e28967e20df991364 (patch)
tree8791793f84bd92cda18f82b9559ccf7ed8d85307
parent1e901ffc619459944ae7102428f48972cd899caa (diff)
downloadffmpeg-718eab527b9af53582c0370e28967e20df991364.tar.gz
ffmpeg: Improve filter input fps selection heuristic.
This fixes a broken file that has a incorrect timebase at the codec level. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--ffmpeg_filter.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ffmpeg_filter.c b/ffmpeg_filter.c
index db95c2f0cd..f550bd4a64 100644
--- a/ffmpeg_filter.c
+++ b/ffmpeg_filter.c
@@ -562,8 +562,10 @@ static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter,
if (!ist->framerate.num && ist->st->codec->ticks_per_frame>1) {
AVRational codec_fr = av_inv_q(ist->st->codec->time_base);
+ AVRational avg_fr = ist->st->avg_frame_rate;
codec_fr.den *= ist->st->codec->ticks_per_frame;
- if(codec_fr.num>0 && codec_fr.den>0 && av_q2d(codec_fr) < av_q2d(fr)*0.7)
+ if ( codec_fr.num>0 && codec_fr.den>0 && av_q2d(codec_fr) < av_q2d(fr)*0.7
+ && fabs(1.0 - av_q2d(av_div_q(avg_fr, fr)))>0.1)
fr = codec_fr;
}