AfterDawn.com

How to handle corrupt MKV files


While MKV (Matroska) is arguably one of the most important most prominent multimedia containers these days, there is not a whole lot of tools dedicated to fixing problems with bad MKV files like there is for AVI or MPEG problems. As time goes on, this should change and MKV will become even better because of it. Until then, there is not a lot you can do to easily repair a lot of potential problems with MKV files but there are a couple of suggestions.


Introduction & Requirements


Software you must download and install
 Media Player Classic
 Optional: Media Player Classic is not a tool for fixing video sync problems, but it can be used to set audio delays during playback that can fix problems on-the-fly without modifying the file.. Download!
 Meteorite
 Optional: Meteorite is used to attempt to repair problems with the MKV container itself. It is only new software and it very very limited for the time being (April 2010). Download!


Media Player Classic is capable of opening MKV files due to an internal splitter but it can help to disable this splitter and rely on the Haali Media Splitter instead. Media Player Classic is not a repair tool but if your problem is audio sync then it can probably help with that.

Meteorite, or Project Meteorite, is a piece of software that aims to be what DivFix++ was for AVI files, a simple utility that scans through a video file and searches for problems it can correct. For now it is quite limited and has limited abilities. (check homepage).

What kind of problems?


As indicated in the introduction, MKV files aren't as easily "fixed" as AVI files or MPEG files are. For example, if your problem is an audio sync issue, then your best bet is to simply correct that during playback with Media Player Classic or a similar solution. However, if you actually have a playback problem then the fault may be with a bad MKV container and then perhaps Meteorite will fix that during processing.

Please make sure beforehand to have your computer setup properly for video playback. That includes all of the video codecs you will need to play, for example, H.264 video (install FFDShow) and if using a DirectShow-based player, then to have a proper container splitter installed that supports MKV (install Haali Media Splitter). It also may help to install the AC3Filter software. If all else fails, try VLC Media Player instead.

Also please note that MKV files often contain content with a large resolution such as 720p, or 1080p. If your computer is incapable of playing back a High-definition video, then you will get jumpy playback at least with 1080p. If this is the case, you are somewhat out of luck unless you play around with the AVC codecs you have installed and find one that will work better with your setup.

Fixing sync problems with Media Player Classic




Download Media Player Classic. It is a powerful media player for windows modeled after the traditional media player software that came with Windows - just with tons of new features and native format support. One thing it can also do is set an audio "time shift" that can play a usually out of sync MKV file perfectly.

Set Audio Delay




Once you have your MKV playing, try to work out if the audio is before or behind the video. For example, do you hear somebody speak before the actors' mouth moves? If you, then you need to estimate the amount of time there is in the difference. Usually it is just a fraction of a second. Don't worry about estimating for a moment because it would be next to impossible to get it right on the first go anyway. Click Play (the menu) in Media Player Classic, and then move the point over Audio. From the sub-menu for Audio, click Options.

You will now see the window on your screen that is shown in the screen shot above. Firstly, tick the box beside "Audio time shift (ms)". You can now enter a time delay in a number of milliseconds (one thousand of a second). If the audio plays before the video, then the audio needs to be delayed. 500 milliseconds is half a second, so if you set "500", then the audio will be delayed by half a second on playback from its original timing.

If the audio comes too long after the video, then you need to set a negative delay. if you were to set "-500", then the audio would play half a second sooner than the video, compared to the original timing.

This is a little tedious on the first try, but set something like "500" or "-500" based on whether the audio players before or after the video, and click Apply, then click OK. Now press the play button on your video and after a few seconds the difference will be noticeable.

You can go back to the Audio Options again and change the time shift as much as you want, until you get it right. Remember that when you set the audio delay, it will be saved to the Windows Registry, which means the delay will automatically be applied to any other video you play unless you turn it off. This means that you might mistake videos for being out of sync, so bare that in mind.

Hopefully this will help you to quickly resolve sync issues with MKV files without having to modify them in any way.

General Playback Issue -> Project Meteorite




Run Meteorite. At this stage, the tool is somewhat limited but it may still be able to fix a common MKV problem or two and rebuild it for you. It works by having you simply drag and drop and file with your mouse into it. Drag the MKV file from its folder and drop it right over the application and it will begin its process immediately.

Meteorite Processing




The software will now scan through the MKV and create a new file in the same directory with the word "Meteorite" added to the start of the file name. This new file will be rebuilt and hopefully any errors that were causing playback issued before can be resolved now. The program does not provide an estimated time remaining but it depends on the size of your MKV file. For large multi-gigabyte downloads this might take a long time to complete.

Success?




Meteorite doesn't prompt you to indicate whether it has been successful or not. However, if you check the folder that contained your original MKV file you should now have another file in there with the same filename except the word "Meteorite" has been added. Check the new file and hopefully you will get better results trying to play it.

Finally


For now that is about all you can do easily with MKV files to help fight against a problem. Other solutions could involve extracting streams from an MKV file and rebuilding an MKV completely yourself. This guide will be updated in the near future with such suggestions, and hopefully Meteorite will have progressed a bit by then. If you want further help with MKV files, check the Discussion Forums.
Written by: James Delahunty