[FFmpeg-cvslog] avconv.c: fix calculation of input file duration in seek_to_start()

Peter Große git at videolan.org
Sun Nov 12 05:51:53 EET 2017


ffmpeg | branch: master | Peter Große <pegro at friiks.de> | Mon Oct 30 12:25:26 2017 +0100| [22241208eb7d0168b2afc128af5a128a9ef0a89b] | committer: Diego Biurrun

avconv.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.

Signed-off-by: Diego Biurrun <diego at biurrun.de>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=22241208eb7d0168b2afc128af5a128a9ef0a89b
---

 avtools/avconv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/avtools/avconv.c b/avtools/avconv.c
index 4e3ffecdef..cee7a7b452 100644
--- a/avtools/avconv.c
+++ b/avtools/avconv.c
@@ -2553,9 +2553,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 = FFMAX(av_rescale_q(1, av_inv_q(ist->framerate), ist->st->time_base), 1);
             } else if (ist->st->avg_frame_rate.num) {
-                duration = av_rescale_q(1, ist->st->avg_frame_rate, ist->st->time_base);
+                duration = FFMAX(av_rescale_q(1, av_inv_q(ist->st->avg_frame_rate), ist->st->time_base), 1);
             } else duration = 1;
         }
         if (!ifile->duration)



More information about the ffmpeg-cvslog mailing list