FEATURE REQUEST: Mux Video with an imported Audio track file

Started by blipton, February 15, 2014, 05:02:15 PM

Previous topic - Next topic

blipton

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!

mean


AQUAR

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.

FeRD_NYC

I'll even be a mensch and drop a major hint:

There's a menu item labeled "Audio > Select Track", soooo...  ::)

blipton

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?

AQUAR

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).

blipton

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!   

AQUAR

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. 

zakk

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

AQUAR

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.