Log in

View Full Version : Smooth Frames Per Second - Audio Resampling


Cunhambebe
3rd April 2010, 13:19
Hi there...
I'm trying to make my cell phone video (3gp - recorded at 12 (would it be 8?) frames per second) look a little better using the function SFPS (Smooth Frames Per Second). The problem is the audio that is always backwards, out of sync. Here's the script:


DirectShowSource("C:\V280310_15.28.3gp").AudioDub(DirectShowSource("C:\V280310_15.28.3gp"))
#AVS script
function smoothfps(clip source, float fps) {
fp=fps*100
backward_vec = source.MVAnalyse(isb = true, truemotion=true, pel=2, idx=1)
# we use explicit idx for more fast processing
forward_vec = source.MVAnalyse(isb = false, truemotion=true, pel=2, idx=1)
cropped = source.crop(4,4,-4,-4) # by half of block size 8
backward_vec2 = cropped.MVAnalyse(isb = true, truemotion=true, pel=2, idx=2)
forward_vec2 = cropped.MVAnalyse(isb = false, truemotion=true, pel=2, idx=2)
return source.MVFlowFps2(backward_vec,forward_vec,backward_vec2,forward_vec2,num=int(fp),den=100, idx=1,idx2=2)
}
AssumeFPS(12) #shouldn't need this but didn't work right without it
ConvertToYV12()
smoothfps(24)
Deblock()
dfttest()
aWarpSharp()
gradfun2db()
DeHalo_Alpha()
Lanczos4Resize(720,480)

There might be a lot of erros on those lines, but considering the conversion and its artifacts the outcome is not that bad at all. AS I have said the real problem is the audio itself. Does anyone have any idea how I can fix that using freeware such as AVS? I'm using VirtualDubMod in Fast Recompress mode (Save as AVI Uncompressed). Thanks in advance.

Cunhambebe
19th April 2010, 21:13
I guess it's difficult isn't it? Anyway, thanks for your help and support.

scharfis_brain
19th April 2010, 21:14
the usage of assumefps() will introduce an audio increasing offset.

Cunhambebe
25th April 2010, 13:36
Thanks for taking time to respond. You've said:
the usage of assumefps() will introduce an audio increasing offset.

But I guess it is already there, isn't it?
Thanks in advance.

Alex_ander
25th April 2010, 14:15
AssumeFPS(12) will change framerate and video duration in case it is different from the value determined by DirectShowSource. By default audio duration remains the same -> evident synch problems.
The most important thing here is to make DirectShowSource operate with the correct framerate of the source. Find it out with MediaInfo utility and set its value in DirectShowSource parameters like this: fps=12, convertfps=true. Then remove AssumeFPS() from script. Still no guarantee of perfect synching, but the worst possible thing is constant delay (easily repaired).

As for artifacts from MFlowFPS, a few chances to avoid those with such low an initial framerate. Duplicating frames instead with ChangeFPS(24) might be a lesser evil.