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 \
output.mkv

Author

Programster

Stuart is a software developer with a passion for Linux and open source projects.

comments powered by Disqus
We are a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for us to earn fees by linking to Amazon.com and affiliated sites. More info.