Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fragmented MP4 audio udta box metadata parsing #2084

Open
nift4 opened this issue Jan 28, 2025 · 0 comments
Open

Fragmented MP4 audio udta box metadata parsing #2084

nift4 opened this issue Jan 28, 2025 · 0 comments

Comments

@nift4
Copy link

nift4 commented Jan 28, 2025

[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:

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants