[FFmpeg-devel] [PATCH] mp3enc: Fix Xing tag identification string for CBR files

Michael Niedermayer michaelni at gmx.at
Fri May 4 17:25:09 CEST 2012


On Fri, May 04, 2012 at 04:13:39PM +0200, Tobias Rapp wrote:
> Tobias Rapp wrote:
> > Attached patch fixes the Xing tag identification string to be "Info" for
> > MP3 files with constant bitrate. The previous "Xing" caused some decoders to
> > recognize the file as VBR.
> > 
> > See also http://gabriel.mp3-tech.org/mp3infotag.html for information how
> > this is done similar in Lame.
> 
> Previous patch file had an obsolete "from" email address. Fixed in the
> attached patch file.

>  mp3enc.c |    6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 97d418d59dbcfa995183eaa26b8c0e53f83169b2  0001-mp3enc-Fix-Xing-tag-identification-string-for-CBR-f.patch
> From 487b655c950061d2af6de8c4a39355ef44c7d266 Mon Sep 17 00:00:00 2001
> From: Tobias Rapp <t.rapp at noa-audio.com>
> Date: Fri, 4 May 2012 10:26:43 +0200
> Subject: [PATCH] mp3enc: Fix Xing tag identification string for CBR files
> 
> Fixes the Xing tag identification string to be "Info" for MP3 files with
> constant bitrate. The previous "Xing" caused some decoders to recognize the
> file as VBR.
> ---
>  libavformat/mp3enc.c |    6 +++++-
>  1 files changed, 5 insertions(+), 1 deletions(-)
> 
> diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c
> index 29c0780..cb61e37 100644
> --- a/libavformat/mp3enc.c
> +++ b/libavformat/mp3enc.c
> @@ -180,7 +180,11 @@ static int mp3_write_xing(AVFormatContext *s)
>  
>      avio_wb32(s->pb, header);
>      ffio_fill(s->pb, 0, xing_offset);
> -    avio_wb32(s->pb, MKBETAG('X', 'i', 'n', 'g'));
> +    /* use "Xing" identification string for VBR files and "Info" for CBR */
> +    if (codec->flags & CODEC_FLAG_QSCALE) 

This is problematic as this flag will only be set reliable on encoding
but not on transcoding (-acodec copy)

better would be to update the tag in mp3_fix_xing() at the end
after storing all packets if they all "match"/dont "match" in size

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Rewriting code that is poorly written but fully understood is good.
Rewriting code that one doesnt understand is a sign that one is less smart
then the original author, trying to rewrite it will not make it better.
-------------- 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/20120504/0156c953/attachment.asc>


More information about the ffmpeg-devel mailing list