This is the bug/patch tracker for Rockbox. Click here for more information.
Quick links: Bugs · Patches · Rockbox frontpage
FS#12007 - File with Corrupt metadata reported with wrong playing time, seeking broken
Attached to Project:
Rockbox
Opened by Ori Avtalion (salty-horse) - Sunday, 13 March 2011, 00:07 GMT+2
Last edited by Andree Buschmann (Buschel) - Wednesday, 16 March 2011, 19:47 GMT+2
Opened by Ori Avtalion (salty-horse) - Sunday, 13 March 2011, 00:07 GMT+2
Last edited by Andree Buschmann (Buschel) - Wednesday, 16 March 2011, 19:47 GMT+2
|
DetailsUsing latest svn on uisimulator and on Sansa e200.
The following file has playback problems in Rockbox: http://www.archive.org/download/MIT9.00F04/L9.mp3 Players such as vlc and totem report is to have 76 minutes. Rockbox reports it to have 5. Trying to seek by holding the back/forward buttons causes it to jump to unexpected places. (This is probably due to the cause of the first problem) Rebuilding the stream with Foobar2000 causes rockbox to play it (and display metadata) correctly |
This task depends upon
Closed by Andree Buschmann (Buschel)
Wednesday, 16 March 2011, 19:47 GMT+2
Reason for closing: Fixed
Additional comments about closing: Fixed with r29603.
Wednesday, 16 March 2011, 19:47 GMT+2
Reason for closing: Fixed
Additional comments about closing: Fixed with r29603.
1. The real mp3 data begins at byte position 0x10674. If everything before this position is deleted the file plays fine and has the right duration.
2. The tag length stated in its header is wrong. The header states an 7-to-8-bit encoded length of 0x040776. From this the first mp3 frame position is calculated as 0x10400.
3. If you correct the id3 tag length to 0x040C6A in the file, it plays fine, has the right duration and reads the metadata. Residual issue: The album art is only displaying the upper half.
Edit: Needed to correct the real offset of the first mp3 header.
4. The tag is stating it is a ID3v2.4 tag. But it is a ID3v2.3 tag. When correcting this in the file, the length of all frames is correct. As a result the embedded image is fully loaded and displayed.
5. The wrong id3v2-length that is stated in the header itself points to a position within the embedded album art where -- by random -- a byte sequence is placed that looks is allowed to be interpreted as a valid mpeg header: mp1 format is detected. If you simply enlarge the wrong tag length by 1 byte -- what is still wrong -- the metadata parser will parse to the next valid mp3 header and play back the file with correct duration.
Important: When using the patch with the file from above, the parser locks to the _second_ valid header. This is because there is another byte-array in the first frame that is assumed to be a valid header as well. This may happen with any other file as well -> There might be frames skipped.
Another, more sophisticated, way would be to calculate the frame size of any detected valid MPEG frame header and check whether there is another MPEG frame header with identical main types is placed at the calculated byte position.
Edit: I am not sure this patch works when using Xing-VBR-headers. Maybe we need to use different functions to o either parse towards the first valid header (e.g. for locking to Xing headers) or to check for the first of a pair of identical frames...
1. Parse until valid MPEG frame header is found
2. Extract information from frame header, including frame size in bytes
3. Skip the frame according to frame size
4. Check if there is another valid frame header with the same type (= same MPEG version, layer, sampling rate).
If so, the parser assumes the frame header found in 1) is the first MPEG frame header of the file.
This is still a proof-of-concept. The implementation does not take into account that there might be a 'Xing'-header that uses different types than the stream itself. Therefor this patch needs to be enhanced to support
a) Seek to first valid frame header without checking for a valid pair. -> For 'Xing' and similar headers.
b) Seek to first frame of a pair (see 1-4). -> For the audio stream.
ETA: :) Seems I somehow managed to encode a whole album without Xing tags. So, the problem's on my end with those.