[FFmpeg-devel] confusing trailing metadata for mpeg frames

David Byron dbyron
Wed Sep 8 19:16:17 CEST 2010


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. 

Thanks for your help.

-DB
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: iterate_frames.c
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100908/37e185f6/attachment.asc>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ape_with_binary_item.mp3
Type: audio/mpeg
Size: 206 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100908/37e185f6/attachment.mp3>



More information about the ffmpeg-devel mailing list