[FFmpeg-devel] [PATCH]Use rc_max_rate in av_find_best_stream() if bitrate == 0

Carl Eugen Hoyos cehoyos at ag.or.at
Sat May 31 12:50:19 CEST 2014


Hi!

av_find_best_stream() currently cannot work for mpegvideo, attached patch 
takes rc_max_rate into account if no bitrate was set.

Fixes ticket #2042.

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavformat/utils.c b/libavformat/utils.c
index d8f1363..1f72241 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -3559,6 +3559,8 @@ int av_find_best_stream(AVFormatContext *ic, enum AVMediaType type,
         }
         count = st->codec_info_nb_frames;
         bitrate = avctx->bit_rate;
+        if (!bitrate)
+            bitrate = avctx->rc_max_rate;
         multiframe = FFMIN(5, count);
         if ((best_multiframe >  multiframe) ||
             (best_multiframe == multiframe && best_bitrate >  bitrate) ||


More information about the ffmpeg-devel mailing list