Close Menu
    X (Twitter)
    Hectic GeekHectic Geek
    • Apps
      • Apps for Mac
      • Apps for PCs
      • Best Apps
    • Concepts
      • Comparison
      • For Geeks
      • IT Careers
    • Gadgets
      • Accessories
      • Best Work Laptops
      • Budget Laptops
    • GNU/Linux
      • Ubuntu
    • How To
      • Virtualization
      • Windows
      • Windows How-To
    Hectic GeekHectic Geek
    Home » Fix Audio Delays Permanently Using VLC & MKVToolNix
    GNU/Linux

    Fix Audio Delays Permanently Using VLC & MKVToolNix

    GayanBy GayanJuly 8, 2022Updated:August 4, 202294 Comments4 Mins Read
    Twitter Reddit Telegram WhatsApp Email
    Share
    Twitter Reddit Telegram WhatsApp Email

    Multimedia files with ‘lip-sync’ issues are not uncommon, but they rarely happen in professional environments as they take extra precautions to avoid them. Let me show you how to fix mkvtoolnix audio delay (or VLC audio delay) on a Windows computer.

    In a previous post I wrote about how to fix some of these synchronization issues permanently using ‘Avidemux’, but since then I have received a few complaints of ‘Avidemux’ not being able to fix those issues in some cases. Even though I came across some of these problems, fortunately, I have been able to fix them (so far).

    ‘Avidemux’ can do very little if the input file itself has some issues (corrupted video frames etc.), but ‘Avidemux’ is also a bit buggy, so some of the blame goes toward it also. In any case, there are a few other tools that you can try while trying to fix a sync ‘malfunction’, and ‘MKVToolNix’ is one among them.

    An illustration :) ...
    Illustration …

    ‘MKVToolNix’ is not an encoder as you can only use it to ‘extract’ audio/video/subtitle tracks from other containers (MP4, AVI, FLV etc) and put them into the powerful and open-source MKV container. While doing so, this tool also lets you pass certain settings (sync, fps, aspect ratio …), and it is through that we can attempt to fix sync problems.

    But please be aware that the only output format it supports is MKV (and a few of its variations such as ‘MKA’ for audio’, ‘MKS’ for subtitles etc.), and unlike MP4 or AVI, MKV is not supported by a lot of commercial and strictly hardware-based multimedia players. Computer users, however, do not have to worry about it as popular players (VLC, MPC, PotPlayer, SMPlayer, KMPlayer …) support it. Enough talking, let’s do it!

    Note: Make sure you have downloaded and installed the latest builds of ‘MKVToolNix’ from here. I also recommend that you use VLC because both these utilities are available for multiple operating system platforms, so you can use this ‘guide’ in any of them.

    What we are going to do is …

    *. First, we are going to play the ‘troublesome’ file in VLC (or any other player that lets you change the sync temporarily), and we will try to identify the proper sync value.

    *. Then we will simply enter that sync value into ‘MKVToolNix’ and save it as a new MKV file so that it is saved permanently. That is it!

    Step 1:

    So open your ‘troublesome’ file in VLC, and let it play for a few seconds. Then simply press the ‘j’ key on your keyboard. This will make VLC play the audio track a bit ahead of the video. A single click only increases the value by 50 milliseconds, so unless the ‘gap’ is very small, you will have to press it a few times to see its effect.

    VLC with minus (ahead of video) audio sync value

    Anyhow, if after pressing the ‘j’ key a few times it worsens the ‘gap’, then it is an indication that you actually have to make VLC play the audio track a bit behind (delay) the video. The shortcut key for that is ‘k’. Again, to feel its effect, you might have to press it a few times. If, after doing that, it seems to shorten the ‘gap’, then it is an indication that you are on the right track. So keep doing that until you come up with the perfect sync value.

    VLC with a plus (delay) audio sync valueSo as a general rule, play with the ‘j’ and ‘k’ keys until you find the perfect sync value for that multimedia file. Once you have found it, simply take a note of it (note that depending on the file, the value could be positive or a negative one. If it is a negative/minus one, then you should enter a minus sign before entering the value in ‘MKVToolNix’, more below) and close VLC.

    Step 2:

    Now open ‘MKVToolNix’ and load the ‘troublesome’ file into it. Then under the ‘Tracks, chapters and tags’ field, select the audio stream/track (shown below is an example).

    Selecting the audio track in 'MKVToolNix'

    Step 3:

    Then from under it, click on the ‘Format specific options’ tab, and you will see an empty field that says ‘Delay (in ms)’. Now simply enter the sync value you found above into that field.

    Entering an audio sync value manually in 'MKVToolNix'
    Make sure to enter a minus sign (-) when needed (-200 for instance) …

    Step 4:

    Now click on the ‘Browse’ button under the ‘Output filename’ field. Select a location and a file name for the output MKV file. Once done, simply click on the ‘Start muxing’ button. If everything goes without any errors, try playing the newly saved MKV file, and now you should be able to enjoy it without any ‘lip-sync’ issues!

    Linux Tips Solutions Windows Tips
    Share. Twitter Reddit Telegram WhatsApp Email
    Gayan

    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.

    Related Posts

    How to Check Linux CPU Usage?

    February 5, 2024

    Linux export Command: A Comprehensive Tutorial

    February 3, 2024

    [Fixed] HDMI No Signal to TV or Monitor on Windows 10/11

    November 7, 2023

    AlmaLinux vs Ubuntu – How to Select the Best One?

    October 22, 2023

    AlmaLinux vs Rocky Linux: What you need to know

    August 24, 2023

    Pop!_OS VS Linux Mint, Which One to Select in 2023

    July 27, 2023

    94 Comments

    1. john on April 21, 2014 5:50 pm

      thank you

      Reply
      • Gayan on April 21, 2014 8:40 pm

        You’re welcome John.

        Reply
    2. seedzhao on May 11, 2014 10:22 am

      saved me from a lot of trouble. i don´t know how to repay you, my friend.

      Reply
      • Gayan on May 12, 2014 7:13 am

        It’s all on me :).

        Reply
    3. Ogre Magi on July 27, 2014 2:39 am

      Thanks it was really helpful

      Reply
      • Gayan on July 27, 2014 5:11 am

        You’re welcome.

        Reply
    4. Agostino on August 27, 2014 4:12 pm

      Tx a lot! This is exactly the answer I was looking for.

      Reply
      • Gayan on August 27, 2014 5:56 pm

        You’re welcome 🙂 .

        Reply
    5. DeathWish808 on September 22, 2014 2:45 am

      This only works if the sync is offset by a certain amount of time throughout the video. I’ve just recently played a video that was 1080P and started fine, but within 10 minutes it was lagging behind the audio (Audio would play then the lips would move a second later.) I hit K to make it match and it did after progressing it 200ms. Anyway, by the end (About 1.5 hours) it was at 3600ms. So yeah, I had to progressively step the delay of audio proportionally to the video throughout the entire movie.

      I’m no expert, by any means, but it possibly could have been due to a loss of a certain number of frames in the video. Such as every 30th frame was missing, for example.

      Anyway, thanks for the post.

      Reply
      • Gayan on September 22, 2014 7:22 am

        Hi,

        It could be due to a frame-dropping which usually occurs if the the playback hardware cannot handle it, or, it could simply be due to wrong audio ‘time-codes’. For instance, if the encoder has tried to sync an audio track with a video that has a fps of 60 (for instance), but wrongly recognized the fps as 50 and has set the audio speed to match it, then as the playback progresses, a lip-sync issue can arise and it will get worse as you play into the track, although it plays perfectly well in the beginning.

        If you can however, figure out by how much the audio speed should be delayed or speed-up, then you can use the ‘Stretch’ option in ‘MKVToolNix’ to successfully fix it (I have fixed one in the past). To not to complicate things any further, you can use the below links for learning more and hopefully for attempting to fix it …

        http://documentation.apple.com/en/cinematools/usermanual/index.html#chapter=2%26section=6

        http://www.animepassion.net/topic/1426-guide-for-time-stretching-audiotracks-in-mkvwhole-trackpartial/

        Reply
        • SUPES on August 8, 2015 3:05 pm

          But the audio plays perfectly in the original file? Although, it has no index for me. I have to rebuild it in VLC all the time, which I don’t do I just play as is. Would this be the problem? even though the original still plays fine. Once used in Mkvmerge, it goes out of sync 10 minutes in then for the rest of the file.

          Reply
          • Gayan on August 10, 2015 8:15 am

            Well, you can try the ‘Convert/Save’ feature of VLC. I’m not sure if it’ll fix the issue (since I don’t have a file with a corrupted index to test it), but once on the ‘Convert/Save’ page, add your file, again choose ‘Convert/Save’ button, and on the next page simply choose ‘Dump raw input’ and save your file.

            Reply
    6. and the beat goes on on November 7, 2014 11:30 am

      Thanks so much for this. I was having a sync problem with one of my recently converted videos and this simple guide helped me to fix it ASAP!

      Reply
      • Gayan on November 8, 2014 5:07 am

        You’re welcome 🙂 .

        Reply
    7. =D on November 20, 2014 10:05 am

      Thank you for writing this article. The software works so well, super quick (takes less than a minute) and simple.
      BUT I found that I didn’t need to enter the time delay to fix the audio sync. The program fixed the sync itself, it detected the timecodes were wrong. Ex, my audio had to be synced 1.2 secs faster (-1200ms), but the resulting video had the audio at 2.4 seconds faster than the original. After ‘muxing’ the original file a few more times with and without my inputting the time delay, I found that the software initally fixed the sync on its own, then it further applied my manual correction.

      Conclusion, just drag and drop the original file into the input file and start muxing, no need to find the time delay on your own. Thanks again for the tutorial!!

      Reply
      • Gayan on November 21, 2014 7:46 am

        Hmm, interesting… thank you Stephanie.

        Reply
    8. Tameem on December 14, 2014 5:02 am

      Thanx buddy , life saver 🙂

      Reply
      • Gayan on December 14, 2014 2:30 pm

        You’re welcome Tameem 🙂 .

        Reply
    9. John Xontic on December 19, 2014 8:03 am

      You are a god!

      Reply
      • Gayan on December 19, 2014 11:19 am

        😉

        Reply
    10. Orange Juice on December 27, 2014 11:10 pm

      Thanks a lot! You really helped me out!

      Reply
      • Gayan on December 28, 2014 6:56 am

        You’re welcome!.

        Reply
    11. Andy on January 12, 2015 7:44 am

      Hey man, thanks a ton, this was seriously helpful !
      Also I had a video which had a variable delay like for the 1st half (approx) it was -0.6 sec. & for the 2nd half (approx) it was -1.5 sec.
      Is there a way for this as MKVToolNix uniformly syncs the audio ?
      I was thinking to rather cut it [using video cutter/joiner] & then use MKVToolNix for audio sync.
      What u say man ?

      Reply
      • Gayan on January 12, 2015 7:53 am

        Hi Andy,

        I agree with you, that would be the best option…

        Reply
      • Greg Marks on June 24, 2015 6:23 am

        Several people asked about fixing variable out-of-sync audio. I believe this can be corrected with the command-line tool mkvmerge using the -y (i.e. –sync) flag. If the command “mkvmerge -i bad.mkv” reveals track 1 as video and track 2 as audio, then the command “mkvmerge -o good.mkv -y 2:B/M bad.mkv” changes the timing of the audio track relative to the video track by applying the function f(t) = Mt + B (where time t is measured in milliseconds).

        Reply
    12. Edna Crabapple on January 13, 2015 12:26 am

      You ROCK dude!!!
      I just ran into this problem with an mkv, and found your tutorial. That was the easiest video resync I have ever done!
      I’ve tried Avidemux for this, it never worked on anything other than avi.
      I’m a Linux user (Manjaro) and didn’t think it would be this easy using tools I have on my system and use all the time.
      Thanks SO much!

      Reply
      • Gayan on January 13, 2015 8:04 am

        You’re welcome!, Edna.

        Reply
    13. MOHAN on February 8, 2015 4:19 pm

      EVEN THOUGH I COULD ABLE TO CORRECT A PART OF THE VIDEO, I COULD NOT ABLE TO CORRECT THE OTHER PARTS OF THAT VIDEO. PLEASE HELP ME…

      Reply
      • Gayan on February 10, 2015 1:38 pm

        Can you be more specific?

        Reply
    14. Galane on April 24, 2015 3:41 pm

      What do I do with an MP4 video that plays perfectly on Windows 7 in any player I try but on XP in every player I’ve tried the audio starts out OK but gets progressively farther out of synch?

      The frame rate of the videos is for some reason 23.976. What’s up with that? They were digitally recorded for the web, not done on film or intended for TV broadcast. No reason to use an oddball rate like that.

      What can I do to these videos (without re-encoding) to firmly nail down the relationship between video and audio so they’ll play correctly no matter what operating system or player software is used?

      Reply
      • Gayan on April 25, 2015 8:09 am

        I’m not exactly sure what the issue is Galane. Have you tried to play these files using the K-lite codec pack in Windows XP? The fps should not change unless you’ve changed it manually…

        Reply
    15. ausaf on May 17, 2015 2:49 pm

      THANKS For your help…… it’s work perfectly………….

      Reply
      • Gayan on May 17, 2015 4:46 pm

        You’re welcome :).

        Reply
    16. jesbin on May 23, 2015 1:25 pm

      tanx dude it works…….

      Reply
      • Gayan on May 23, 2015 4:25 pm

        You’re welcome jesbin 🙂 .

        Reply
    17. Poly on May 30, 2015 12:42 am

      Thank you! This tool was exactly what I needed to solve my problem.

      Reply
      • Gayan on May 30, 2015 6:57 am

        You’re welcome Poly.

        Reply
    18. hritik on June 1, 2015 8:05 am

      Thanks bro for this help but I still have problem…
      I have a movie doenloaded in mkv format with dual audio… one of them has multiple delays… I mean.. sometimes audio comes too early.. then after 20-25 minute, the position changes.. then audio is late.. etc.. it goes on in full movie.. HELP

      Reply
      • Gayan on June 3, 2015 7:16 am

        I’m sorry hritik, I don’t know how to deal with that. It sounds like a badly encoded multimedia file… You could however, try to extract the troublesome audio out of that file and put it to a different one. Then also save the remaining audio and the video file into a new .mkv file. Then later, merge both (the one containing the audio & the with both the other audio and the video file) into a new one. I don’t think it would help, but you can try it at least…

        Reply
    19. mohammed yousuf on July 31, 2015 12:29 pm

      Thanks you are great job is done thank you so much

      Reply
      • Gayan on July 31, 2015 1:01 pm

        You’re welcome Yousuf.

        Reply
    20. Jetstor on August 29, 2015 2:03 am

      Works like a charm – thks a lot for the tutorial, Gayan!

      Reply
      • Gayan on August 29, 2015 6:45 am

        You’re welcome Jetstor 🙂 .

        Reply
    Newer Comments →
    Leave A Reply Cancel Reply

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

    Latest Posts

    Transforming Geek Culture with Advanced Software Development

    April 8, 2024

    The Role of Technology in Enhancing Digital Signage Solutions

    February 21, 2024

    How to Check Linux CPU Usage?

    February 5, 2024

    Linux export Command: A Comprehensive Tutorial

    February 3, 2024

    [Fixed] HDMI No Signal to TV or Monitor on Windows 10/11

    November 7, 2023

    AlmaLinux vs Ubuntu – How to Select the Best One?

    October 22, 2023

    Subscribe to Updates

    Get the latest news and updates from Hectic Geek. We won't overload you or sell your data!

    Contact
    • About Us
    • Contact Us
    • Privacy Policy
    • Write for Us
    X (Twitter)
    © 2026 Hectic Geek.

    Type above and press Enter to search. Press Esc to cancel.