能够将mkv文件转储到某些文本(例如mkvinfo -v),编辑它并重新构建,将二进制数据保留为十六进制转储是很有用的. 就像是: $mkv2xml test.mkv test.xml$head test.xmlEBML EBMLVersion1/EBMLVersion MaxIdLen4/Ma
就像是:
$mkv2xml < test.mkv > test.xml $head test.xml <EBML> <EBMLVersion>1</EBMLVersion> <MaxIdLen>4</<MaxIdLen> <MaxSizeLen>8</MaxSizeLen> <DocType>matroska</DocType> <DocTypeVersion>2</DocTypeVersion> <DocTypeReadVersion>2</DocTypeReadVersion> <Segment> <Tracks> <Track> <TrackNumber>1</TrackNumber> <CodecID>V_MJPEG</CodecID> <Video><PixelWidth>320</PixelWidth><PixelHeight>240</PixelHeight></Video> </Track> </Tracks> <Cluster> <Timecode>5.023</TimeCode> <SimpleBlock track="1" time="5.045"> ffd8fffe001a80...... $xml2mkv < test.xml | mplayer -cache 100 -
这有助于简化编写[调试]工具与视频一起工作,而无需实际处理多路复用/多路分解细节,只需查看输出即可.
用Python实现自己: https://github.com/vi/mkvparse可以转换为xml,更改某些内容(例如,使用xml2/2xml),转换回来并在一个管道中播放.
示例XML文件:http://vi-server.org/pub/xml2mkv_test.xml
这里修剪(甚至更多)片段:
<mkv2xml> <EBML> <EBMLVersion>1</EBMLVersion> <DocType>matroska</DocType> </EBML> <Segment> <Info> <TimecodeScale>1000000</TimecodeScale> <MuxingApp>libebml v1.0.0 + libmatroska v1.0.0</MuxingApp> <Duration>46665.0</Duration> <DateUTC>1282406803.0</DateUTC> <SegmentUID>9d516a0f927a12d286e1502d23d0fdb0</SegmentUID> </Info> <Tracks> <TrackEntry> <TrackNumber>1</TrackNumber> <TrackType>1</TrackType> <CodecID>V_MPEG4/ISO/AVC</CodecID> <CodecPrivate> 014d401fffe10014274d401fa918080093600d418041adb0ad7bdf0101000428 ce09c8 </CodecPrivate> <Video> <PixelWidth>1024</PixelWidth> <PixelHeight>576</PixelHeight> </Video> </TrackEntry> <TrackEntry> <TrackNumber>2</TrackNumber> <TrackType>2</TrackType> <CodecID>A_AAC</CodecID> <Audio> <SamplingFrequency>48000.0</SamplingFrequency> <Channels>2</Channels> </Audio> </TrackEntry> <TrackEntry> <TrackNumber>3</TrackNumber> <CodecID>S_TEXT/UTF8</CodecID> </TrackEntry> ... </Tracks> <Cluster> <Timecode>0</Timecode> <SimpleBlock> <track>1</track> <timecode>0.0</timecode> <keyframe/> <data> 00004e1925b82001ebd34d359f84a010001019b0f94a107609ec4dc0b6341175 98899cbb3a0a9de562532111ed77f7876006014200856a5fc3c2ccdf6e10a385 ... </data> </SimpleBlock> <SimpleBlock> <track>10</track> <timecode>0.009</timecode> <keyframe/> <data> 01449ffe0b246a488f09c715768924b01aa2e9b2415aaa29e4696becea270d36 a0d565bd24d5e6f09f3d4e000a8f192aa6aaa071f2ba14bd2fa14d633ad665ee 72e92eadce23415fd6bb871941941b1bfd5b0e75ad6826755e61ef5483f93cd3 82d61c779fa74b4acd62572b399ac3d9039900e94a5c542e4110dd29b65e2000 220011a10c00000000b0a8540100880380 </data> <data> 0144d7902c180b04c28161a8482a160a048aa1209848423208cdeed6de7c6b7a ..... </data> ... </SimpleBlock> <BlockGroup> <Block> <track>4</track> <timecode>0.042</timecode> <duration>3.375</duration> <data encoding="text"><![CDATA[A jobb oldaladon láthatod... ...tudod mit...]]></data> </Block> <BlockDuration>3375</BlockDuration> </BlockGroup> <BlockGroup> <Block> <track>5</track> <timecode>0.042</timecode> <duration>3.375</duration> <data encoding="text"><![CDATA[Auf der rechten Seite sieht man...|...rate mal...]]></data> </Block> <BlockDuration>3375</BlockDuration> </BlockGroup> </Cluster> </Segment> </mkv2xml>