diff options
author | Peter Große <pegro@friiks.de> | 2017-10-29 12:08:05 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2017-11-05 03:14:29 +0100 |
commit | 3ddb887c88483ce089b29a30d0d0aa574c8cdc66 (patch) | |
tree | 659600fa4227fcdc18848b5892280c7a14a69177 | |
parent | b9cd26f556f4ca0dfe71ffd75a7272782b324753 (diff) | |
download | ffmpeg-3ddb887c88483ce089b29a30d0d0aa574c8cdc66.tar.gz |
ffmpeg.c: fix calculation of input file duration in seek_to_start()
Fixes looping files without audio or when using stream_copy, where
ist->nb_samples is not set since no decoding is done.
This fixes ticket #5719 and also fixes an endless loop with the sample
in ticket #6139.
Signed-off-by: Peter Große <pegro@friiks.de>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | fftools/ffmpeg.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 286d898b12..65dbe93626 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -4150,9 +4150,9 @@ static int seek_to_start(InputFile *ifile, AVFormatContext *is) continue; } else { if (ist->framerate.num) { - duration = av_rescale_q(1, ist->framerate, ist->st->time_base); + duration = av_rescale_q(1, av_inv_q(ist->framerate), ist->st->time_base); } else if (ist->st->avg_frame_rate.num) { - duration = av_rescale_q(1, ist->st->avg_frame_rate, ist->st->time_base); + duration = av_rescale_q(1, av_inv_q(ist->st->avg_frame_rate), ist->st->time_base); } else duration = 1; } if (!ifile->duration) |