[FFmpeg-devel] [PATCH] lavf: let av_find_best_stream use bitrate info if available

Michael Niedermayer michaelni at gmx.at
Sat Nov 17 16:06:26 CET 2012

On Sat, Nov 17, 2012 at 02:15:00PM +0100, Marton Balint wrote:
> On Sat, 17 Nov 2012, Michael Niedermayer wrote:
> >On Sat, Nov 17, 2012 at 12:39:26AM +0100, Marton Balint wrote:
> >>I guess the user expects to see the stream with the highest bitrate, not with
> >>the most frames, this is especially useful for multi bitrate streams.
> >>
> >>This patch changes av_find_best_stream to select the stream with the highest
> >>bitrate which has at least one frame.
> >
> >this will fail with streams that have no frame (but a incorrect high
> >bitrate possibly)
> That should not be a problem, because of this:
> +        count = st->codec_info_nb_frames;
> +        bitrate = count ? avctx->bit_rate : 0;
> We reset the bitrate to 0, if frame count is 0.

> >or just one frame like an jpeg/png
> You mean files with e.g. cover art and a the real video? If I change
> the bitrate check to reset the bitrate if frame count is less than
> 2, that fixes this as well, right?

it does seem ok but should be tested if possible with the files that
needed the original code

also using the bitrate within 1 frame streams to choose if there are
no streams with more frames should be done

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The real ebay dictionary, page 2
"100% positive feedback" - "All either got their money back or didnt complain"
"Best seller ever, very honest" - "Seller refunded buyer after failed scam"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20121117/a1526b1a/attachment.asc>

More information about the ffmpeg-devel mailing list