Ho to correct an MP4 video whose audio gets progressively out of sync

Started by WTWASP, February 22, 2019, 07:26:46 PM

Previous topic - Next topic

WTWASP

I have 2 MP4 video files of the same movie.

One is a lower-quality-but-not-bad video, which I could live with, except it exhibits a bad "pixelation" problem at one point (this is not a mere disturbance during playback, it is "encoded" into the file).

The other MP4 file has higher quality video, no pixelations (at the same point in the movie), however, the audio is screwed - not only is it lower volume (which I can fix easily), it is badly out of sync (this is where I am having troubles).

I extracted the audio from both videos and found they're of the exact same length, save for a very small difference of less than 100ms.

So the audio is not the problem (other than volume) - it's the video.

Somehow, the better-quality video is playing a little faster so that the audio progressively falls behind and out of sync, and it happens as early as within the first 10 minutes, and gets worse as the video progresses.

By this I mean, by about the 11-minute mark, the audio is clearly behind by about a second, but as the video plays, the audio falls more and more behind til its behind by approximately 3 secs (at around the 50-min point of the movie) and has fallen even further behind by about 7 seconds by the end of the video.

The total time of the film is 1h:28m:32s.
However, loading the video containing the better-quality-but-screwy-FPS into Avidemux does not "read" it as 1:28:32 ;  it shows as 1:28:25, (there's that ultimate offset of 7 seconds), and this results in the end-credits music being "cut off" because the audio is "longer" than the video.

The perfectly-synched video of lower video quality (and with that pixelation spot) does not exhibit this problem or any other issue with audio on playback sync. It's perfect, start-to-finish.

As you may have guessed, this is not a simple matter of the audio being shifted, as I tried the "Shift Audio" tool first, and at first. I thought it worked when the 11-minute problem was properly synched (though I think it may have caused the audio before that point to be a fraction of a second faster than the video between 0:00:00 and 0:11:00), and then I noticed the problem persisted later in the film, albeit with not as much of a delay.

This is how I deduced it is a "progressive" de-synching of the audio from the video.

The video file's framerate says an even 24fps.

I have tried all the other Avidemux editing tools to adjust the FPS to make the video play "slower", but it still fails to sync up properly and the de-sync is still present as the film progresses.

What can be done?

My guess as to how this came to be is that since it was an MP4 which I downloaded from the internet, it was possibly deliberately edited (by whomever uploaded it) to mess it up a little and discourage "pirating"?

That said, if it can be edited/modified to be de-synched, then surely there must be a way to reverse the process and correct everything?

Does anyone have any ideas or insight as to what that might be?
I still run Windows XP (for a myriad of reasons I need not justify or explain), so any software or tools other than Avidemux must be compliant to my OS. I am hoping Avidemux has the right tool and I simply do not recognize it, as I am still relatively new to video editing and its technical "geek speek" terminology.

Thanks.

~ W




eumagga0x2a

Quote from: WTWASP on February 22, 2019, 07:26:46 PM
The video file's framerate says an even 24fps.

Most likely it should be  24000/1001 ≈ 23,976 fps.

QuoteI have tried all the other Avidemux editing tools to adjust the FPS to make the video play "slower", but it still fails to sync up properly and the de-sync is still present as the film progresses.

Does the above mean that you tried to re-encode the video with the "Change FPS" filter added? Please note that the GUI of this filter is not refined enough for the task, but you can add it (after loading the video and setting video codec to something different than "Copy", e.g. to x264) from the script with content

adm = Avidemux()
adm.addVideoFilter("changeFps", "oldMode=0", "oldFpsDen=1000", "oldFpsNum=24000", "newMode=0", "newFpsDen=1001", "newFpsNum=24000")


Save it as a text file with .py extension and load it from "File" --> "Project script" --> "Run project" (or so).

QuoteMy guess as to how this came to be is that since it was an MP4 which I downloaded from the internet, it was possibly deliberately edited (by whomever uploaded it) to mess it up a little and discourage "pirating"?

Most likely just output of a very old Avidemux version or simply incompetend editing :-D

QuoteThat said, if it can be edited/modified to be de-synched, then surely there must be a way to reverse the process and correct everything?

Not necessarily, but it might be possible to reduce desync. However, this requires the video to be re-encoded, losing quality.

QuoteI still run Windows XP

You should use 32bit builds off the legacy-compat branch then --> https://avidemux.org/nightly/win32/

dosdan

Quote from: eumagga0x2a on February 22, 2019, 11:42:11 PM
Quote from: WTWASP on February 22, 2019, 07:26:46 PM
The video file's framerate says an even 24fps.

Most likely it should be  24000/1001 ≈ 23,976 fps.


Seems like it:
1 - (24/23.976) = -.001

-7s/1:28:32  = -.0012

Dan.