PDA

View Full Version : Fixed audio sync and A/R in one script


absinthe
10th September 2004, 13:49
So, I've been struggling for about a week to combine two SVCD MPG's into one movie. Both of the SVCD's themselves were fine, but whenever I would combine them together in this fashion
Movie=DirectShowSource("MY_DISC_1.MPG")+DirectShowSource("MY_DISC_2.MPG")

... the audio beginning at the point of the second CD would go slightly out of sync, just enough to be visibly annoying.

Another problem was that not only was the aspect ratio off (too tall) in the first disc, it was also too tall in the first half of the second disc and then wrong in another way (slightly too skinny) in the second half of the second disc.

Well, to make a long story short, I finally came up with this. As contorted as it seems, it actually works!! :D
## Fixing the audio offset in the second disc only
Movie1=DirectShowSource("MY_DISC_1.MPG")
Movie2=DirectShowSource("MY_DISC_2").DelayAudio(-0.3)

## Combining the two into one movie
WholeMovie=Movie1++Movie2

## Correcting the aspect ratio in two spots
FirstTrim=WholeMovie.Trim(0,159007).Crop(0,20,352,200).LanczosResize(352,174).AddBorders(0,33,0,33)
SecondTrim=WholeMovie.Trim(159008,0).Crop(0,40,352,156).LanczosResize(352,174).AddBorders(0,33,0,33)

## Final movie product
FirstTrim++SecondTrim

#### other postprocessing filters here ###

Everything actually worked. I am constantly amazed every day at the things you can do with AviSynth.

Anyone know of a way I could have done it more simply, or differently at all?

-abs

Boulder
10th September 2004, 14:04
It would have been simpler to use DVD2AVI/DGIndex on the MPEG-2 files and then processing like with two DVDs. It might have fixed the audio issue in the process, or at least would have told you the audio delay.

absinthe
10th September 2004, 21:36
Originally posted by Boulder
It would have been simpler to use DVD2AVI/DGIndex on the MPEG-2 files and then processing like with two DVDs. It might have fixed the audio issue in the process, or at least would have told you the audio delay.

Well, I did try DVD2AVIdg first, but I can never get DVD2AVI to open multiplexed SVCD/VCD MPG's. It just crashes.

If there's a standard way to do this, please point me to it. :cool: Any way to figure out audio delay, I wanna know about it ....

thx,

-abs

Boulder
10th September 2004, 22:49
You may have to use VCDGear or some other program to get proper MPEG files, there's probably some header in there which then crashes the program.

I just thought that DVD2AVI/DGIndex might show the audio delay in the audio file name as it does with DVD sources. I've never processed SVCDs with it so I don't know if it's normal for them to have a certain amount of delay.