gpt4 book ai didi

xml - 是否有任何工具可以将 matroska (mkv) 与文本文件相互转换?

转载 作者:数据小太阳 更新时间:2023-10-29 02:05:22 24 4
gpt4 key购买 nike

能够将 mkv 文件转储为某些文本(例如在 mkvinfo -v 中)、编辑它并重建回来,例如将二进制数据保留为十六进制转储,这将很有用。

类似于:

$ 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>

关于xml - 是否有任何工具可以将 matroska (mkv) 与文本文件相互转换?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10453832/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com