go-mp4
go-mp4 copied to clipboard
Support old QuickTime atoms
hdlr atom
- [x] pascal string for
name
(PR: https://github.com/abema/go-mp4/pull/4)- [x] adopting Libquicktime's approach. (PR: https://github.com/abema/go-mp4/pull/6, https://github.com/abema/go-mp4/pull/16)
Bento4 detects pstring by length. https://github.com/axiomatic-systems/Bento4/blob/v1.6.0-637/Source/C++/Core/Ap4HdlrAtom.cpp#L95
Libquicktime detects by component_type field. https://sourceforge.net/p/libquicktime/git/ci/master/tree/src/hdlr.c#l208
Android detects by path. https://android.googlesource.com/platform/frameworks/av/+/master/media/extractors/mp4/MPEG4Extractor.cpp#2570
meta atom
- [x] no
version
, noflags
Android detects by path. https://android.googlesource.com/platform/frameworks/av/+/master/media/extractors/mp4/MPEG4Extractor.cpp#2382
udta atom
- [ ] terminate code 0x00000000
Android: https://android.googlesource.com/platform/frameworks/av/+/master/media/extractors/mp4/MPEG4Extractor.cpp#989
alac sample entry
- [ ] alac sample entry
Android: https://android.googlesource.com/platform/frameworks/av/+/master/media/extractors/mp4/MPEG4Extractor.cpp#1650, https://android.googlesource.com/platform/frameworks/av/+/master/media/extractors/mp4/MPEG4Extractor.cpp#1204
keys atom
- [x] keys atom
https://developer.apple.com/documentation/quicktime-file-format/metadata_item_keys_atom
Android: https://android.googlesource.com/platform/frameworks/av/+/master/media/extractors/mp4/MPEG4Extractor.cpp#2598
ilst atom
- [x] ilst atom
- [ ] data atom
- [ ] mean atom
- [ ] name atom
Android: https://android.googlesource.com/platform/frameworks/av/+/master/media/extractors/mp4/MPEG4Extractor.cpp#2879
AudioSampleEntry
- [x] https://github.com/abema/go-mp4/issues/50
wave atom
- [x] wave atom
Bento4: https://github.com/axiomatic-systems/Bento4/blob/v1.6.0-637/Source/C%2B%2B/Core/Ap4AtomFactory.cpp#L794 Android: https://android.googlesource.com/platform/frameworks/av/+/master/media/extractors/mp4/MPEG4Extractor.cpp#919
ctts atom
(investigation required)
Bento4: https://github.com/axiomatic-systems/Bento4/blob/v1.6.0-637/Source/C%2B%2B/Core/Ap4CttsAtom.cpp#L98
wide atom
http://xhelmboyx.tripod.com/formats/mp4-layout.txt
fiel atom
http://xhelmboyx.tripod.com/formats/mp4-layout.txt https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap3/qtff3.html
Sometimes, name
field of hdlr box has 0x00 twice.
Following images are mp4tool-dump and hexdump of the music mp4 file written by Sony's product.
![Screen Shot 2020-07-25 at 2 57 02](https://user-images.githubusercontent.com/6257462/88422013-7d075b00-ce24-11ea-943e-905f3d02e1cb.png)
![Screen Shot 2020-07-25 at 3 06 09](https://user-images.githubusercontent.com/6257462/88422008-7b3d9780-ce24-11ea-916d-95fcddc83231.png)
![Screen Shot 2020-07-25 at 3 01 01](https://user-images.githubusercontent.com/6257462/88422010-7bd62e00-ce24-11ea-904c-f171c8e96aa9.png)
![Screen Shot 2020-07-25 at 3 08 13](https://user-images.githubusercontent.com/6257462/88422001-7973d400-ce24-11ea-9884-f05b4a7d133e.png)
In this file, only hdlr box which is under moov->udta->meta has 34 bytes.
And this box has handler type mdir
and has appl
at next 4 bytes.
https://github.com/abema/go-mp4/pull/4/files#diff-e6c932c76afb2ffea73af8d48df3dd27R19
Further, also in this PR, empty string is written by []byte{0x00, 0x00}
.
However, I never find reference to this rule in any documents. (ex. ISO/IEC, Apple, Wikileaks, ...) So, I never understand whether this format is a special case of Pascal style string or any other rule.