Does merging multiple videos into one keep audio delays relative to video?

Started by CluelessIdiot, November 21, 2023, 07:28:53 PM

Previous topic - Next topic

CluelessIdiot

You cannot view this attachment.

Hello,

I have multiple mkv videos with the same video and audio codecs and settings (variable frame rate) except that some videos have some audio delay relative to the video when opened with Mediainfo.

I'm wondering if I merge these videos into one using Avidemux without re-encoding anything if the merged video will also have the delays for the start of each video or if it will be the same setting as the first video for the rest of the playback or something else.

Elstar`

Quote from: CluelessIdiot on November 21, 2023, 07:28:53 PMI have multiple mkv videos with the same video and audio codecs and settings (variable frame rate) except that some videos have some audio delay relative to the video when opened with Mediainfo.

You'd better do A/V sync separately for each video (it's "shift" in audio output), and save them in MP4 container, then merge those MP4s.

sark

@Cluelessidiot

The delay should remain, only for the section of output corrosponding to that appended clip.

@Elstar

It appears that (in the latest 02.11.23 Windows zipped nightly) the audio shift option is not working. You need to adjust via the audio filters dialogue.

eumagga0x2a

@sark:

Audio shift not working in the preview window or after muxing into MP4? If the latter, does it still work for MKV?

sark

Quote from: eumagga0x2a on November 24, 2023, 05:20:57 PM@sark:

Audio shift not working in the preview window or after muxing into MP4? If the latter, does it still work for MKV?

MP4 and MKV not working after export in copy mode, or if encoded.

MKV output for 0ms and 1000ms shift do hash differently (even in copy mode), but appear the same in Media Info.

All works fine via audio filters when right and left channels (stereo) adjusted.

CluelessIdiot

Quote from: sark on November 24, 2023, 11:16:45 AM@Cluelessidiot

The delay should remain, only for the section of output corrosponding to that appended clip.

@Elstar

It appears that (in the latest 02.11.23 Windows zipped nightly) the audio shift option is not working. You need to adjust via the audio filters dialogue.

That's good to know because that means I don't need to re-encode the audio and degrade the quality. But in case I needed to re-encode the audio for some reason for example to resample it or change the codec, is it required to manually shift the audio (open Mediainfo, check the delay, and then apply it in Avidemux) or does Avidemux automatically do it for me like ffmpeg? Because I noticed that after re-encoding the audio with Avidemux the delay relative to video in Mediainfo disappears whether I manually shift the audio or not. But if I use ffmpeg (for %i in (*.mkv) do ffmpeg -i "%i" -c:a aac -ar 48000 -b:a 128k -ac 2 -c:v copy "%~ni converted%~xi") the delay remain in MediaInfo.

eumagga0x2a

Quote from: sark on November 24, 2023, 07:21:23 PMMP4 and MKV not working after export in copy mode, or if encoded.

Just tried audio shift in copy mode with the MP4 muxer using my own build, works fine for me. Current mpv doesn't like resulting MP4 file with positive shift (audio delayed relative to video). ffplay doesn't have any issues with the same file.

sark

@eumagga

Just to clarify. You're referring to version avidemux_r231102_win64qt5_15.zip.
I tested shift in copy mode (mp4). 0ms output, and 1000ms output had identical hashes.... Will investigate further, may be OS, or system specific.

@Cluelessidiot

When you delay in copy mode the audio remains unchanged. It is just delayed. When you encode this in Avidemux, the silent delay at the start is converted to silent audio, and the end of the audio is trimmed to match the length of the video. Hence, Media Info does not display it as a delay, as the audio now matches the video.

CluelessIdiot

Quote from: sark on November 24, 2023, 11:48:15 PM@eumagga

Just to clarify. You're referring to version avidemux_r231102_win64qt5_15.zip.
I tested shift in copy mode (mp4). 0ms output, and 1000ms output had identical hashes.... Will investigate further, may be OS, or system specific.

@Cluelessidiot

When you delay in copy mode the audio remains unchanged. It is just delayed. When you encode this in Avidemux, the silent delay at the start is converted to silent audio, and the end of the audio is trimmed to match the length of the video. Hence, Media Info does not display it as a delay, as the audio now matches the video.

Copy mode doesn't give me the option to change anything anyway but what I want to know is if I should delay the audio myself when re-encoding with Avidemux or if Avidemux will check if there's any delay and automatically convert and trim it as you said. Because if it does that on its own and I shift the audio then I would be just adding useless delay

sark

Quote from: CluelessIdiot on November 25, 2023, 01:11:37 AMwhat I want to know is if I should delay the audio myself when re-encoding with Avidemux or if Avidemux will check if there's any delay and automatically convert and trim it as you said.

Yes, Avidemux recognises the delay and retains the delay when encoding. No need for you to repeat the shift setting.

Regarding shift in copy mode. There is a box below the Audio output options (left hand main panel). For me right now this is not working. Not relevent to your needs though.

CluelessIdiot

Quote from: sark on November 25, 2023, 09:56:56 AM
Quote from: CluelessIdiot on November 25, 2023, 01:11:37 AMwhat I want to know is if I should delay the audio myself when re-encoding with Avidemux or if Avidemux will check if there's any delay and automatically convert and trim it as you said.

Yes, Avidemux recognises the delay and retains the delay when encoding. No need for you to repeat the shift setting.

Regarding shift in copy mode. There is a box below the Audio output options (left hand main panel). For me right now this is not working. Not relevent to your needs though.


Thanks for the clarification

sark

@eumagga

Have now solved my issue with shift. My dumb mistake. :-[
I removed the latest version and installed an old version I recalled it working on way back. When I installed this older version it defaulted to light theme. Immediatately I noticed the check box to the left of shift. On my setup in dark theme this had barely been noticable, and I had not been checking the box. Forgot you needed to do this.
A combination of dark theme, my need for new glasses, and probably working too late at night.