[FFmpeg-devel] skip multiple id3v2 headers

David Byron dbyron
Tue Sep 14 18:48:25 CEST 2010


> the question is why the tags parsing code fails to begin
> with.  The awnser is because you changed a field to an
> invalid value with a hex editor, the solution is dont do
> that.

It's fine to tell me not to do that, but it's harder to enforce that on the
entire world of mp3 files.

> if the code fails you do NOT know if you are at the end,
> after the end or in the middle of the frame.

If you believe the length at the beginning of the frame you do.  In the
files I've used so far, the length is valid so I believe the length.  If the
length isn't valid then I'd leave the pointer at the beginning and not try
to parse any of it.

> It makes alot of sense to opt toward a earlier position
> than a later one and let the mp3 parser extract what it
> can

I agree with this though I think there's enough information that we don't
have to guess here.  We know where the id3v2 tag ends.

> > 2. the code that follows that determines what's mpeg
> > audio isn't correct since av_read_frame returns a packet
> > with a bunch of leading zeroes.  I'm fine to work on
> > this angle as well.
> 
> dont waste your time, the code works as it is intended to work.

The code does not work for my use case, which is....take an mp3 file as
input and have packet.size and packet.data as reported by av_read_frame
contain only the audio data from the file.  At the moment it doesn't do
that.  The docs for av_read_frame currently say:

 * Return the next frame of a stream.

Maybe the bug is only in the documentation, or maybe I don't understand what
a frame is.  Is this more correct?

 * Return the next frame of a stream, unless we don't parse all the metadata
beforehand.  In that case, return some part of the file that may or may not
be a frame.

-DB




More information about the ffmpeg-devel mailing list