Due to what looks like an off-by-one error 60 * 12 * 1001 / 12 * 1001
is not tested as standard frame rate in avformat_find_stream_info().
---
 libavformat/utils.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index db92f81..67077a9 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2090,9 +2090,12 @@ static void compute_chapters_end(AVFormatContext *s)
         }
 }
 
-static int get_std_framerate(int i){
-    if(i<60*12) return i*1001;
-    else        return ((const int[]){24,30,60,12,15})[i-60*12]*1000*12;
+static int get_std_framerate(int i)
+{
+    if (i < 60 * 12)
+        return (i + 1) * 1001;
+    else
+        return ((const int[]){24,30,60,12,15})[i - 60 * 12] * 1000 * 12;
 }
 
 /*
@@ -2359,7 +2362,7 @@ int avformat_find_stream_info(AVFormatContext *ic, 
AVDictionary **options)
 
                 /* round guessed framerate to a "standard" framerate if it's
                  * within 1% of the original estimate*/
-                for (j = 1; j < MAX_STD_TIMEBASES; j++) {
+                for (j = 0; j < MAX_STD_TIMEBASES; j++) {
                     AVRational std_fps = { get_std_framerate(j), 12*1001 };
                     double error = fabs(av_q2d(st->avg_frame_rate) / 
av_q2d(std_fps) - 1);
 
-- 
1.8.5.2

_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to