[FFmpeg-devel] [PATCH]Show rc_max_rate if bitrate is not set

Carl Eugen Hoyos cehoyos at ag.or.at
Thu Jul 25 00:05:40 CEST 2013


Hi!

Users are probable interested in the max bitrate if no (average) bitrate was 
set in the MPEG stream, see 25b7aa9.

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index ff26c58..1adb69b 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -2627,6 +2627,9 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
     if (bitrate != 0) {
         snprintf(buf + strlen(buf), buf_size - strlen(buf),
                  ", %d kb/s", bitrate / 1000);
+    } else if (enc->rc_max_rate > 0) {
+        snprintf(buf + strlen(buf), buf_size - strlen(buf),
+                 ", max. %d kb/s", enc->rc_max_rate / 1000);
     }
 }
 
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 9fd5e6e..2078a1b 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2211,6 +2211,9 @@ static void estimate_timings_from_bit_rate(AVFormatContext *ic)
             st = ic->streams[i];
             if (st->codec->bit_rate > 0)
             bit_rate += st->codec->bit_rate;
+            else if (st->codec->rc_max_rate > 0) {
+                bit_rate += st->codec->rc_max_rate;
+            }
         }
         ic->bit_rate = bit_rate;
     }


More information about the ffmpeg-devel mailing list