Audio glitch on playback and encoding MPEG Video with MP2 audio

Started by Andrew Wood, September 09, 2020, 04:33:52 PM

Previous topic - Next topic

Andrew Wood

Please bear with me as I'm only a hobbyist rather than an expert...

I edit a lot of video clips from broadcast TV in the UK. When editing MPEG videos with Layer 2 audio, I frequently get an audio glitch when playing back and encoding in AVIDemux. These glitches are not present - or at least not audible - when the original files are played in a media player.

For example - this is the main file I want to edit: https://theident.gallery/misc/misc/BBC1-CI.mpg

Play the video back in a media player and it's fine, yet load the same file into AVIDemux and play it and there's a distinct audio glitch between 2 and 3 seconds in. (I've found with other files the glitch can be upto 10 seconds into the playback.)

If I select Audio > Copy and then save the audio track - the result is this: https://theident.gallery/misc/misc/BBC1-CI.mp2 - and the glitch isn't there.

If I select Audio > AAC (either) then save the audio track - the result is: https://theident.gallery/misc/misc/BBC1-CI.aac - with the glitch there again.

Encoding the video and I get the glitch.

Cutting the video at random points gets random results. Sometimes it's there, other times it's not. But it's never there if I save the audio track in copy mode.

Consequently, I'm having to cut the video, save the audio in copy mode, use Audacity to render the audio as a PCM .wav file, set the audio track in AVIDemux to the new .wav, all before the final encode of the video.


Any suggestions as to what may be causing this?

I'm currently using v2.7.4, though I have seen this in all previous versions I've used.

I'm using VideoRedo to do initial edits of much larger files and again have seen this through many versions.

If I use the files without doing the initial edits - ie the files created by DVBDream - it still happens.



Thank you for your time.

eumagga0x2a

Yes, in this case there is a very short silence (~50 ms) inserted to sync audio with video once the audio packet buffer is refilled and we are able to compare for the first time the timing we got from decoding with the timestamp coming from the container. Re-importing audio as external track removes all timestamps we can compare with, so no glitches because there are no clues where the sync should be.

I can only recommend always to start saving MPEG-TS and -PS about 5 seconds prior to the beginning of the actual program.

Quote from: Andrew Wood on September 09, 2020, 04:33:52 PMI'm currently using v2.7.4,

You really should update to the latest 2.7.7 nightly. There've been tons of fixes and enhancements since then (just not for this problem with MPEG-TS and MPEG-PS).

Andrew Wood

Thank you for your reply - it's helped.

I've now experimented and have seen that as long as I don't cut on a B-frame, the audio is fine. It's not something that occurred to me to check - having just thought it was random.

Thanks again.

eumagga0x2a

This is not related to frame type (of course, one should always start a cut at a keyframe when in copy mode).