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

Improve the detection of mp4 types #86 #98

Merged
merged 5 commits into from
May 26, 2023

Conversation

ivangolubykh
Copy link
Contributor

Fixes dart-lang/tools#419

I added MPEG-4 types based on the article https://www.file-recovery.com/mp4-signature-format.htm
avc1 = 61 76 63 31
iso2 = 69 73 6F 32
isom = 69 73 6F 6D
mmp4 = 6D 6D 70 34
mp41 = 6D 70 34 31
mp42 = 6D 70 34 32
mp71 = 6D 70 37 31
msnv = 6D 73 6E 76
ndas = 6E 64 61 73
ndsc = 6E 64 73 63
ndsh = 6E 64 73 68
ndsm = 6E 64 73 6D
ndsp = 6E 64 73 70
ndss = 6E 64 73 73
ndxc = 6E 64 78 63
ndxh = 6E 64 78 68
ndxm = 6E 64 78 6D
ndxp = 6E 64 78 70
ndxs = 6E 64 78 73


  • [ V ] I’ve reviewed the contributor guide and applied the relevant portions to this PR.

@devoncarew devoncarew requested a review from natebosch May 24, 2023 15:43
@@ -122,14 +122,500 @@ const List<MagicNumber> initialMagicNumbers = [
0x74,
0x79,
0x70,
0x33,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like it removes the version with the last 4 bytes [0x33, 0x67, 0x70, 0x35] or 3gp5

According to https://www.ftyps.com this mime type should be video/3gpp though - so I don't know if it was useful when it was mapped to video/mp4. I think it's OK to overwrite this old entry with the new one.

Looking at just the types that are marked as registered and map to video/mp4 it looks fairly close to your list. However there are some differences.

  • mp71 does not link directly to the mime type video/mp4, this resource lists it as "various" - maybe it's OK to include anyway?
  • msnv is capitalized as MSNV and maps to audio/mp4
  • ndsc through ndxs are all capitalized, and none are marked as registered.

I think we can probably prune the list down to avc1, iso2, isom, mp41, and mp42

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I returned the type "3gp5 = 33 67 70 35" and marked it as video/3gpp. And also I pruned the MP4 list down to avc1, iso2, isom, mp41 and mp42.

@natebosch
Copy link
Member

I'm not sure if the ISO standard would have an even more authoritative list than https://www.ftyps.com/

https://www.iso.org/standard/83102.html

I don't think it's worth buying it to check though... I think it's probably safe to go with the pruned list I mentioned above.

@natebosch natebosch merged commit 2444840 into dart-lang:master May 26, 2023
mosuem pushed a commit to dart-lang/tools that referenced this pull request Aug 26, 2024
Add more byte patterns for the values that can follow `ftyp` in an mp4 file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

improve the detection of mp4 types
2 participants