[FFmpeg-devel] [PATCH] MP3: ID3V2 corrupted => bad offset
Fri Dec 5 13:41:32 CET 2008
According to the ID3v2 standard, frame sizes are stored using 32bit
SynchSafe Integer format
That's why libavformat/mp3.c uses id3v2_get_size() function.
But I discovered that a lot of mp3 (about a fourth of my mp3s!) use
classic 32bit unsigned integer!!!
So with these mp3s ID3v2 parse fails and then
AVFormatContext->data_offset is invalid!
and having a bad data_offset can be very critical for some applications
(like mine 0:-) ).
For my patch, I use the ID3v2 size extracted from its header to deduce
Then after parsing ID3 I seek to this offset and I made another check by
verifying that it corresponds to a mp3 frame sync, and if it doesn't I
look for the first frame sync and made it the offset.
if id3 tag is corrupted, result is :
data_offset is good (so mp3_parse_vbr_tags success)
tag parse still fail but if file doesn't respect standards, we cannot do
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 1515 bytes
Desc: not available
More information about the ffmpeg-devel