How to Fix an Incorrect Audio/Video Sync Setting and Save it Permanently using ‘Avidemux’

Audio to video synchronization‘ is an extremely important aspect of a multimedia file, because when playing, multimedia players rely on it for properly synchronizing the audio and the video tracks. If the synchronization value is incorrect, then the audio (or the video) is going to be played early or with a delay, compared to the other, which is commonly known as ‘lip-sync’ errors, and it jeopardizes all the excitement, obviously.

For instance, while watching a movie, if you have ever come across situations like gunshot firing sounds coming out before its video scene is displayed, then that is due to an improper audio to video sync. This is a pretty common issue in multimedia files and there are many reasons behind its existence, but for keeping the article clear and simple so that anyone can understand its context without having to go through boring technical details, I will not mention them. Sometimes syncing issues are also caused by audio hardware devices (sound cards, amplifiers or even buggy headphones etc). But this method that I’m going to show you, only works if the sync problem lies with the multimedia file. If it’s hardware based, you should be looking elsewhere.

In any case, the good news is, depending on the OS platform that you are using, there are powerful software multimedia players (VLC, KMPlayer, MPLayer etc) that give you the ability to manually adjust the sync (video or audio) setting, thus you can enjoy the multimedia files without such issues.

Avidemux-running-on-Windows-8

The problem with that method however is that it only saves the sync setting temporarily, and it will be lost the next time you play it. Therefore, the most ideal solution is to use a video syncing (synchronization) software to fix it. And the good news is that you don’t have to buy a premium software utility, because thanks to a great (and free) open-source tool called ‘Avidemux’, you can save the audio & video out of sync setting permanently for a lots of video & audio codecs (HD, Blu-ray or even 4K videos!) and container formats (MP4, MKV, FLV, MPEG, AVI etc). ‘Avidemu’ is actually one of the best free audio and video synchronization software that you can use (it’s originally intended purpose is actually to act as a simple video editing & encoding software which comes with in-built filters etc).

‘Avidemux’ also supports multiple operating systems, therefore you don’t have to be only a Windows user to use it either. So if you’re having lip-sync errors in one of your multimedia files, then you can try the below ‘Steps’ for a possible fix. While the results are not always guaranteed, ‘Avidemux’ has a good track record. If this method fails, then I’ve added another method that guarantees results in most situations at the end of the article as well.

Update (2017-07-25): Yes it’s been more than four years since I originally wrote this post (yes, even so, I update it from time to time), but the instructions still work. I just added this ‘update’ just to give some confidence to the readers.

Step 1:

First of all, go to this page, download the package and install it (it has pre-built packages for Windows, Mac OS X and GNU/Linux).

Step 2:

Now open ‘Avidemux’ program and load the ‘troublesome’ multimedia file into it.

Step 3:

Before continuing, under the ‘Video Output‘ and ‘Audio Output‘ options, make sure it says ‘Copy’. Also make sure to enable the option called ‘Shift’ (disabled by default), as it is the option that lets you change the audio/video sync setting (shown below).

Enabling-few-primary-options-in-Avidemux

Any value that you enter here (‘Shift’) should be in milliseconds (1000 milliseconds = 1 second).

Step 4:

Now, if you know what the correct audio/video sync value is then you can skip this and go directly into the end of ‘Step 5‘. If not, click on the ‘Play’ button on ‘Avidemux’ window, so we can observe and see whether the audio comes before or after the video scenes.

How to Sync Audio and Video Correctly?

If the audio comes ‘before’ …

Positive-sync-value-Avidemux

The rule of the thumb is that, if the audio is played before the video, then that means we have to ‘add time’ to it (thus delaying it), so the video track can ‘catch up’ with the audio track. This is done by entering a positive sync value (say 200 milliseconds) into the ‘Shift’ box.

If the audio comes ‘after’ …

Negative-sync-value-Avidemux

If it comes few seconds (or milliseconds) after the video scene is displayed, then it is already delayed, therefore, we have to ‘remove time’ from it, thus making it being played early.

