-
Notifications
You must be signed in to change notification settings - Fork 582
Description
[REQUIRED] Use case description
Today, a user complained about metadata extraction failing for all his .m4a files. After I got the files, I noticed his collection consists entirely of fragmented, dash/iso6mp41-branded files. I was able to confirm that ExoPlayer extracts no metadata at all from his file but seems to work fine with non-fragmented M4A files. After some more digging I noticed the udta/ilst parsing codepath only seems to be triggered from Mp4Extractor but never FragmentedMp4Extractor. ffprobe and exiftool are able to parse both files no issues, and after converting the file to non-fragmented with ffmpeg -i in.m4a -map_metadata 0:s:a:0 -map_metadata 0 -c copy out.m4a
ExoPlayer was able to read the metadata.
Proposed solution
Implement parsing in FragmentedMp4Extractor, perhaps similar to this method used by Mp4Extractor:
media/libraries/extractor/src/main/java/androidx/media3/extractor/mp4/BoxParser.java
Lines 813 to 827 in 76088cd
private static Metadata parseUdtaMeta(ParsableByteArray meta, int limit) { | |
meta.skipBytes(Mp4Box.HEADER_SIZE); | |
maybeSkipRemainingMetaBoxHeaderBytes(meta); | |
while (meta.getPosition() < limit) { | |
int atomPosition = meta.getPosition(); | |
int atomSize = meta.readInt(); | |
int atomType = meta.readInt(); | |
if (atomType == Mp4Box.TYPE_ilst) { | |
meta.setPosition(atomPosition); | |
return parseIlst(meta, atomPosition + atomSize); | |
} | |
meta.setPosition(atomPosition + atomSize); | |
} | |
return null; | |
} |
Unfortunately I have no prior knowledge of this format and don't have the time to contribute this in the forseeable future.
Alternatives considered
Tell all users to re-mux their files to non-fragmented MP4, but they don't seem to like that answer.