[FFmpeg-devel] confusing trailing metadata for mpeg frames

David Byron dbyron
Tue Sep 28 21:05:33 CEST 2010


I've uploaded a real-from-out-in-the-world file named ape_and_id3v1.mp3 to
ftp://upload.ffmpeg.org/MPlayer/incoming/dbyron.  With git master
62e074c60d46ec129907aa221360020b58a0756b, iterate_frames produces (with most
of the per-packet printfs removed, and some extra code to dump a particular
packet):

$ ./iterate_frames ape_and_id3v1.mp3
[NULL @ 0x2de4010] Probed with size=8192 and score=51
"ape_and_id3v1.mp3": frame 1: offset: 4096, stream index: 0, pos: 2048, size
1044 byte(s)
"ape_and_id3v1.mp3": frame 2: offset: 5120, stream index: 0, pos: 3072, size
1045 byte(s)
"ape_and_id3v1.mp3": frame 3: offset: 6144, stream index: 0, pos: 4096, size
1045 byte(s)
"ape_and_id3v1.mp3": frame 4: offset: 7168, stream index: 0, pos: 5120, size
1045 byte(s)
"ape_and_id3v1.mp3": frame 8085: offset: 8450048, stream index: 0, pos:
8448000, size 1045 byte(s)
"ape_and_id3v1.mp3": frame 8086: offset: 8452096, stream index: 0, pos:
8450048, size 1044 byte(s)
"ape_and_id3v1.mp3": frame 8087: offset: 8453120, stream index: 0, pos:
8451072, size 1045 byte(s)
"ape_and_id3v1.mp3": frame 8088: offset: 8454144, stream index: 0, pos:
8452096, size 1045 byte(s)
"ape_and_id3v1.mp3": frame 8089: offset: 8455168, stream index: 0, pos:
8453120, size 1045 byte(s)
"ape_and_id3v1.mp3": frame 8090: offset: 8456192, stream index: 0, pos:
8454144, size 1045 byte(s)
"ape_and_id3v1.mp3": frame 8091: offset: 8457216, stream index: 0, pos:
8455168, size 1045 byte(s)
"ape_and_id3v1.mp3": frame 8092: offset: 8458240, stream index: 0, pos:
8456192, size 1045 byte(s)
"ape_and_id3v1.mp3": frame 8093: offset: 8458741, stream index: 0, pos:
8457216, size 1045 byte(s)
"ape_and_id3v1.mp3": frame 8094: offset: 8458741, stream index: 0, pos:
8458240, size 334 byte(s)
41 50 45 54 41 47 45 58 D0 07 00 00 AE 00 00 00 APETAGEX........
04 00 00 00 00 00 00 A0 00 00 00 00 00 00 00 00 ................
07 00 00 00 00 00 00 00 4D 50 33 47 41 49 4E 5F ........MP3GAIN_
4D 49 4E 4D 41 58 00 30 30 30 2C 31 38 34 0B 00 MINMAX.000,184..
00 00 00 00 00 00 4D 50 33 47 41 49 4E 5F 55 4E ......MP3GAIN_UN
44 4F 00 2B 30 30 33 2C 2B 30 30 33 2C 4E 0C 00 DO.+003,+003,N..
00 00 00 00 00 00 52 45 50 4C 41 59 47 41 49 4E ......REPLAYGAIN
5F 54 52 41 43 4B 5F 47 41 49 4E 00 2D 35 2E 35 _TRACK_GAIN.-5.5
36 35 30 30 30 20 64 42 08 00 00 00 00 00 00 00 65000 dB........
52 45 50 4C 41 59 47 41 49 4E 5F 54 52 41 43 4B REPLAYGAIN_TRACK
5F 50 45 41 4B 00 30 2E 36 34 37 39 38 37 41 50 _PEAK.0.647987AP
45 54 41 47 45 58 D0 07 00 00 AE 00 00 00 04 00 ETAGEX..........
00 00 00 00 00 80 00 00 00 00 00 00 00 00 54 41 ..............TA
47 41 6C 69 65 6E 20 41 6E 74 20 46 61 72 6D 20 GAlien Ant Farm
2D 20 53 6D 6F 6F 74 68 20 43 72 69 6D 69 6E 52 - Smooth CriminR
4F 43 4B 2D 49 4E 44 49 45 2D 41 4C 54 45 52 4E OCK-INDIE-ALTERN
41 54 49 56 45 00 00 00 00 00 00 00 00 00 00 00 ATIVE...........
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 20 ...............
20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
20 20 20 20 20 20 20 20 20 20 20 20 20 0C                    .
"ape_and_id3v1.mp3": 8094 frame(s), 8456693 byte(s)

