Avidemux Forum

Avidemux => Main version 2.6 => Topic started by: blipton on February 15, 2014, 05:02:15 PM

Title: FEATURE REQUEST: Mux Video with an imported Audio track file
Post by: blipton on February 15, 2014, 05:02:15 PM
I know virtualdub/nandub can do it, but it doesn't support mkv files...

Just looking to use the audio from an external file rather than the video file being operated on!
Title: Re: FEATURE REQUEST: Mux Video with an imported Audio track file
Post by: mean on February 15, 2014, 05:09:17 PM
look better ?
Title: Re: FEATURE REQUEST: Mux Video with an imported Audio track file
Post by: AQUAR on February 16, 2014, 01:42:31 AM
Look better = That feature is available if you are willing to look for it.

Sorry mean for clarifying the reply a bit.
It's just that on first read I momentarily thought you had made a change to the GUI.
Title: Re: FEATURE REQUEST: Mux Video with an imported Audio track file
Post by: FeRD_NYC on February 17, 2014, 05:38:02 AM
I'll even be a mensch and drop a major hint:

There's a menu item labeled "Audio > Select Track", soooo...  ::)
Title: Re: FEATURE REQUEST: Mux Video with an imported Audio track file
Post by: blipton on February 18, 2014, 05:17:19 AM
Shortly after posting, I saw it and went to delete my post, but 'mean' had already responded   :-[

But.. unfortunately I can't get it to work right.   I have an MKV file that has an aac audio file that I'm trying to replace the audio with  (shifted by 11000 ms).  The audio track I'd like to use is ogg file. 

I'm doing a straight video copy and  audio copy + shift... however the resulting output file has the new audio but it not shifted.   The preview plays fine and is sync'd correctly.

I don't know if it's because I'm trying to use a differently encoded audio file (I've tried with .ogg and mp3) or if it's because shifting by 11 seconds is making the audio too short for the length of the video. 

Any ideas?
Title: Re: FEATURE REQUEST: Mux Video with an imported Audio track file
Post by: AQUAR on February 18, 2014, 10:45:22 AM
I think you need to recode either audio or video so that the delay gets "muxed in".

Not really to sure why, and maybe someone can give a quick explanation.

My guess is that in copy mode, the external audio and video source are just 2 independent streams, so the delay is un referenced wrt container time stamps in the source and ignored.

Fastest would be to recode the audio and copy the video as that would rebuild these time stamps to include the delay.

Could also try a container where audio video sync doesn't rely on time stamps.
Try muxing into avi (bad if video is compressed with .h264 -ie avc).
Here the plain copy plus audio delay should work (in theory).
Title: Re: FEATURE REQUEST: Mux Video with an imported Audio track file
Post by: blipton on February 19, 2014, 05:13:55 AM
Thanks, forcing a re-encoding of the audio caused the shift to take! 

It is going take however, some fine tuning, because even though the beginning looks sync'd, after 2 hours it is MAJORLY out of sync!   
Title: Re: FEATURE REQUEST: Mux Video with an imported Audio track file
Post by: AQUAR on February 19, 2014, 05:31:42 AM
Drifting out of sync is pretty common with these operations.
If the audio gets delayed or advanced in a progressively increasing manner you need to stretch or squeeze the audio.
Avidemux can't do that AFAIK.

Have you tried copy plus copy into avi?
The audio video interleaving approach might give you a different result. 
Title: Re: FEATURE REQUEST: Mux Video with an imported Audio track file
Post by: zakk on February 19, 2014, 08:11:54 AM
Quote from: blipton on February 19, 2014, 05:13:55 AMIt is going take however, some fine tuning, because even though the beginning looks sync'd, after 2 hours it is MAJORLY out of sync!
Make sure you are encoding with the same frequency 44kHz vs 48kHz
Title: Re: FEATURE REQUEST: Mux Video with an imported Audio track file
Post by: AQUAR on February 19, 2014, 09:25:59 AM
It could also be a case where the time base of the external audio is a little bit out from the time base of the media file.
Resampling the audio won't correct for that, but a slight frame rate change on the video stream would let you close in on that difference.