Author Topic: Audio out of sync  (Read 234 times)

UKenGB

  • Newbie
  • *
  • Posts: 22
Audio out of sync
« on: September 24, 2018, 04:10:51 PM »
I have several video recordings that I wish to trim and clip ads etc. I've been using ADM for this and now using 2.7.1. Mostly this works fine, but in the last batch there were several files in which the audio was 1 - 2 seconds ahead of the video - in ADM. However, if I play them from the Finder (Quick Look which uses Quicktime I believe) or in VLC, the audio is perfectly in sync with the video.

If I try and edit those files in ADM and shift the audio to bring it back into sync, when I then save it, the video may not be completely in sync when played outside ADM. So e.g. in one  I shifted the audio so it was all in sync in ADM, but when saved and played in the Finder, the first few minutes were out of sync. Then the rest was in sync. In other cases shifting the audio, saving and then opening again in ADM provided a decent file in sync which I could clip and trim and the result was all ok.

Sorry, hard to describe all the things I tried. Then I came across a recording that plays perfectly in the Finder, but in ADM, audio starts at about 2.2 secs in advance of the video, in the middle it's about 3 secs out and by the end about 3.5. So it really needed shifting AND stretching which I don't believe is possible in ADM.

Anyway, the point is, why is the audio out of sync in ADM in the first place, when it's all in sync every other way I play it?

eumagga0x2a

  • Hero Member
  • *****
  • Posts: 2201
Re: Audio out of sync
« Reply #1 on: September 24, 2018, 04:32:22 PM »
AFAIR a similar issue for MP4 (albeit not with progressive desync) was fixed post-2.7.1. Unfortunately, there were no macOS nightlies since 2018-07-02. You should try one once a fresh macOS nightly is generated and uploaded to https://avidemux.org/nightly/osx_highsierra/

eumagga0x2a

  • Hero Member
  • *****
  • Posts: 2201
Re: Audio out of sync
« Reply #2 on: September 30, 2018, 07:41:51 PM »
A fresh nightly build (180930) has been uploaded. Please try it and report back. If the problem persists, please provide a sample using a service like WeTransfer, Mega, Dropbox or Google Drive.

UKenGB

  • Newbie
  • *
  • Posts: 22
Re: Audio out of sync
« Reply #3 on: October 01, 2018, 05:23:10 PM »
Ok, I downloaded the new nightly and loaded a video. As I only found out later when I tried the same file in 2.7.1 stable, this file has perfect A/V sync, both in 2.7.1 and also The Finder and VLC. But in 180930, the audio is 3.5 seconds behind the video. So on this build it's  terrible, even with a video that 2.7.1 gets right.

Does this help figure what's wrong?

eumagga0x2a

  • Hero Member
  • *****
  • Posts: 2201
Re: Audio out of sync
« Reply #4 on: October 01, 2018, 05:50:46 PM »
So something regressed since then? Could you please provide the file as sample?

UKenGB

  • Newbie
  • *
  • Posts: 22
Re: Audio out of sync
« Reply #5 on: October 02, 2018, 04:24:20 PM »
So something regressed since then? Could you please provide the file as sample?

I've uploaded the file to my Google drive and trying to post a link here, but just get an error when I try to post. So testing with this and see if I can post without any included link.

UKenGB

  • Newbie
  • *
  • Posts: 22
Re: Audio out of sync
« Reply #6 on: October 02, 2018, 04:35:15 PM »
So something regressed since then? Could you please provide the file as sample?

See if you can grab this:-

(file URL)

It's quite large as I've uploaded the whole file. I didn't want to cut any of it in case that changed the syncing or anything else.

It may not seem like the ideal file for testing, but the above video file plays apparently perfectly in the Finder, VLC and also in 2.7.1, but is 3.5 seconds out in 180930 (audio ahead of video I think) and this is actually all quite clear to see. After all, we're not talking about just a couple of milliseconds.

It's puzzling me on several counts. First, the original problem I was asking about is not apparent on this file, but is way worse on the new nightly that should include a fix. Secondly, since downloading installing and trying 180930 and finding it worse, I instead ran 2.7.1 and that has not had the problem again. Does the 'install' place some other files elsewhere that might have got updated with the 180930 install and that makes 2.7.1 behave itself? But if so, how come 180930 is so far out?

It is of course entirely possible the files I have since been dealing with are able to be handled by 2.7.1 without the problem and I may again come across other files that show the problem. I'll just have to see as I work though the video files I have to trim. If I do find one that is ok in Finder/VLC, but out of sync in 2.7.1, I'll be sure to check that also in 180930 to hopefully provide a fuller picture of what is occurring.

If you do track down the problem, I'd be interested in knowing what it is and hopefully improve my understanding of video files generally.

eumagga0x2a

  • Hero Member
  • *****
  • Posts: 2201
Re: Audio out of sync
« Reply #7 on: October 02, 2018, 07:11:18 PM »
Thank you for the sample. The audio track gets delayed by 3,568 seconds (there is no growing desync) as the result of [demuxers/Mp4] Use movie scale as unit to fix track delay calculation which is required to get track delay calculation right in many other situations. Will try to investigate what is missing.