我正在开发一个 mp4 容器解析器,但我正在疯狂地试图识别流的音频编解码器。我同时使用了 QtAtomViewer 和 AtomicParsley 但是当我找到原子时:
trak->mdia->minf->stbl->stsd
即使 mp4 文件有 mp3 流,我总是得到“mp4a”。
我应该寻找“.mp3”fourcc 吗?
我附加了两个不同的 mp4 结构: mp4 container with AAC audio stream
Atom trak @ 716882 of size: 2960, ends @ 719842
Atom tkhd @ 716890 of size: 92, ends @ 716982
Atom mdia @ 716982 of size: 2860, ends @ 719842
Atom mdhd @ 716990 of size: 32, ends @ 717022
Atom hdlr @ 717022 of size: 33, ends @ 717055
Atom minf @ 717055 of size: 2787, ends @ 719842
Atom dinf @ 717063 of size: 36, ends @ 717099
Atom dref @ 717071 of size: 28, ends @ 717099
Atom stbl @ 717099 of size: 2727, ends @ 719826
Atom stts @ 717107 of size: 24, ends @ 717131
Atom stsz @ 717131 of size: 1268, ends @ 718399
Atom stsc @ 718399 of size: 40, ends @ 718439
Atom stco @ 718439 of size: 32, ends @ 718471
Atom stss @ 718471 of size: 1264, ends @ 719735
Atom stsd @ 719735 of size: 91, ends @ 719826
Atom mp4a @ 719751 of size: 75, ends @ 719826
Atom esds @ 719787 of size: 39, ends @ 719826
Atom smhd @ 719826 of size: 16, ends @ 719842
带有 mp3 音频流的 mp4 容器
Atom trak @ 1663835 of size: 4844, ends @ 1668679
Atom tkhd @ 1663843 of size: 92, ends @ 1663935
Atom mdia @ 1663935 of size: 4744, ends @ 1668679
Atom mdhd @ 1663943 of size: 32, ends @ 1663975
Atom hdlr @ 1663975 of size: 45, ends @ 1664020
Atom minf @ 1664020 of size: 4659, ends @ 1668679
Atom smhd @ 1664028 of size: 16, ends @ 1664044
Atom dinf @ 1664044 of size: 36, ends @ 1664080
Atom dref @ 1664052 of size: 28, ends @ 1664080
Atom stbl @ 1664080 of size: 4599, ends @ 1668679
Atom stsd @ 1664088 of size: 87, ends @ 1664175
Atom mp4a @ 1664104 of size: 71, ends @ 1664175
Atom esds @ 1664140 of size: 35, ends @ 1664175
Atom stts @ 1664175 of size: 24, ends @ 1664199
Atom stsc @ 1664199 of size: 28, ends @ 1664227
Atom stsz @ 1664227 of size: 2228, ends @ 1666455
Atom stco @ 1666455 of size: 2224, ends @ 1668679
谢谢 FE
更新:
我找到了解决问题的方法:通过查看 AtomicParsley 的代码,我发现可以获取有关流原子(mp4a)的编解码器信息,将第 11 个字节读入 esds(基本流描述)原子。
现在我正在以这种方式工作:
如果第 11 个字节的值为 0x40,我假设流是 AAC,否则如果我读取 0x69,我假设流是 MP3。
我不喜欢这些“经验”解决方案,所以我正在寻找更正确的方法,但我发现只有Understanding_AAC不完整。
有人知道我在哪里可以获得更详细的 MP4 容器规格吗?