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

From WickyWiki
m only one filename allowed
m only one filename allowed
Line 21: Line 21:


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


#edit metadata
#edit metadata

Revision as of 21:25, 27 May 2015

Tools: mkvmerge, mkvinfo, mkvextract, mkvpropedit, mmg

sudo apt-get install mkvtoolnix

Example:

#describe the mkv contents and tracks
mkvinfo file.mkv

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

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

#extract attachments id=1
mkvextract attachments file.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'