Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I extracted audio and video from an mkv using mkvextract. Then I used mkvmerge to merge them back into an mkv. When I played the mkv the audio and video were out of sync.

How can I combine them so that they are in sync? I tried to find some helpful information using mkvmerge on the original file to see if there was any useful information, but didn't find any.

share|improve this question

It's possible that the original file specified an audio delay. If you're using the mkvmerge GUI, you can change the audio track's delay in the Format specific options tab. Positive values delay the audio track, negative values advance it (all in milliseconds). If you're using the command line, you need to use the -y or --sync arguments. See the mkvmerge documentation for details. The documentation also shows you how to scale the audio delay evenly though out the video (instead of a set constant delay).

To determine the audio delay you need, you can use Media Player Classic along with the +/- keys to determine the delay. Alternatively, you can try to use a media information tool to see what the delay was on the original file.

share|improve this answer
If there's a delay specified in the original file, shouldn't mkvinfo be able to display that? – tony_sid Jul 30 '11 at 19:37
@OSX Jedi Yes, but only if the delay was after the audio was encoded (and explicitly specified when the file was first mkvmerge'd). – Breakthrough Jul 30 '11 at 21:27

Here is a simple workflow:

  • Find out how much out of sync it is with VLC player by using j and k buttons.
  • Download mkvtoolnix and click on add file.
  • Add your video file. When added, click on the audio file and now you can add your delay. Simply put, use - or + and which ever you delay worked out with vlc.
  • Press mux now. Done :)
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .