Log in

View Full Version : Assembling videos and audio desync


Dark Shikari
22nd December 2007, 07:49
I'm currently working on a video project that has lots of videos assembled in the following manner:

FFMPEGSource(file,atrac=-1).fix() + FFMPEGSource(file,atrac=-1).fix()

where fix() converts sample rates, FPS, size, etc to make them all the same format, and adds transitions.

However, the audio gets slowly desynced--as if some of the videos have slightly shorter/longer audio tracks than their video track, and the error is stacking up. How can I fix this from within Avisynth?

Here's my fix() function:

function fix(clip clp, clip noise)
{
width = clp.width
height = clp.height
sw = (1024 * 1000) / width
sh = (768 * 1000) / height
scale=(sh < sw)?sh:sw
resultwidth = (((scale*width) / 1000)/4)*4
resultheight = (((scale*height) / 1000)/4)*4
borderY=(768-resultheight)/2
borderX=(1024-resultwidth)/2
return noise+clp.Deblock().BlackmanResize(resultwidth,resultheight).AddBorders(borderX,borderY,borderX,borderY).ConvertFPS(30).SSRC(44100,fast=false)
}
where "noise" is the transition clip.

check
22nd December 2007, 08:35
I think you are looking for ++

Dark Shikari
22nd December 2007, 08:40
I think you are looking for ++Wait, what's the difference?

Edit: I figure this properly deals with audio/video of different lengths? Whatever it is, it fixed it. Thanks.

check
22nd December 2007, 08:59
The functions they map to are Un/AlignedSplice. Get on IRC :p