News:

--

Main Menu

Audio timing problems

Started by Catorcio63, September 03, 2019, 11:43:45 AM

Previous topic - Next topic

Catorcio63

Hello everybody.
I am a new member of the forum.
I use Avidemux since many years to edit videos and I am pretty happy with it. Thanks to the developers.

Lately I incurred in the following issues.
I have a source video (created with Avidemux), where audio and video are perfectly synchronised.
In Avidenux, relevant properties info for the audio are: codec AC3 , duration about 31m32s (about the same as the video, giving up milliseconds).
As the video is big (2.5GB), I want to rencode it (I did that many times with other videos in the past). Unfortunately, Avidemux does not allow to re-encode the audio from ac3 to MP3 (please provide for it, if possible).
So, as a workaround, I extracted the audio into an .ac3 file, using Avidemux Audio > Save audio. When I open the audio file in a player, I can see that the audio length is about 29m40s, i.e. almost one minute shorter than expected. Why? Is it possible to do anything about it?
So, as another workaround, I converted the .ac3 to .mp3 with an appropriate program, then I "strecthed" the length of the audio to 31m32s with an appropriate filter. Finally, I recomposed in Avidemux the converted video and the converted audio; despite audio and video are of the same duration, the result is out of sync (and not by a fixed time shift).
Any suggestions? Thanks in advance.

Catorcio63

I forgot to say that I experienced exectly the same issues both with Avidemux 2.6.6 and 2.7.3.

eumagga0x2a

Quote from: Catorcio63 on September 03, 2019, 11:43:45 AM
Avidenux, relevant properties info for the audio are: codec AC3 , duration about 31m32s (about the same as the video, giving up milliseconds).
As the video is big (2.5GB), I want to rencode it (I did that many times with other videos in the past). Unfortunately, Avidemux does not allow to re-encode the audio from ac3 to MP3 (please provide for it, if possible).

There should not be any problems re-encoding AC3 to mp3 given you downmix to stereo if the number of channels exceeds two. 2.6.x is legacy unsupported as is 2.7.3. The supported version is 2.7.5 (win64 VC++) and 2.7.4 (all other platforms) or the latest nightly.

eumagga0x2a

Quote from: Catorcio63 on September 03, 2019, 11:43:45 AM
So, as a workaround, I extracted the audio into an .ac3 file, using Avidemux Audio > Save audio. When I open the audio file in a player, I can see that the audio length is about 29m40s, i.e. almost one minute shorter than expected. Why? Is it possible to do anything about it?

Duration of raw audio streams is a guesstimate at best.

QuoteSo, as another workaround, I converted the .ac3 to .mp3 with an appropriate program, then I "strecthed" the length of the audio to 31m32s with an appropriate filter. Finally, I recomposed in Avidemux the converted video and the converted audio; despite audio and video are of the same duration, the result is out of sync (and not by a fixed time shift).
Any suggestions? Thanks in advance.

Already the first workaround was for sure unfounded and unnecessary. The second was misinterpretation of the results of the first one. There is no use to continue down the faulty chain, we need to find out why re-encoding AC3 to MP3 failed (likely because the number of channels was greater than two).

Catorcio63

You are right eumagga0x2a, it was just a matter of using an audio filter to remix the audio as stereo (the original audio was multichannel). I overlooked that. The video and audio of the resulting encoded video are perfectly synchronised now.

However, please note that even by just extracting the audio from the original video (which results in an audio almost 1 minute shorter) and then reimporting that same audio file without any further processing, the audio is still almost 1 minute shorter and video-audio synch are lost (of course).
On the other hand, extracting the MP3 audio from the encoded video gives an audio of the right length.
So, there must be something wrong in extracting an ac3 audio.

The workarounds that I tried to use still seem logical to me, and just for the sake of better understanding, I would be glad to know what was wrong with them.

I have another different issue, that I will open in a new post.

In any case, many thanks eumagga0x2a!

eumagga0x2a

Was the number of channels in the AC3 stream constant throughout the video?

Catorcio63

Yes, 6 channels (the original video was the result of editing with Avidemux scenes recorded with a camcorder).

eumagga0x2a

I would need to experiment with my own samples and depending on the results I might need a sample from your camcorder long enough to be able to reproduce the loss of sync. I have neither time nor equipment at the moment, will try to do it later once conditions improve.

Catorcio63

No problem eumagga0x2a, use my email address to contact me, in case.

Kind regards.  :)

eumagga0x2a

I was already able to spot some problems with external ac3 files, a sample is not needed, thanks.