- You have now to demux the file into audio and video files. But you have to determine what streams the footage contains, and you have to remember them and the fps rate. Example:
mkvinfo -s filename.mkv | head -3
results in these lines. Now you have to look for the appropriate language.
Track 1: video, codec ID: V_MPEG4/ISO/AVC, default duration: 41.708ms (23.976 fps for a video track), language: eng, pixel width: 1920, pixel height: 1040, display width: 1920, display height: 1040
Track 2: audio, codec ID: A_AC3, default duration: 32.000ms (31.250 fps for a video track), language: ger, sampling freq: 48000, channels: 6
Track 3: audio, codec ID: A_DTS, language: eng, sampling freq: 48000, channels: 6
If you need the English track, you have to remember “Track 3”. Your video track number is “Track 1”.
- Now you’ve got to extract the file:
mkvextract tracks filename.mkv 1:mkv_video 3:mkv_audio_eng
It’s up to you, how your files are called, these are my names, I’ve used for this example, please adjust them accordingly:
Merge your files:
- Now you just simply have to merge them again. The repairing part is actually the extraction itself, because a plausibility check of the content is done, and corrected on the fly.
mkvmerge --default-duration 0:23.976fps mkv_video mkv_audio_enl -o my_output_filename.mkv
The fps value is taken from the very first step (
mkvmerge -i). The first output line gave you the frames per second rate (fps). Take this value, else you’ll suffer from an extreme evil audio de-sync.
I’m on a Q6600 quadcore machine with a RAID0. The whole repairing process of a 8GB Matroska file took me about less than 15mins (conservative estimation). If you are on a slow machine and a remote network it could take significantly longer, but not ages, since it’s no trancoding, but a demuxing.
Please report bug, errors, typos. If you really liked this article, click on any of the sponsored links 😉 Thanks.