One cannot give you the exact audio/video sync value that is needed as it is something that you will have to guess by observing the video playback. However, in my experience, the usual range is 200 milliseconds to 2000 milliseconds (2 seconds). But there can be occasions where it requires one to enter higher values.

Anyhow, unlike above, this time we have to add a negative value as the sync value, in order to make it load earlier (if you enter ‘-200’, then that means the audio will be loaded 200 milliseconds early).

Step 5:

Let’s assume that the file you loaded had an audio track that was being played with a delay. Then to make it play early, we have to enter a negative value. And unless the sync was so big that you could easily tell that the audio came few seconds after the video, I recommend that you start by entering a small negative (say a ‘-100’ milliseconds) value first.

If it fixes the lip-sync a little, then add another -100 (altogether ‘-200’ milliseconds). Then carry it on until you arrive at the optimal audio/video sync value.

However, before every time you apply a different sync setting, first make sure to ‘Pause’ the playback, then add the new value and resume playback. Otherwise ‘Avidemux’ will not apply that setting to the playback.

Proper-way-of-entering-audio-video-sync-values-Avidemux

Note: This is just an example (of course) and depending on your multimedia file, you will have to figure out whether to use a negative or a positive value, but the procedure is just the same.

Step 6:

Once you are satisfied with your new audio/video sync, now all you have to do is to save the changes. But before doing so, just make sure that under the ‘Output Format’ option, you have selected the proper output format.

Choosing-the-proper-container-format-Avidemux

For example, if the source file was an AVI file, then make sure to select ‘AVI Muxer’. If it was FLV, then choose ‘FLV Muxer’ etc.

‘Avidemux’ doesn’t have like a huge list there, but it supports saving into AVI, FLV, MP4, MPEG-TS, MKV etc. If your input file has a different format than listed there, then you can choose ‘MKV Muxer’ as it supports storing a huge number of different audio and video codecs.

Note: Please be aware that, if you put audio/video that were previously stored in an AVI file into a MKV container, then sure MKV will store them without any issues. But most commercial hardware devices (iPad for example) will struggle to play it afterwards. This does not concern the computer users as most popular players support playing the awesome MKV format.

Update: Sometimes while trying to fix a MP4 file, though you might be able to successfully fix it and play it in ‘Avidemux’, the corrected sync value might simply be lost, after saving it into a new MP4. If this occurs, then I advice you to try selecting ‘MP4v2 Muxer‘ rather than using the ‘MP4 Muxer‘ (under ‘Output Format‘). I have been able to successfully save the corrected sync settings of certain MP4 files, by simply making that change alone!.

Update 2: If that doesn’t work, then try changing the audio output from ‘copy’ to ‘MP3 Lame’. Yes this will re-encode the audio file, but it shouldn’t take a long time since encoding an audio track isn’t as difficult or time consuming as encoding a video file. I haven’t tried this, but someone called ‘John’ in the comment section let me know of this which has worked for him under Windows XP. I just have a gut feeling that this might work for all those of you who doesn’t seem to get an audio track in the output file after fixing the lip sync issue.

Step 7:

Once all is done, from its menu click on: ‘File’ -> ‘Save’ to save the changes permanently.

Depending on the length of the video, the time it takes will differ, but it should not take much longer (pretty much like copying that file over to somewhere else) since nothing gets re-encoded.

Saving-a-file-Avidemux

When it is finished saving, you can open that file using any media player, and if the sync value you entered was correct, then it should be playable without any sync issues. Well, that is it!.


Update: Some readers have complained that ‘Avidemux’ software is not always working for them when correcting the audio and video synchronization. So I wrote another method that uses another software tool (it involves two tools actually), which is known to work most of the time for correctly syncing the audio and the video. However, that method only supports saving your input files (you can input almost anything into it AVI, MPEG, MP4, FLV …) into ‘MKV’, which as briefly mentioned above, is not playable on certain hardware based multimedia players.

You can read about it from here.

An RHCE, 'Linux' user with 14+ years of experience. Extreme lover of Linux and FOSS. He is passionate to test every Linux distribution & compare with the previous release to write in-depth articles to help the FOSS community.

