Log in

View Full Version : Help me add delay to WAV -> AC3 encoding


Blue_MiSfit
20th January 2009, 22:14
Hi all,

So, I've got a project at work... We get a lot of sources delivered as a video stream (usually MJPG MOV files) + elementary mono WAV files.

I have to encode the WAVs to an AC3 (using EncWAVtoAC3 usually), then encode the video, and then mux.

The problem is this: the audio is always delayed by 20 seconds from the video, because there are opening cards added by the encoding house to each movie.

So, I have to apply a 20020ms delay to the audio when encoding.

It's not a problem on the PC, but I work with a hardware SAP, and while it can handle playback with this delay, some strange things happen when the movie _starts_ playing.

Suffice it to say, it would be MUCH easier to simply add this delay into the audio stream - i.e. add 20 seconds of silence to the beginning before encoding the AC3.

Is there an easy way to do this, short of breaking out an audio editing app and doing it manually??

Thanks!!!

~MiSfit

Snowknight26
20th January 2009, 22:17
http://forum.doom9.org/showthread.php?t=125966

smok3
20th January 2009, 22:18
sox maybe?
http://www.nabble.com/Add-silence-td10686236.html

avisynth
http://avisynth.org/mediawiki/DelayAudio

Blue_MiSfit
20th January 2009, 22:21
Ok, eac3to would be nice, since we use it for everything else, but how do you feed it a list of WAVs?

~MiSfit

midnightsun
20th January 2009, 22:32
I would go the avisynth way,

V=avisource(file.avi)
A=wavsource(audio.wav)
V=audiodub(V,A).delayaudio(20020)
return(V)

open it directly with encwavtoac3 or use soundout() in your avs and export to wav.

Blue_MiSfit
20th January 2009, 22:35
Only one problem, our WAVs are all elementary mono (6 WAVs)

Does encwavtoac3 support avisynth input?

~MiSfit

midnightsun
20th January 2009, 22:57
the latest build by wisodev does
http://code.google.com/p/wavtoac3encoder/

you can load each mono wav-in-avs (or exported to wav by soundout) and mix them up appropriately using the mux wizard.

Blue_MiSfit
20th January 2009, 23:02
Interesting.

How do you mix 5.1ch in AviSynth? i.e. if I load 6 mono WAVs, how do I combine the clips into a single 5.1ch stream (so I can apply the delay and then encode the result)

~MiSfit

tebasuna51
21st January 2009, 01:48
How do you mix 5.1ch in AviSynth? i.e. if I load 6 mono WAVs, how do I combine the clips into a single 5.1ch stream (so I can apply the delay and then encode the result)

Make an avs file like this:
fl = WavSource("D:\Test\FL.wav")
fr = WavSource("D:\Test\FR.wav")
fc = WavSource("D:\Test\FC.wav")
lf = WavSource("D:\Test\LF.wav")
bl = WavSource("D:\Test\BL.wav")
br = WavSource("D:\Test\BR.wav")

Mergechannels(fl, fr, fc, lf, bl, br)

DelayAudio(20.020)

and use WavtoAc3Enc 3.0 to open the avs file.

Blue_MiSfit
21st January 2009, 21:19
wonderful! thank you!!

-Derek