go-mp4 icon indicating copy to clipboard operation
go-mp4 copied to clipboard

Support old QuickTime atoms

Open sunfish-shogi opened this issue 3 years ago • 2 comments

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 , no flags

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

sunfish-shogi avatar Jul 17 '20 16:07 sunfish-shogi

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 Screen Shot 2020-07-25 at 3 06 09 Screen Shot 2020-07-25 at 3 01 01 Screen Shot 2020-07-25 at 3 08 13

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.

sunfish-shogi avatar Jul 24 '20 18:07 sunfish-shogi