Programster's Blog

Tutorials focusing on Linux, programming, and open source

FFMPEG - Losslessly convert mp4 to mkv

The formats mp4 and mkv are just the "containers" for video files that you have, which "contain" the video, audio, and metadata, such as chapter information and subtitles, for the content. The video and audio streams are encoded using codecs such as libx264 and vorbis etc. Since mkv and mp4 can both hold the same codecs (as far as I'm aware) you can losslessly convert an mp4 file into an mkv file in order to take advantage of the additional functionality mkv can provide, such as better support for subtitles etc.

This tutorial assumes you are using a Linux computer.

To convert an mp4 video to mkv, simply install ffmpeg and run the command below:

ffmpeg \
-i input.mp4 \
-vcodec copy \
-acodec copy \