想直接数据一个webM的文件组成,有什么工具吗?答案是有。只不过需要你下载编译一下。
代码链接:https://github.com/webmproject/libwebm/
下载以后,执行
cmake -G %1 -DENABLE_WEBM_PARSER=ON
make
就会生成根目录下工具webm_parser_demo。
使用方法:
./webm_parser_demo [path_to_webm_file]
我这里的一个输出结果:
EBML header: [0, 5) body: [5, 36)
EBMLVersion: 1
EBMLReadVersion: 1
EBMLMaxIDLength: 4
EBMLMaxSizeLength: 8
DocType: webm
DocTypeVersion: 2
DocTypeReadVersion: 2
Segment header: [36, 48) body: [48, 52551)
SeekHead header: [48, 53) body: [53, 111)
Seek header: [53, 56) body: [56, 67)
SeekID: Info
SeekPosition: 161
Seek header: [67, 70) body: [70, 81)
SeekID: Tracks
SeekPosition: 216
Seek header: [81, 84) body: [84, 96)
SeekID: Tags
SeekPosition: 295
Seek header: [96, 99) body: [99, 111)
SeekID: Cues
SeekPosition: 52481
Void header: [111, 120) body: [120, 209)
Info header: [209, 214) body: [214, 264)
TimecodeScale: 1000000
Duration: 440
MuxingApp: Lavf58.65.101
WritingApp: Lavf58.65.101
Tracks header: [264, 269) body: [269, 343)
TrackEntry header: [269, 278) body: [278, 343)
TrackNumber: 1
TrackUID: 9264757200382248367
TrackType: 1 (video)
FlagEnabled (implicit): 1
FlagDefault (implicit): 1
FlagForced (implicit): 0
FlagLacing: 0
Language: und
CodecID: V_VP8
SeekPreRoll (implicit): 0
Video
FlagInterlaced: 2 (progressive)
AlphaMode: 1
PixelWidth: 1280
PixelHeight: 720
Colour
Range: 1 (broadcast)
Tags header: [343, 349) body: [349, 503)
Tag header: [349, 359) body: [359, 398)
Targets
SimpleTag
TagName: ENCODER
TagLanguage (implicit): und
TagDefault (implicit): 1
TagString: Lavf58.65.101
Tag header: [398, 408) body: [408, 503)
Targets
TagTrackUID: 9264757200382248367
SimpleTag
TagName: ENCODER
TagLanguage (implicit): und
TagDefault (implicit): 1
TagString: Lavc58.115.102 libvpx
SimpleTag
TagName: DURATION
TagLanguage (implicit): und
TagDefault (implicit): 1
TagString: 00:00:00.440000000
Cluster header: [503, 510) body: [510, 52529)
Timecode: 0
BlockGroup header: [513, 522) body: [522, 24980)
Block header: [522, 526) body: [526, 18189)
track number: 1
frames: 1
timecode: 0
lacing: 0 (none)
flags: visible
frame byte range: [530, 18189)
BlockAdditions
BlockMore
BlockAddID: 1
BlockAdditional: <6766 bytes>
BlockGroup header: [24980, 24989) body: [24989, 26060)
Block header: [24989, 24992) body: [24992, 25384)
track number: 1
frames: 1
timecode: 40
lacing: 0 (none)
flags: visible
frame byte range: [24996, 25384)
BlockAdditions
BlockMore
BlockAddID: 1
BlockAdditional: <648 bytes>
ReferenceBlock: -40
BlockGroup header: [26060, 26069) body: [26069, 28558)
Block header: [26069, 26072) body: [26072, 27215)
track number: 1
frames: 1
timecode: 80
lacing: 0 (none)
flags: visible
frame byte range: [26076, 27215)
BlockAdditions
BlockMore
BlockAddID: 1
BlockAdditional: <1315 bytes>
ReferenceBlock: -40
BlockGroup header: [28558, 28567) body: [28567, 31541)
Block header: [28567, 28570) body: [28570, 29928)
track number: 1
frames: 1
timecode: 120
lacing: 0 (none)
flags: visible
frame byte range: [28574, 29928)
BlockAdditions
BlockMore
BlockAddID: 1
BlockAdditional: <1585 bytes>
ReferenceBlock: -40
BlockGroup header: [31541, 31550) body: [31550, 34114)
Block header: [31550, 31553) body: [31553, 32762)
track number: 1
frames: 1
timecode: 160
lacing: 0 (none)
flags: visible
frame byte range: [31557, 32762)
BlockAdditions
BlockMore
BlockAddID: 1
BlockAdditional: <1324 bytes>
ReferenceBlock: -40
BlockGroup header: [34114, 34123) body: [34123, 36442)
Block header: [34123, 34126) body: [34126, 35091)
track number: 1
frames: 1
timecode: 200
lacing: 0 (none)
flags: visible
frame byte range: [34130, 35091)
BlockAdditions
BlockMore
BlockAddID: 1
BlockAdditional: <1323 bytes>
ReferenceBlock: -40
BlockGroup header: [36442, 36451) body: [36451, 39528)
Block header: [36451, 36454) body: [36454, 37744)
track number: 1
frames: 1
timecode: 240
lacing: 0 (none)
flags: visible
frame byte range: [36458, 37744)
BlockAdditions
BlockMore
BlockAddID: 1
BlockAdditional: <1756 bytes>
ReferenceBlock: -40
BlockGroup header: [39528, 39537) body: [39537, 43754)
Block header: [39537, 39540) body: [39540, 40876)
track number: 1
frames: 1
timecode: 280
lacing: 0 (none)
flags: visible
frame byte range: [39544, 40876)
BlockAdditions
BlockMore
BlockAddID: 1
BlockAdditional: <2850 bytes>
ReferenceBlock: -40
BlockGroup header: [43754, 43763) body: [43763, 45305)
Block header: [43763, 43766) body: [43766, 44463)
track number: 1
frames: 1
timecode: 320
lacing: 0 (none)
flags: visible
frame byte range: [43770, 44463)
BlockAdditions
BlockMore
BlockAddID: 1
BlockAdditional: <814 bytes>
ReferenceBlock: -40
BlockGroup header: [45305, 45314) body: [45314, 47316)
Block header: [45314, 45317) body: [45317, 46251)
track number: 1
frames: 1
timecode: 360
lacing: 0 (none)
flags: visible
frame byte range: [45321, 46251)
BlockAdditions
BlockMore
BlockAddID: 1
BlockAdditional: <1037 bytes>
ReferenceBlock: -40
BlockGroup header: [47316, 47325) body: [47325, 49594)
Block header: [47325, 47328) body: [47328, 48580)
track number: 1
frames: 1
timecode: 400
lacing: 0 (none)
flags: visible
frame byte range: [47332, 48580)
BlockAdditions
BlockMore
BlockAddID: 1
BlockAdditional: <986 bytes>
ReferenceBlock: -40
BlockGroup header: [49594, 49603) body: [49603, 52529)
Block header: [49603, 49606) body: [49606, 50923)
track number: 1
frames: 1
timecode: 440
lacing: 0 (none)
flags: visible
frame byte range: [49610, 50923)
BlockAdditions
BlockMore
BlockAddID: 1
BlockAdditional: <1578 bytes>
ReferenceBlock: -40
Cues header: [52529, 52534) body: [52534, 52551)
CuePoint header: [52534, 52536) body: [52536, 52551)
CueTime: 0
CueTrackPositions
CueTrack: 1
CueClusterPosition: 455
CueRelativePosition: 3
需要说明的是,BlockGroup包含了一帧数据的内容。我的文件是支持alpha通道的视频文件。所以透明数据,放在了BlockAdditional(把透明数据,单独用VP8编码)。