Audio Aligns With Video In Shotcut, But Goes Out Of Sync After Export

Using a Windows 10 Operating System, in my Shotcut project I’m creating, I imported a video into the timeline. The video and audio align perfectly in the Shotcut program, but when I export it to an MP4 format, the audio and video go out of sync (I look like I’m speaking in some sort of dubbed over Japanese video).
In Shotcut, the video has the audio embedded into it (the audio is not on a different timeline track, as seen here:

Again, in Shotcut the video and audio align perfectly, then after I export the video, it’s out of sync (as can be seen here). after about 11 seconds. At about 1:20, there’s another shot of me talking about the video, but the alignment is just fine. No idea what is going on with the first segment.

1 Like

Maybe it is because your source clip is recorded in vfr(variable frame rate).

You can check it by selecting your clip, then Properties and check the frame rate:

If the frame rate of the clip is not the same as the project the audio may become out of sync.

If this is the case you need to convert your source material to the project frame rate and reimport it into your project.

In case it’s not a variable frame rate issue:

Could be the camera’s/phone’s fault or the fault of the recording software. Could be mlt’s fault as well. My impression is that video players are good at dealing with a/v delay issues (negative or non-0:00 start time?) but not video editors.

To fix this, my suggestion would be to split audio and video before importing using ffmpeg:

ffmpeg in.mp4 -an -c:v copy video.mp4
ffmpeg in.mp4 -vn audio.wav

on windows, you might have to use ffmpeg.exe and both that file and in.mp4 have to be in the same folder. Info on how to get ffmpeg see https://youtu.be/AcQD9ZRO55w

on mac os x you might have to use ./ffmpeg when it’s not globally installed and the files and executable have to be in the same directory.

Then import video and audio separately.

Video:

I would agree. That sounds exactly like the typical behavior of variable frame rates… I’d suggest the same as previous answers but adding to them with searching for the keywords, vsync async ffmpeg. These will point you in the right direction for converting your source to a constant frame rate.

Thank you all for your responses! I matched the frame rates of my imported clip with the project, and everything works! I appreciate the help you all provided me immensely. Thank you!

Unfortunately this issue goes way beyond win10 and vfr.
For FOUR hours already(!) I’ve been trying to add audio to video, but the best alignment I achieved lasted only through the first watch. Odd enough, after that first watch shotcut cuts off the beginning of the audio when I listen to it/watch the created video with sound.

I’ve tried all I could think of, but shotcut does seem to have an issue there that none of my programs in the past had, as far as I remember.

Now, without sound correctly added, sadly I cannot use it. Very disturbing for me.
If anyone has other ideas for fixing this odd behavior please let us know.

Have you updated to the just released version 18.01?

Thanks, I downloaded the new version, gonna try a new project soon, and let you know, thank you!

Has anyone found a new solution to this problem from a few years ago? I am new to shotcut and finished cutting a 4 minute music video from a variety of sources including multiple frame rates. It plays great within the app but sync drifts upon export. Is there a magic export setting or codec that I don’t know about? (I’m on windows 10) Or do I really need to reconvert my footage and overcut so that all of the frame rates are the same? Would be so thankful for any advice!

bump

This issue is resolved by using ffmpeg with vsync and async options. Variable is just that… Its variable. One time its this, the next time IT VARIES! If you are editing footage that uses these variable settings, convert to an intermediate codec, like utvideo or ffvhuff, with pcm audio and all of these issues go away.

Here is a sample from a script I use when this occurs.

ffmpeg -hide_banner -y -i INPUT.xxx -c:v utvideo -g 1 -r YOURRATE -vsync 1 -c:a pcm_s16le -ar 44100 -ac 2 -async 1 -fflags +fastseek+genpts OUTPUT.avi

This will export a lossless CONSTANT rate avi file to edit. I choose audio rate of 44100, you can choose 48000 or whatever and change ac if more channels are in the audio.

I’m having a similar issue to this, but the difference is that

  1. The audio is ahead, not the video.
  2. The video is already split from the music I’m using.

I looked to see the frame rate and it is 60 fps. I changed the music to a .wav file instead of a .mp3. I tried disabling Parallel Processing (something I do usually). And I tried to simplify the video to be less chaotic. Still nothing.

I put an example of what Shotcut shows, what it exports into, and what the timeline looks like.

The video is exporting 1920x1080 at 60fps. The video I’m using is the same and the music is .wav with a 48000 sample rate. I’m using Windows 10 and the latest version of Shotcut which is currently 18.06.02.

Example of what Shotcut shows me (excuse the lag): https://www.youtube.com/watch?v=a1Q-nbxTbNk

What it exports as: https://www.youtube.com/watch?v=S-ggMDu_330

As you can see, it gets much more desynced as it goes so that by the end it’s clearly off.
Also, if you couldn’t tell, this is from an intro to a Hardcore series on Terraria I’m doing. As a result of that and the music I ended up cramming a ton of clips into 30 seconds.

Any help would be much appreciated!

I run into this a lot as well. I don’t know if it’s because my PC isn’t fast enough or if it’s a flaw in the program itself. I use Shadowplay to record and if I set it at 60fps it tends to help. Also if you have a lot of edits/effects it’s hard to gauge if it’s in sync or not, it’s really annoying.

The work around I came up with is editing short portions of the video 30 seconds - 2 minutes at a time, exporting the small chunks to check the syncing. If it’s synced then I remove the video track which has the edits that are slowing it down and drop the synced video in it’s place, which will still have the edits, except Shotcut isn’t applying in real time, check it once more just to be sure, then move on to the next little chunk. Repeat that process and although it’s very tedious it can save you a lot of headache and frustration when you sit waiting for the video to export, only to have it finish and not be synced up correctly.

I was considering that as a solution. I’m glad to see it’s viable. I’ll give it a shot and report back on my results.

I redid the clips the way suggested and it turned out fine! (sort of). The point is, is that it’s better. I found it strange though that when I put the clips together on one track it looked out of sync for Shotcut, but when it was exported then it was fine. It’s like there’s a syncing issue in shotcut for my files.

Bangs head against desk

Oh well, it turned out fine. Thanks for the suggestion Judge.

My issue with the audio getting out of sync was caused from realtek’s audio drivers. Once I went to Realtek’s website and got the correct drivers for my motherboard, all issues of audio went away.

I tried this method, but unfortunately this didn’t seem to fix the issue.
Just to double check though, you meant this website correct? http://www.realtek.com.tw/downloads/downloadsCheck.aspx?Langid=1&PNid=14&PFid=24&Level=4&Conn=3&DownTypeID=3&GetDown=false

It’s based off of operating system, not motherboard from what I can tell.

Cool, glad it worked out. Usually I will make a lot of backups of everything just in case. I’ve accidentally screwed up a whole project because I wasn’t paying attention a couple times, so I learned my lesson. Like I said I think the issue is because Shotcut is applying effects and edits in real time. Something to look out for is when you’re playing a preview and the program hesitates for a second as it passes over an edit or effect. Usually as soon as that starts happening, I know I better start using the McGuiver method.

I actually spent 9 hours editing a 3 minute video last night. Usually I just work with 1 video and 1 audio track, but this one required 4 video tracks and one audio track, because I had to edit out teamspeak chatter and I had to crop the video to hide stuff on the player HUD for a game. So there was a lot of tiny edits and the cropping apparently puts a lot of stress on my computer. So I was having to take it even farther and editing 10 seconds at a time.

Same. it was about 8-10 seconds and still went off a little in the end. But it was suffer able.