Recently I have downloaded some video files from the internet which were in MKV format. I want to play the same files on my video player. But here comes the problem, my video player do not support MKV files.

As there was number of files I decided to convert the same using avconv command. “avconv” comes with libav-tools package on Ubuntu. It is the backend for many of the GUI tools cited in other answers.

Changing container without re-encoding content could not be simpler:

avconv -i input.mkv -codec copy output.mp4

It auto-detects a Matroska > MPEG4 container conversion based on input/output filenames. -codec copy tells all content should be copied as-is without re-encoding.

If format auto-detection fails, you can use the -f option before either input, output, or both. From the manual:

f fmt (input/output)

Force input or output file format. The format is normally autodetected for input files and guessed from file extension for output files, so this option is not needed in most cases.

If you want to transfer both the video and audio (both losslessly) and for it not to choke on subtitles then:

avconv -i input.mkv -c:v copy -c:a copy -sn output.mp4. 

MP4 supports the most of the common audio formats used in MKVs including MP3 and AAC

How to convert MKV files to MP4 Ubuntu 12.10 / 12.04 / 11.10
Tagged on:                                                                     

Leave a Reply

Your email address will not be published. Required fields are marked *