[FFmpeg-devel] confusing trailing metadata for mpeg frames

Michael Niedermayer michaelni
Fri Sep 10 14:15:10 CEST 2010

On Wed, Sep 08, 2010 at 10:16:17AM -0700, David Byron wrote:
> I'm trying to work out a good way for av_read_frame to return packets that
> only contain audio data.  As things are now, it returns packets that contain
> metadata at the end of mp3 files (e.g. id3v1, lyrics3 or APE tags).
> I've attached the test program I'm using to work through this.  It's the
> same one I'm using to work with multiple ID3v2 tags.  I've also attached a
> test file.  Here's the current output of the test program:
> $ ./iterate_frames ape_with_binary_item.mp3
> Format detected only with low score of 1, misdetection possible!
> "ape_with_binary_item.mp3": frame 0: size 196 byte(s)
> "ape_with_binary_item.mp3": frame 1: size 10 byte(s)
> "ape_with_binary_item.mp3": 2 frame(s), 206 byte(s)
> Here's what I'd like to output to be:
> $ ./iterate_frames ape_with_binary_item.mp3
> Format detected only with low score of 1, misdetection possible!
> "ape_with_binary_item.mp3": 0 frame(s), 0 byte(s)
> with possibly some additional log messages indicating that trailing metadata
> is getting ignored.
> I looked through the code to find a good place to implement this and it's
> not totally clear.  If I stick with mp3 files initially, mp3_read_packet is
> one place, but it's likely simpler / more efficient to figure out where
> trailing metadata begins once...maybe in mp3_read_header.  I think that'd be
> OK for files.  Not sure how it'd work for streams.
> It'd also be nice to reuse ff_ape_parse_tag, but it assumes the APE tag is
> at the end of the file.  I've seen mp3 files where an ID3v1 tag follows the
> APE tag.  Some mp3 files have a lyrics3 tag before APE, some after.
> I could use a hand figuring out an ffmpeg-appropriate way/place to pull this
> off.  From there I'll come up with a patch. 

when a mp3 file is read we seek to the end and parse all the tags,
it shouldnt be hard to check durig packet reding where we are and skip
the amount that we previously determined belongs to non mp3 data

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100910/5b92a1ce/attachment.pgp>

More information about the ffmpeg-devel mailing list