[FFmpeg-devel] [PATCH]Only print the "Estimating duration from bitrate" warning if a duration was estimated

Carl Eugen Hoyos cehoyos at ag.or.at
Fri Mar 29 07:26:10 CET 2013


Hi!

Attached patch silences a warning when it makes no sense to print it.

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavformat/utils.c b/libavformat/utils.c
index df688f1..6fd942a 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2440,10 +2440,16 @@ static void estimate_timings(AVFormatContext *ic, int64_t old_offset)
         fill_all_stream_timings(ic);
         ic->duration_estimation_method = AVFMT_DURATION_FROM_STREAM;
     } else {
-        av_log(ic, AV_LOG_WARNING, "Estimating duration from bitrate, this may be inaccurate\n");
+        int i;
         /* less precise: use bitrate info */
         estimate_timings_from_bit_rate(ic);
         ic->duration_estimation_method = AVFMT_DURATION_FROM_BITRATE;
+        for (i = 0; i < ic->nb_streams; i++) {
+            if (ic->streams[i]->duration != AV_NOPTS_VALUE) {
+                av_log(ic, AV_LOG_WARNING, "Estimating duration from bitrate, this may be inaccurate\n");
+                break;
+            }
+        }
     }
     update_stream_timings(ic);
 


More information about the ffmpeg-devel mailing list