Audio desynced after export


#1

So when im editing my video in Shotcut. The audio is perfectly synced, you can even see it on the timeline. But after exporting it, its like 1 second delayed. I dont mean like the same sound in the same clip but sound effects. Lets say you have a video of like a sea, and i would add a sound effect of birds. The sea sound would play exactly the same as it should, but the bird sounds would be delayed. Did any of you guys come across this problem and do you know how to fix it? Thanks a lot.


#2

I can confirm that desyncing issues in an exported file has happened to me numerous times before. It seems fine in Shotcut but after exporting the syncing with the audio is off. Specifically, the audio in the audio track not the audio in the video track since in these occasions of mine I was not using the audio in the video track. I wanted to report this but I have found it so difficult to retrace the steps in a bug report because they tend to happen in long projects for me so I have no idea how to describe the steps so others can reproduce it. I’ve had to do some workarounds like purposely desyncing the audio in Shotcut for it to come out right during export. This hasn’t always happened to me but it has happened several times. Hopefully, in some sort of way this can be discovered and fixed.

How long is the running time of your finished project? Also, what version of Shotcut are you using, what system are you running it with and do you have the GPU Effects option on or off?


#3

Hi, the video is almost 7 minutes, im using Shotcut version 18.06.02 on Windows and i have the GPU Effects off.


#4

I have experienced audio desync in the past, but it wasn’t because of Shotcut. For me I had to reinstall/update my Realtek audio drivers. I test all of my exports with VLC media player as I’ve had audio issues with Windows Media Player. Took me about two months to figure it out. Just type in Google “Windows 10 Audio Desync”.

https://answers.microsoft.com/en-us/windows/forum/windows_10-performance/audio-video-out-of-sync/5abc6f6a-d4ab-4320-8adf-c27041496c29


#5

Some people have reported that converting their audio/music files to 48 KHz (they are typically 44.1) has helped.


#6

For anyone who can reproduce this problem, please provide some specific information about your scenario. Particularly, I would want to know:

Source file: sampling frequency and number of channels (can be found in the properties panel)
Project: number of channels (in settings)
Export: sampling frequency and number of channels (on Audio tab of export panel)

Number of channels is relevant because when we do channel conversions, we also use a different library for sample rate conversion.

If you can provide a minimal project file and source file to reproduce the problem, I would be happy to take a look at it.


#7

@brian, if I am trying to do a project in Shotcut that is only about syncing an audio track (let’s say it’s a wav file) to a video file that has variable frame rate and I only export it as an audio track like a wav file, can the audio still be desynced when it’s exported?

Also, would it affect the sync at all if the bitrate on the audio track is variable rather than constant?


#8

I’m not sure about the exact answer to your question. But I would say:

  • You should never use variable frame rate files in Shotcut under any circumstances
  • variable bitrate is not a factor in audio synchronization

#9

Thanks for replying. :slight_smile:

There are times I’ve noticed that Shotcut does not detect a video with variable frame rate even if MediaInfo says it is variable. Is that a bug or is it normal that some will pass undetected by Shotcut?


#10

I do not think that the VFR detection in Shotuct is perfect. If you have a VFR file that Shotcut can not detect, it would be good to share the file in case someone wants to try to improve the detection.


#11

They use different heuristics because they are very different code bases. MediaInfo has a lot of its own code for demuxers and bitstreams while MLT uses FFmpeg libraries. Also, both of these tools only look at several frames at the beginning and not the whole file. Scanning the entire file every time you open it even if only to preview it in Shotcut is not acceptable.


#12

I experienced this just in version 18.10.08 when I change the fps (FramesPerSecond) value for the export from the automatically choosed one (from the source video)…
I mean… When I open (import) the first source video file, Shotcut sets the fps value to the same that this file has. For example 29.8764, and if I change this to 30.0000 then the audio desyncs in the exported file. If I leave the fps untouched, then everything is fine.
In previos versions it worked as I expected: without audio shifts.


#13

Wow, thank you, thank you x3DGime! I can confirm that I see this exact same problem after recently upgrading to 18.10.08 from 18.09.16. And I was going crazy trying to figure out why audio was getting out of sync after export, while perfectly fine during editing. FPS value did not occur to me.

I usually round my fps export setting to the nearest integer (30 fps for 1080i source, or 60 fps for 720p source, from native 29.97 and 59.94 respectively) and my audio now is often several seconds out of sync by the end of exporting a 60 minute TV program. But I never saw this problem with Shotcut 18.09.16.

If I just leave the fps at the native recorded rate in 18.10.08 then the audio is okay after export.


#14

We had to change the way export works when people change resolution and frame rate to fix some bugs, but often fixing one bug causes another. At least in the new version 18.11, we better encourage people to set a Video Mode for their project in the New Project screen. It generally works better to establish basic settings before you get started instead of asking the program to change and adapt things from a complex composition to a new target.


#15

Hmm, well this kind of breaks my work flow. I normally open a recording, if it is a 1080i recording I then choose 30FPS, if it is 720p recording I then choose 60FPS. I don’t really know what the recorded FPS is (29.97 or 59.94) until I open the recording.

And I usually process 3 or 4 recordings in a row, queuing up multiple export processing jobs in a single Shotcut session.

So, you are saying now (18.11) I have to set the export FPS rate PRIOR to opening the recording and exporting it?


#16

@DrSmith
If you are doing simple projects with that workflow, then perhaps Video Mode = Automatic works good for you.


#17

Maybe. I’ll load up 18.11 and give it a try.


#18

Sorry, I just saw that you are rounding up the FPS, which would not work for Automatic. I do not understand why you round the fps. That is hardly necessary. v18.11 will unlikely make a difference for you. Actually, I am surprised v18.09 works OK for you as it is the version that includes a big change for when you change fps in Export.


#19

Yes, I know rounding frame rate is not really necessary. It’s just a habit I got into. I do not see the point in having legacy, fractional frame rates related to analog video in my library when all of my playback is fully digital these days. Sometimes I round down to 25 fps, sometimes 30, sometimes 60.

But I suppose that it is still a (nasty) bug, no? The user should not be allowed to select a different FPS value if that causes audio to get out of sync, especially when it used to work.

I actually think I started doing it because Handbrake uses integer values in a lot of its default converters.


#20

This is very easy to find out.
In Windows:
Right click on the file, then select Properties.
explorer_2018-11-16_17-20-45
Details Tab: Then scroll down just a bit to the Video part.
explorer_2018-11-16_17-19-43