- Status Closed
- Percent Complete
- Task Type Patches
- Category ID3 / meta data
- Assigned To No-one
- Operating System All players
- Severity Low
- Priority Very Low
- Reported Version Daily build (which?)
- Due in Version Undecided
-
Due Date
Undecided
- Votes
- Private
FS#10160 - Clean up MP4 metadata parsing to handle files with tags after 'mdat' atom
From 240b4eb19c0e167030bdbfe498f15596ca09316f Mon Sep 17 00:00:00
Alex Bennee
Wed, 22 Apr 2009 13:17:00
[PATCH] Clean up the MP4 metadata parsing.
The parser used to finish as soon as it saw an “mdat” atom and has
filesize. There is nothing that says all you metadata will
seen at this point. I’ve tweaked the parser to ensure it goes
way through the file scanning for metadata.
If tested this with an m4a of iTunes which mp4info parsed OK:
09:44 alex@danny/x86_64 [simdisk] >mp4info 03\ -\ This\ House\ Is\ Not\ for\
version
- This House Is Not for
Type
audio MPEG-4 AAC LC, 233.732 secs, 128 kbps, 44100 Hz Metadata Name: This House Is Not for Sale Metadata Artist: Ryan Adams Metadata Year: 2003 Metadata Album: Love Is Hell Part 1 Metadata track: 3 of 10 Metadata Disk: 1 of 1 Metadata Genre: Alt.Country Metadata Cover Art pieces: 1
However the file still won’t play on Rockbox, I assume because
that does the actual playing cannot deal with the
of the m4a. Interestingly it plays the other songs of
apps/metadata/mp4.c | 116 +++++++++++++++++++++++++++++++++++—————- 1 files changed, 80 insertions(+), 36 deletions(-)
2010-04-18 12:31
Reason for closing: Out of Date
Additional comments about closing: Warning: Undefined array key "typography" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 371 Warning: Undefined array key "camelcase" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 407
Closure requested by task creator.
FS#10832 supersedes this.
Loading...
Available keyboard shortcuts
- Alt + ⇧ Shift + l Login Dialog / Logout
- Alt + ⇧ Shift + a Add new task
- Alt + ⇧ Shift + m My searches
- Alt + ⇧ Shift + t focus taskid search
Tasklist
- o open selected task
- j move cursor down
- k move cursor up
Task Details
- n Next task
- p Previous task
- Alt + ⇧ Shift + e ↵ Enter Edit this task
- Alt + ⇧ Shift + w watch task
- Alt + ⇧ Shift + y Close Task
Task Editing
- Alt + ⇧ Shift + s save task
The stop at the mdat atom is deliberate, since the decoder currently can’t handle files with metadata after the mdat. In order to play a file, the codec needs various information (decoding parameters, some tables describing the file layout). This metadata can be fairly large (e.g., around 40 kB for a 4 minute song), so it can’t be stuffed into the mp3entry struct. Also, a decoder shouldn’t start playback by seeking back and forth, potentially causing a rebuffer.
To really fix this, the metadata reader should first extract (and somehow buffer) the information needed, then let the playback code buffer the rest of the file.
I saw the comment as I was tweaking this bit. I’d like to fix the codec as well as there are obviously well formed files rockbox can’t currently play. I’m just getting my head round how the playback code works. Currently the playback thread is paused very soon after playback is resumed via a STOP message. Is this the codec detecting an mdat it can’t handle?
How much information does the codec need from the metadata. I assume anything not already covered by mp3data (bitrate and length) can be covered by giving a list of mdat pointers and sizes describing the blocks of media data that make up the file?
That stop is likely due to the codec failing or returning immediately, yes.
What the codec needs is this:
1) The data to pass to NeAACDecInit2 (in apps/codecs/aac.c; read from the esds atom).
2) Seek information (from the atoms stts, stsz, stsc and stco). Keeping the size of each sample (or frame) isn’t necessary, as far as I know, so it should be enough to keep a number of seek point, as you suggest. For each seek point, the number of frames is needed (between this point and the next), as well as a time offset (as a sound sample count, I think). That should be enough to be able to decode a file, and seek in it based on file offset or time.
When creating a seek table, remember that there can be gaps between chunks, so a seek point can’t always “begin” in one chunk and “end” in the next.
This is the current WIP patch. It seems the problem with my MP4
one of the mov data being after the mdat data. The second mdat
my test track is a phantom (0 length) as can be seen from this log:
audio_current_track: no id3 data
read_mp4_container(16, 0×991680, 3933035)
read_mp4_container(16, 0×991680, 96294)
read_mp4_container(16, 0×991680, 56705)
read_mp4_container(16, 0×991680, 56569)
read_mp4_container(16, 0×991680, 56471)
read_mp4_container(16, 0×991680,
0×991680, 983)
read_mp4_container(16, 0×991680, 39423)
MP4 bitrate 127, frequency 44100 Hz, length 233732
Looking for album art for /03 - This House Is Not for
elap=0, offset=0,
audio_finish_load_track
qtmovie_read: Found a chunk ftyp,
Found a chunk free,
Found a chunk free,
Found a chunk mdat,
off=97229,
Found a chunk mdat,
Found a chunk moov,
maxBitrate=136288,
j=3837254 - Skipping 6
entering main decoding
No Data.
This presents me with a number of possibilities. One is simply to
MP4 decoder handle such simple cases or find some more MP4s
multiple mdat assignments.
commit
Alex Bennee
Wed May 6 07:52:44 2009 +0100
apps/codecs/aac.c | 6 +++++- apps/codecs/libm4a/demux.c | 3 ++- apps/codecs/libm4a/m4a.c | 5 +++– 3 files changed, 10 insertions(+), 4 deletions(-)
commit
Alex Bennee
Wed May 6 07:51:17 2009 +0100
apps/playback.c | 29 +++++++++++++++++———— 1 files changed, 17 insertions(+), 12 deletions(-)
commit
Alex Bennee
Tue May 5 18:37:35 2009 +0100
apps/codecs/libm4a/demux.c | 97 ++++++++++++++++++++++++++++++++———– apps/codecs/libm4a/m4a.h | 21 +++++++– 2 files changed, 88 insertions(+), 30 deletions(-)
commit
Alex Bennee
Tue May 5 18:35:29 2009 +0100
apps/metadata/mp4.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
commit
Alex Bennee
Wed Apr 22 13:17:00 2009 +0100
apps/metadata/mp4.c | 116 +++++++++++++++++++++++++++++++++++—————- 1 files changed, 80 insertions(+), 36 deletions(-)
Please consider
FS#10832This bug can now be closed as FS 10832 supersedes it.