Fredrik Erlandsson

Logo

PhD in Computer science, data scientist at Consid AB.

Remux and transcode mkv movies.

2011-11-03

Various codes to modify mkv movies.

Add audio track to an mkv movie

Small scipt to add audio tracks to a mkv movie using mkvmerge.

In the terminal: move everything into the same directory and join with:

mkvmerge -o out.en-sv.mkv \
   in.mkv \
  --language 0:swe audio_swe.dts \

Then you can remove all original files.

Swap audio channels

Using mencoder (built in mplayer) to switch place of the back and front speakers.

mencoder source.mkv \
 -o out.mkv  \
 -channels 6 -af channels=6:6:2:0:0:2:3:1:1:3:4:4:5:5 \
 -of lavf -lavcopts vcodec=mkv -ovc copy -oac copy

Add chapter file

Using mkvmerge for this too.

mkvmerge -o out.mkv \
 --chapters chapters.xml \
 in.mkv