255 thoughts on “How to Fix an Incorrect Audio/Video Sync Setting and Save it Permanently using ‘Avidemux’”

  1. Hey, man, thanks a lot for this! It really help a lot! I’ve got lots of videos that is out of sync way back.

    But now, they’re all fixed, and thanks to you! God bless!

    Reply
  2. Brilliant! Thanks so much for posting this. What an invaluable tool — and your instructions couldn’t have been clearer or more concise. Truly appreciated.

    Reply
  3. Hi. The download link does say NOT XP COMPATIBLE. Don’t you have an XP compatible version. I use my XP laptop to play videos to my projector as its small. Please help

    Reply
  4. This worked really well for me with some files I had made .mp4 using winxdvd. Very clear explanation and correcting each video was quick. (abt 30 s).
    Thanks once again

    Reply
  5. this is the most comprehensive discussion on out of synch video that I’ve found. We recently discovered a solution for importing MTS files without losing sync. It is akin to Anna Hunter’s post about http://www.microphone.rocks , concering transfering video between IOS devices. After using Aimersoft to convert the MTS files and experiencing the gradual loss of synch my tech partner tried importing the MTS into iPhoto , which happens automatically when conecting an IOS device, but we are coming from a Canon AVCHD cam. The import is fast , with no loss of sync , and produces a MP4 file which easily imports into iMovie. I use iMovie6 with the GeeThree plug in for multi-cam, which unfortunaltely does not offer the sync fixing feature. I now feel I’m finding the tools after reading your posts and all the replies. thanks so much.

    Reply
  6. Hello Gayan

    Great tutorial and high quality comments!

    My problem is similar: I import a DVD-decrypter VOB file and convert it to .avi. Conversion is excellent but voice-lip-syncing is way off…always, so the .avi is not usable.

    Any ideas?

    Many thnks and HN2016!

    Reply
    • Hi,

      1.) Does the lip sync gets worsened as the playback progress or is it a constant delay? Do you get small errors while copying the DVD? (maybe the audio is slightly damaged? If it’s the case, some encoders might struggle at properly setting the audio sync)).

      2.) If it’s a constant delay, then have you tried to fix it with Avidemux?

      3.) If it gets worsened as the playback progress, then it might be because the audio playback rate is not compatible with the video playback rate. In that case, you can try to fix it using ‘MKVToolnix’, but unfortunately, it’ll put the file into the MKV container which is not supported by, well I guess older DVD players. I’ve already laid out some of the instructions for fixing such an issue in a comment, to find it, just search for ‘apple’ in this page and you should arrive at my comment.

      4.) If none of the above fix your issue, then try to copy the DVD files into the MKV container (without encoding) using ‘makemkv’ (www.makemkv.com) utility and then encode it into AVI using your application to see if it fixes it.

      Let me know how it went.

      P.S: Happy new year to you also 🙂 .

      Reply
  7. I just downloaded the program onto my iMac and tried to fix an out-of-sync video, but I’m not getting any sound. Also, the little slider knob on the far left just keeps wiggling in the far left position and won’t slide to the right when I play the video. Please help.

    Reply
    • Hi David,

      Sorry about the late response. If you’ve tried what I’ve suggested on the article and they haven’t worked, then I don’t know what else to say. I’m out of ideas. While you’re at it, have you tried the latest Avidemux beta package (although it’s a bit dangerous at its beta software, it’s well worth trying):

      http://www.avidemux.org/nightly/

      Reply
    • Hi Eduardo,

      Unfortunately I don’t have Windows 10 to test it out, and the only version of Windows I have is 8.1 which I run in a Virtuar-Machine under ‘Linux’. So I did the best I could and installed Avidemux in Windows 8.1 but came across no such issues. However, there is an option to enable OpenGL (to skip all the technical details, OpenGL is a tool that’s used to render the user interface of Avidemux), and while Avidemux came with it disabled in Windows 8.1 (I don’t know how it’s under Windows 10), the moment I enabled it (Edit –> Preferences –> Display: “Enable OpenGL Support”), Avidemux started crash whenever I added a video.

      *. Before making any changes, take a note of the default values (or if you forgot them, you can simply uninstall and re-install Avidemux).

      1. So, first make sure it’s disabled on Avidemux.

      2. If that doesn’t work out for you, then try changing ‘Sdl driver’ (Edit –> Preferences –> Display) to say ‘direct3d’ (whenever you make a change in Avidemux, once after applying, exit it and re-open it).

      3. If that doesn’t fix it for you then you can also try changing the settings under ‘Video Display’, which is displayed just above the ‘Sdl driver’.

      If none of the above works out for you, then try install an older version of Avidemux which you can accquire from the below link:

      https://sourceforge.net/projects/avidemux/files/avidemux/

      Please let me know what happened. Again, please remember that I’m simply guessing here and what I’ve told you could or could not work. Good luck.

      P.S: Click the below link to see a screenshot of some of the settings I mentioned above:

      http://www.hecticgeek.com/wp-content/uploads/2016/02/Changing-Display-settings-Avidemux-2.6.11.png

      Reply
  8. Here’s what worked for me…XP with Avidemux 2.6.1 32 bit…loaded MP4 file, tried directions with MP4 Muxer, result came out with no sound…try again MP4 V2 Muxer, no sound…tried again MP4 Muxer with audio changed to MP3 Lame and it worked

    Reply
  9. Please, a situation where the audio output starts coming out before the video at the middle of the movie and not the beginning, how can i solve this issue.. the video was normal from the start and along the middle area of the movie, the audio started coming before the video.. How can i solve this issue without affecting the starting of the video?

    Reply
    • Hi Ken,

      That’s the only thing I don’t know how to fix without re-encoding. These issues are usually caused by damaged headers or the index I presume. Sorry about that Ken.

      Reply
    • Ken, perhaps you could use an MP4 splitter to isolate the part(s) of the file where there is a problem – then join it back up? Not the neatest solution but it may work.

      Overall, this is a fantastic program and a really helpful article. Thanks Gayan.

      Reply
  10. Here is what I did to fix a movie that started off in sync but drifted out of sync toward the end of the movie. 1. Get frame rate for video track (frames per second).
    2. Get the total frame count for the video track.
    3. Divide the total frame count by the frame rate to get the duration of the video in seconds.
    4. Get the exact duration of the audio track and convert to seconds. You may need to extract the audio track from the video to calculate the exact duration. I did this with mkvtoolnix.
    5. Divide the video duration by the audio duration to get a “stretch” factor. A stretch factor that is greater than one will increase the duration of a track. A stretch factor less than one will decrease the duration of a track.
    6. Now you will need software to adjust the duration of one of the tracks to match the other. In my case the audio track duration was shorter than the video. I used mkvtoolnix, selected the audio track, inserted the stretch factor into the stretch by field (which was greater than one), clicked Start muxing. In a few seconds, the software was done, the track durations matched, and the audio and video were in sync.
    7. Note: work on a copy of the file just in case you need a do over.
    8. Note: if the audio is too early, you need to increase the duration of the audio track to match the video OR reduce the duration of the video track to match the audio track . If the audio is too late, you need to reduce the duration of the audio track to match the video OR increase the duration of the video to match the audio track. The stretch factor is the amount that you adjust one of the tracks to match the duration of another. The goal is to make both the audio and the video tracks of equal duration. This might also be useful for subtitles that are out of sync.

    Reply
    • Hi Larry,

      Great answer! I think I game a very similar one (either on this post on on the other – MKVToolnix, that I mentioned at the end of this post) as well.

      Reply
  11. You have NO idea how much this helped me. I was so frustrated because I recorded an amazing gameplay and for some reason Bandicam recorded the video with unsynchronized audio. I kept looking for videos and articles but they were all about synchronising audio over already existing audio. I’m so glad I found this because it just helped me so much. Thank you for this!!

    Reply

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Shares
Tweet
Share
Share
Pin