[FFmpeg-devel] [PATCH] mp3: accurate bit rate for vbr streams

Michael Niedermayer michaelni
Mon Jul 26 13:21:13 CEST 2010


On Sun, Jul 25, 2010 at 07:12:41PM +1000, Alexander Kojevnikov wrote:
> Hi list,
> 
> Attached patch calculates bit rate based on the stream size taken from
> the XING/VBRI frame. Currently the stream bit rate is taken from a
> random frame which is obviously wrong.
> 
> This article has a good overview of the problem:
> http://www.codeproject.com/KB/audio-video/mpegaudioinfo.aspx
> 
> Cheers,
> Alex

[...]
> diff --git a/libavformat/mp3.c b/libavformat/mp3.c
> index 11ce59c..ba70f3e 100644
> --- a/libavformat/mp3.c
> +++ b/libavformat/mp3.c
> @@ -84,6 +84,7 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base)
>  {
>      uint32_t v, spf;
>      int frames = -1; /* Total number of frames in file */
> +    int size = -1; /* Total number of bytes in the stream */

that should maybe be unsigned, otherwise it would be limited to 2gb

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Thouse who are best at talking, realize last or never when they are wrong.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100726/a58bee29/attachment.pgp>



More information about the ffmpeg-devel mailing list