I believe this shows that av_read_frame returns packets with non-audio data.

With the second set of patches I sent, the output is:

$ ./iterate_frames ape_and_id3v1.mp3
[NULL @ 0x2775010] Probed with size=8192 and score=51
[mp3 @ 0x2775010] ff_mp3_find_trailing_metadata: "ape_and_id3v1.mp3": id3v1
tag at offset 8458613(0x811175)
[mp3 @ 0x2775010] ff_ape_offset: "ape_and_id3v1.mp3": APE Tag contains
header
[mp3 @ 0x2775010] ff_ape_offset: "ape_and_id3v1.mp3": 206 byte APE tag at
offset 8458407(0x8110a7)
[mp3 @ 0x2775010] ff_mp3_find_trailing_metadata: "ape_and_id3v1.mp3":
trailing metadata offset relative to audio: 8456359
"ape_and_id3v1.mp3": frame 1: offset: 4096, stream index: 0, pos: 0, size
3092 byte(s)
"ape_and_id3v1.mp3": frame 2: offset: 5120, stream index: 0, pos: 3072, size
1045 byte(s)
"ape_and_id3v1.mp3": frame 3: offset: 6144, stream index: 0, pos: 4096, size
1045 byte(s)
"ape_and_id3v1.mp3": frame 4: offset: 7168, stream index: 0, pos: 5120, size
1045 byte(s)
"ape_and_id3v1.mp3": frame 8085: offset: 8450048, stream index: 0, pos:
8448000, size 1045 byte(s)
"ape_and_id3v1.mp3": frame 8086: offset: 8452096, stream index: 0, pos:
8450048, size 1044 byte(s)
"ape_and_id3v1.mp3": frame 8087: offset: 8453120, stream index: 0, pos:
8451072, size 1045 byte(s)
"ape_and_id3v1.mp3": frame 8088: offset: 8454144, stream index: 0, pos:
8452096, size 1045 byte(s)
"ape_and_id3v1.mp3": frame 8089: offset: 8455168, stream index: 0, pos:
8453120, size 1045 byte(s)
"ape_and_id3v1.mp3": frame 8090: offset: 8456192, stream index: 0, pos:
8454144, size 1045 byte(s)
"ape_and_id3v1.mp3": frame 8091: offset: 8457216, stream index: 0, pos:
8455168, size 1045 byte(s)
[NULL @ 0x27762c0] mpegaudio_parse: giving up at offset: 8457216 due to
trailing metadata
[NULL @ 0x27762c0] mpegaudio_parse: giving up at offset: 8458240 due to
trailing metadata
[NULL @ 0x27762c0] mpegaudio_parse: giving up at offset: 8458741 due to
trailing metadata
"ape_and_id3v1.mp3": 8091 frame(s), 8456317 byte(s)

So my patch isn't correct yet (which I think I already acknowledged) but I
think it's a step in the right direction.  It would be nice to only have to
"give up" once which I'm not sure how to do, but more important is that the
offset I'm using to compare against the offset of trailing metadata isn't
correct.  I could use a hand with that as well.

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/20100928/551720f5/attachment.asc>



More information about the ffmpeg-devel mailing list