Tools to manipulate .mkv (matroska) audio/video files: Difference between revisions

From WickyWiki
mNo edit summary
mNo edit summary
Line 2: Line 2:
[[Category:Ubuntu Video]]
[[Category:Ubuntu Video]]
[[Category:2010]]
[[Category:2010]]
Tools: mkvmerge, mkvinfo, mkvextract, mkvpropedit, mmg
=Tools: mkvmerge, mkvinfo, mkvextract, mkvpropedit, mmg=
* http://bunkus.org/videotools/mkvtoolnix
* http://bunkus.org/videotools/mkvtoolnix
* Add global tags: https://github.com/mbunkus/mkvtoolnix/issues/940
 
<syntaxhighlight lang=bash>
<syntaxhighlight lang=bash>
sudo apt-get install mkvtoolnix
sudo apt-get install mkvtoolnix
Line 25: Line 25:
#edit metadata
#edit metadata
mkvpropedit file.mkv --edit info --set "title=some title for file"
mkvpropedit file.mkv --edit info --set "title=some title for file"
</syntaxhighlight>
=Add global tags to mkv=
* https://github.com/mbunkus/mkvtoolnix/issues/940
You need to create an xml file with the tags and values:
<syntaxhighlight lang=bash>
gedit tags.xml
</syntaxhighlight>
<syntaxhighlight lang=xml>
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE Tags SYSTEM "matroskatags.dtd">
<Tags><Tag>
<Simple><Name>SomeTagName1</Name><String>SomeTagValue1</String></Simple>
<Simple><Name>SomeTagName2</Name><String>SomeTagValue2</String></Simple>
<!-- repeat ... -->
</Tag></Tags>
</syntaxhighlight>
Run the following command, tags are added or replaced:
<syntaxhighlight lang=bash>
mkvpropedit yourfile.mkv --tags global:"tags.xml"
</syntaxhighlight>
To list existing tags:
<syntaxhighlight lang=bash>
mkvinfo -v  yourfile.mkv | sed '1,/|+ Tags/d'
</syntaxhighlight>
</syntaxhighlight>

Revision as of 09:15, 1 March 2015

Tools: mkvmerge, mkvinfo, mkvextract, mkvpropedit, mmg

sudo apt-get install mkvtoolnix

Example:

#describe the mkv contents and tracks
mkvinfo *.mkv

#or for short list including attachment ID's
mkvmerge -i *.mkv

#extract tracks 1,2,3
mkvextract tracks *.mkv 1:video.mpeg 2:audio.mp3 3:subtitles.srt

#extract attachments id=1
mkvextract attachments *.mkv 1:attachments.ext

#edit metadata
mkvpropedit file.mkv --edit info --set "title=some title for file"

Add global tags to mkv

You need to create an xml file with the tags and values:

gedit tags.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE Tags SYSTEM "matroskatags.dtd">
<Tags><Tag>
 <Simple><Name>SomeTagName1</Name><String>SomeTagValue1</String></Simple>
 <Simple><Name>SomeTagName2</Name><String>SomeTagValue2</String></Simple>
 <!-- repeat ... -->
</Tag></Tags>

Run the following command, tags are added or replaced:

mkvpropedit yourfile.mkv --tags global:"tags.xml"

To list existing tags:

mkvinfo -v  yourfile.mkv | sed '1,/|+ Tags/d'