video soundtrack time difference
Forum rules
This forum is for Audacity on Windows.
Please state which version of Windows you are using,
and the exact three-section version number of Audacity from "Help menu > About Audacity".
Audacity 1.2.x and 1.3.x are obsolete and no longer supported. If you still have those versions, please upgrade at https://www.audacityteam.org/download/.
The old forums for those versions are now closed, but you can still read the archives of the 1.2.x and 1.3.x forums.
Please state which version of Windows you are using,
and the exact three-section version number of Audacity from "Help menu > About Audacity".
Audacity 1.2.x and 1.3.x are obsolete and no longer supported. If you still have those versions, please upgrade at https://www.audacityteam.org/download/.
The old forums for those versions are now closed, but you can still read the archives of the 1.2.x and 1.3.x forums.
-
JhonDave2012
- Posts: 14
- Joined: Wed Sep 12, 2012 7:10 pm
- Operating System: Please select
video soundtrack time difference
Hi,
I recorded slides of a presentation using OBS (mkv file) - each slide recorded separately.
I then extracted the audio using audacity, mixed each track to mono and combined them as a one track, then amplified it. The total track time was about 4:19.
I then used Powerdirector to combine the slides without sound - the sound was imported as the track I had just made with audacity.
The problem is that the time shown in powerdirector is about 4.21. So there is about 2 sec difference, which causes the audio and video to be out of sync towards the end.
I thought I might have combined the tracks in audacity wrong, so I have done it 2 times, but the result is the same.
I also checked with windows file explorer the total time of the videos and it was 4:21, like what powerdirector says. I suspect it is something with Audacity, but I am not sure.
I can't seem to figure out why there is a difference and how to solve it. Any idea ?
I recorded slides of a presentation using OBS (mkv file) - each slide recorded separately.
I then extracted the audio using audacity, mixed each track to mono and combined them as a one track, then amplified it. The total track time was about 4:19.
I then used Powerdirector to combine the slides without sound - the sound was imported as the track I had just made with audacity.
The problem is that the time shown in powerdirector is about 4.21. So there is about 2 sec difference, which causes the audio and video to be out of sync towards the end.
I thought I might have combined the tracks in audacity wrong, so I have done it 2 times, but the result is the same.
I also checked with windows file explorer the total time of the videos and it was 4:21, like what powerdirector says. I suspect it is something with Audacity, but I am not sure.
I can't seem to figure out why there is a difference and how to solve it. Any idea ?
-
kozikowski
- Forum Staff
- Posts: 68902
- Joined: Thu Aug 02, 2007 5:57 pm
- Operating System: macOS 10.13 High Sierra
Re: video soundtrack time difference
You can "solve" it with Effect > Change Speed. The effect control panel has different ways to tell the error: start and stop times, percent, duration, etc. Pick the one you're comfortable with.
This isn't necessarily the error, but if you're doing work in video land, I would do all the sampling in 48000, not 44100.
44100 is the common sample rate for Audio CDs. 48000 is the common sample rate for video.
It would be a very poor editor or processor that didn't "know" how to convert between those two automatically, but still... If everything worked perfectly, you wouldn't be here.
As a fuzzy rule of thumb, any time you have independent recorders, you may have the possibility of lip-sync drift. This is the video and audio independent recorders on a movie set thing.
You can also get time errors when the computer thinks the time is five minutes, but a five minute show when played to a stopwatch in your hand is not five minutes. That's a computer internal timebase error.
That's the kind of errors you get on a 7-Eleven/Tesco computer.
See if the problem changes if you change Audacity to a 48000 sample rate.
Koz
This isn't necessarily the error, but if you're doing work in video land, I would do all the sampling in 48000, not 44100.
44100 is the common sample rate for Audio CDs. 48000 is the common sample rate for video.
It would be a very poor editor or processor that didn't "know" how to convert between those two automatically, but still... If everything worked perfectly, you wouldn't be here.
As a fuzzy rule of thumb, any time you have independent recorders, you may have the possibility of lip-sync drift. This is the video and audio independent recorders on a movie set thing.
You can also get time errors when the computer thinks the time is five minutes, but a five minute show when played to a stopwatch in your hand is not five minutes. That's a computer internal timebase error.
That's the kind of errors you get on a 7-Eleven/Tesco computer.
See if the problem changes if you change Audacity to a 48000 sample rate.
Koz
-
JhonDave2012
- Posts: 14
- Joined: Wed Sep 12, 2012 7:10 pm
- Operating System: Please select
Re: video soundtrack time difference
The audio is indeed 44.1Khz. I tried changing the Audacity project Rate to 48000 as you suggested. I have also resampled the audio to 48khz (Tracks->Resample), but the track time length stays the same. I don't think it is related to the audio being sampled at 44.Khz instead of 48000, because (48000-44100)/44100 = 0.088. That means that for every second, there should be 8.8% time difference. If you apply that to a 4 minute audio, you get a time difference of 240*0.088 of about 21 seconds, which is far from what we have (unless I miss-computed it).
I think it is something with audacity opening mkv file. I experimented by importing these videos to Powerdirector, merged them and produced it into mp4 file. Then I imported it to Audacity. Then Audacity shows the time length is 4 minutes and 21 seconds.
This can also happen if for some reason audacity removes few ms of each imported track, so if you merge those video's soundtrack in audacity, you can get to such a time difference. I will try to experiment with it more to get a better idea.
I think it is something with audacity opening mkv file. I experimented by importing these videos to Powerdirector, merged them and produced it into mp4 file. Then I imported it to Audacity. Then Audacity shows the time length is 4 minutes and 21 seconds.
This can also happen if for some reason audacity removes few ms of each imported track, so if you merge those video's soundtrack in audacity, you can get to such a time difference. I will try to experiment with it more to get a better idea.
-
JhonDave2012
- Posts: 14
- Joined: Wed Sep 12, 2012 7:10 pm
- Operating System: Please select
Re: video soundtrack time difference
According to my findings, the problem is with Audacity importing mkv files.
The experiment I did:
1. Went to https://sample-videos.com/
2. I downloaded an mkv video of 30mb size and mp4 video of 30mb size.
3. I opened them with Reaper and Audacity. These are the lengths:
Length of Mkv file in Reaper: 05.11.200 (5m,11s,200ms)
Length of Mkv file in Audacity: 5m,13s, 472ms
There is a significant difference.
Length of Mp4 file in Reaper: 06.08.200 (6m,8s,200ms)
Length of Mp4 file in Audacity: 6m,8s, 192ms
Seems almost identical.
Could be that related to FFmpeg library Audacity uses ?
The experiment I did:
1. Went to https://sample-videos.com/
2. I downloaded an mkv video of 30mb size and mp4 video of 30mb size.
3. I opened them with Reaper and Audacity. These are the lengths:
Length of Mkv file in Reaper: 05.11.200 (5m,11s,200ms)
Length of Mkv file in Audacity: 5m,13s, 472ms
There is a significant difference.
Length of Mp4 file in Reaper: 06.08.200 (6m,8s,200ms)
Length of Mp4 file in Audacity: 6m,8s, 192ms
Seems almost identical.
Could be that related to FFmpeg library Audacity uses ?
Re: video soundtrack time difference
I guess the MKV file was this one: https://sample-videos.com/video123/mkv/ ... p_30mb.mkvJhonDave2012 wrote: ↑Thu Jun 27, 2019 9:19 am2. I downloaded an mkv video of 30mb size and mp4 video of 30mb size.
The length of the audio in that file is 5m,13s, 472ms, but that is longer than the length of the video!
Reaper (along with VLC and MediaInfo) reports the length to be about 5m 11s, which is the length of the video.
Audacity doesn't do video, so it just extracts the entire audio track.
If you compare the audio extracted by Audacity, with audio extracted by VLC (and probably Reaper too), you will find that the VLC version is missing the first 2.304 seconds of audio. Other than the first 2.304 seconds, the tracks synchronise exactly.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
-
JhonDave2012
- Posts: 14
- Joined: Wed Sep 12, 2012 7:10 pm
- Operating System: Please select
Re: video soundtrack time difference
I see. In my presentation recordings it is the opposite : the video is longer than the audio, but I guess it is the same problem you describe.
Do you think this problem might be caused by OBS (screen capturing software) ?
Any idea how can I overcome the problem when I have many small video clips that I need to combine (my real problem) with the use of audacity ?
Do you think this problem might be caused by OBS (screen capturing software) ?
Any idea how can I overcome the problem when I have many small video clips that I need to combine (my real problem) with the use of audacity ?
Re: video soundtrack time difference
No, I think it's a "feature" of the Matroska Multimedia Container format.JhonDave2012 wrote: ↑Thu Jun 27, 2019 10:13 amDo you think this problem might be caused by OBS (screen capturing software) ?
Video works in "frames", whereas audio works in "samples". (To complicate the matter, some video formats have variable frame size). Video frames are much bigger than audio samples, but edits have to be on frame boundaries. If you make a cut at exactly x.xxx seconds, then the audio can be cut very accurately at that point (accurate to +/- 0.5 sample periods, which is typically about +/- 0.00001 s), but the video stream is cut on a nearby frame boundary. While in MKV format, the format can specify an offset to ensure that the audio and video remain synchronised.
JhonDave2012 wrote: ↑Thu Jun 27, 2019 10:13 amAny idea how can I overcome the problem when I have many small video clips that I need to combine (my real problem) with the use of audacity ?
- Combine your slides into the presentation first (with the original video sound). If all of the software is well behaved, the audio and video should remain synchronised.
- Then, export the full audio track from your video software as a WAV file (48 kHz sample rate).
- Then import the WAV file into Audacity and process as required (taking care to not change the length)
- Then export from Audacity as a WAV file, and import back into your video app.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
-
JhonDave2012
- Posts: 14
- Joined: Wed Sep 12, 2012 7:10 pm
- Operating System: Please select
Re: video soundtrack time difference
Thanks steve, this could be a solution. I tried to avoid it, because then I loose the marks of the stitches between the videos (which I need), therefore it becomes harder to trace them and replace them with silence (or ambient sound).
As for my next recordings, could that be solved with some change of settings in OBS ?
As for my next recordings, could that be solved with some change of settings in OBS ?
Re: video soundtrack time difference
I've never used OBS, but I believe it allows you to remux as MP4. Perhaps that would provide a solution?
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)