PDA

View Full Version : Audio/Video barely out of sync


Trash Master
16th August 2007, 02:03
I am encoding my Superfriends DVDs I have. I am taking them to xvid. I use avisynth/vdubmod and besweet to do the conversion. This is the first time I have come across this problem. When I direct stream copy the audio to the video and save it the finished product has the audio happen just a split second before it's supposed to. Could this be an issue do to DGIndex where I did something wrong there? Thanks for the help. TM

neuron2
16th August 2007, 02:11
Did you allow for the audio delay reported by DGIndex?

Trash Master
16th August 2007, 02:13
It was 0ms. I am in the process of re-encoding the toon. I'll see if it does it again. It happened on 2 different episodes and that's why I wanted to post my question.

neuron2
16th August 2007, 02:18
You'll need to describe your entire process with full details.

Trash Master
16th August 2007, 02:31
I rip the dvd with dvddecryptor. I load all the vobs in DGIndex and run it under Honor Pulldown Flags. I get progressive/ film 99% 29.970030 fps. I load my script in vdubmod and include the audio. I then edit it how I need it and save wav and delete the audio from vdubmod. I then run the wav I created thru besweet and transcode it to mp3. I then encode the video 2-pass xvid. When all that is done I direct stream the audio to video and save the file. I have done this alot and this is the first time I noticed this issue. I am wondering if I am doing something wrong in DGIndex.

neuron2
16th August 2007, 06:03
You didn't give me the script. You haven't said what kind of audio it is in the VOB. You haven't said if you are demuxing it or decoding it in DGIndex.

Don't you do IVTC anywhere?

What do you mean by "direct stream audio to video"?

Just make a simple script like this:

vid=mpeg2source("yourvid.d2v")
aud=???source("youraud.???")
audiodub(vid,aud)

Then play that script in BSPlayer or MPC. Does it play in sync? If so, it's not a problem with DGIndex.

Trash Master
16th August 2007, 07:27
SetWorkingDir("C:\Program Files\AviSynth 2.5\plugins")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\DGDecode.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\mt_masktools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\masktools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\RemoveGrainSSE2.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\Repairsse2.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\Decomb.dll")
loadplugin("C:\Program Files\AviSynth 2.5\plugins\hqdn3d.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\Colormatrix.dll")
Import("C:\Program Files\AviSynth 2.5\Plugins\LimitedSharpenFaster.avsi")
mpeg2source("D:\TV Caps\VTS_01_1.d2v",cpu=4,cpu2="xxxxoo",info=3,idct=7)
ColorMatrix(hints=true)
AssumeTFF()
telecide(guide=1)
hqdn3d()
Lanczos4Resize(720,480)
LimitedSharpenFaster(ss_x=1.0, ss_y=1.0, Smode=3, strength=250, overshoot=0, soft=60)
==============================================


AC3 192k 0ms is the audio. I demux it in DGIndex. I use Decomb. I do the audio and video seperately. When I am done encoding the video with vdubmod I then run my audio thru besweet to convert to mp3. Then in vdubmod I load the encoded avi then add the mp3 file from " stream list " then I select Direct Stream Copy and add the audio to the video.

davidhorman
16th August 2007, 11:36
TM, I don't know if it's the same thing, but I'm sure there's some kind of built-in delay in DVDs.

I started noticing it with Star Wars. I confirmed it by using my camcorder to record the TV screen/audio. On a TV, played back through a standalone DVD player, the audio and video were in sync (the fanfare would begin at the same frame that the STAR WARS logo appeared).

When I played the same DVD on a laptop, the audio occurred somewhere between one and two frames before the logo.

I noticed the same thing on a scene change in Pirates of the Caribbean.

David

neuron2
16th August 2007, 15:16
What happens when you try the simple script as I asked in my last post?

Trash Master
16th August 2007, 15:49
I will try that here in a bit and keep you posted. Had to sleep and take care of the baby all night. bbl with an update.

Trash Master
16th August 2007, 17:43
I just opened the script in MPC and the audio is still ahead of the video.

neuron2
16th August 2007, 17:59
The only thing I can think of is that there is something fishy at the start, like a lead-in or something. Try starting the project in by some number of GOPs to skip that. Use > button and then the [ button to set the start of the project. You may get a delay in the filename so be sure to allow for it.

If you'd like to capture the timestamp dump when you have it started at the beginning, I can tell you if there is anything fishy there.

Trash Master
16th August 2007, 18:02
If worse comes to worse I can always play the dvds and use my ATI card to cap then encode the caps.

neuron2
16th August 2007, 20:19
If the audio is off by a constant amount you can just correct for that in your script. There's no need to go to your extreme.

Trash Master
16th August 2007, 20:54
It is constant. I just don't know how to correct it. The audio is coming before the video. For example. If a box hits the ground you hear it hit then maybe a half second later you see the box hit. I am brainstorming how I can edit the audio. I think if I can take the first second off I will be good.

neuron2
16th August 2007, 20:58
Use the DelayAudio() filter in your Avisynth script. Or use AC3 Delay Corrector to fix the AC3 file.


I would not consider half a second to be barely out of sync. :)

Trash Master
16th August 2007, 21:12
It's enough to drive me nuts. =D

Trash Master
16th August 2007, 21:26
Please tell me if I want to use AC3 what should this look like
audio=wavSource("D:\TV Caps\blah.wav") and do I need a .dll to use the AC3 in the script.

I can't figure it out.

neuron2
16th August 2007, 21:37
First get this:

http://nic.dnsalias.com/NicAudio.zip

Put the DLL into your Avisynth plugins directory.

Then use this script:

vid=mpeg2source("file.d2v")
aud=NicAC3Source("file.ac3",2).DelayAudio(0.500)
AudioDub(vid,aud)

That will delay the audio by 500msec. You can tweak it to get your sync right.

Trash Master
16th August 2007, 21:43
Fantastic. Thanks for the help neuron2. I'll work on it.

Trash Master
16th August 2007, 21:57
DelayAudio(1.000)

That there does the trick. If you look at my script I have above how would I incorporate this audio delay into it? I have never done audio in my scripts like this.

neuron2
16th August 2007, 22:41
SetWorkingDir("C:\Program Files\AviSynth 2.5\plugins")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\DGDecode.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\mt_masktools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\masktools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\RemoveGrainSSE2.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\Repairsse2.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\Decomb.dll")
loadplugin("C:\Program Files\AviSynth 2.5\plugins\hqdn3d.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\Colormatrix.dll")
Import("C:\Program Files\AviSynth 2.5\Plugins\LimitedSharpenFaster.avsi")
mpeg2source("D:\TV Caps\VTS_01_1.d2v",cpu=4,cpu2="xxxxoo",info=3,idct=7)
ColorMatrix(hints=true)
AssumeTFF()
telecide(guide=1)
hqdn3d()
Lanczos4Resize(720,480)
vid=LimitedSharpenFaster(ss_x=1.0, ss_y=1.0, Smode=3, strength=250, overshoot=0, soft=60)
aud=NicAC3Source("file.ac3",2).DelayAudio(1.0)
audiodub(vid,aud)

If you set Full Processing for Audio in VirtualDub, you can then set the audio compression to make MP3 and you won't need any external program.

Trash Master
16th August 2007, 23:00
neuron2 thanks a bunch for the help. I really appreciate it.