【发布时间】:2022-08-05 06:07:51
【问题描述】:
我正在尝试解析 mp4 并能够解析 moov,但不确定如何使用 moov 信息来解析 mdat。
我的目标是从mdat 获取轨道信息,如元数据和可能的帧,因为它包含视频和音频数据。
目前关注QuickTime File Format Specification
尝试使用Sample-to-Chunk Atoms,但我所有的 stsc(20 字节)看起来像这样:
[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
[0 0 0 0]
[0 0 0 1]
[0 0 0 1 0 0 0 1]
[0 0 0 1]
fmt.Println(binary.BigEndian.Uint32(buf[0:4])) //4
fmt.Println(binary.BigEndian.Uint32(buf[4:8])) //4
fmt.Println(binary.BigEndian.Uint32(buf[8:16])) //8
fmt.Println(binary.BigEndian.Uint32(buf[16:20])) //4
目前不知道如何接近和解析mdat 原子。
任何帮助,将不胜感激!
-
你试过这个库吗? pkg.go.dev/github.com/abema/go-mp4
-
如果没有,您可以尝试定义您的结构并使用它来解析:nicedoc.io/ghostiam/binstruct
-
@code0x00 尝试阅读为
buf[0:3]和buf[4:7]等...?你的前四个字节是[0] [1] [2] [3],那么为什么要读到[4]?