Category: mkv

Add subtitles to .avi and convert it to .mkv file

This time I had a movie .avi with two audio tracks, Italian and English. My aim was to add the relative subtitles and change the container to .mkv. Italian subtitle was .srt while the English one was .sub. Here how to do it.
Install “subtitle editor” through the Ubuntu Software Center or install it with apt-get command.
The project is located here: http://home.gna.org/subtitleeditor/

$ sudo apt-get install subtitleeditor

We need to convert the subtitle .sub to .srt
Launch Subtitle Editor through Applications->Sound & Video.
File->Open and will appear another window. Select the file .sub or whatever you want to convert. In my case one subtitle file was in English and I left the Character Coding = Auto Detect. If you have another language with accents or whatever you have to select/add the right charset, for example for the Italian subtitles file I had to select Latin1 (iso-8859-1).

Then File->Save As with the following settings:

  • Format = SubRip
  • Character Coding = Unicode (UTF-8)
  • NewLine = Windows (I just left the default value, didn’t try to change it).

Install mkvtoolnix. Go here: http://www.bunkus.org/videotools/mkvtoolnix/downloads.html, add the repository and follow the install instructions.

We are ready to open the avi file. Lauch mkvmergeGUI, with Ubuntu 10.10 I have it in Applications->Sound & Video.

Input Tab: click on the button “add” to add the .avi video and the subtitles .srt. In my case I had two files, Italian and English. Here what I got:

screenshot-mkvmergeGUI

Then you can easily modify some settings such as the default audio track or which subtitle we want automatically enable. I wanted to assign the right language id to the Italian audio track and select it as default. I selected the single audio track then set

  • Language = ita (Italian)
  • Default track flag = default
  • Forced track flag = no.

The same for the English track but this time Default track flag = no. When opening the video with VLC you get this:

Then the subtitles. Select the single SRT track you want to edit and again change the Language, Default track flag, Forced track flag as you wish. Again, with VLC this is the result:

We are ready to mux the tracks into mkv container.

Select the filename editing the Output filename path and click on Start muxing.

WordPress Themes