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