PDA

View Full Version : Nine seconds from nowhere


Ranguvar
23rd February 2008, 17:53
Hey, I've been having a bit of a problem :p Been working on it for a while now.

Here's my script:
Load_Stdcall_Plugin("C:\Program Files\megui\tools\yadif\yadif.dll")
MPEG2Source("C:\Current\Source.d2v")
ColorMatrix(d2v="C:\Current\Source.d2v")
Yadif(order=1)
Crop(2,0,-4,-8).Spline36Resize(1280,720)
AssumeFrameBased()
beforemv = last
backward_vectors = beforemv.MVAnalyse(isb = true, truemotion=false, delta = 1, idx = 1, pel=2, overlap=4)
forward_vectors = beforemv.MVAnalyse(isb = false, truemotion=false, delta = 1, idx = 1, pel=2, overlap=4)
forward_compensation = beforemv.MVCompensate(forward_vectors, idx=1)
backward_compensation = beforemv.MVCompensate(backward_vectors, idx=1)
interleave(forward_compensation, beforemv, backward_compensation)
fft3dfilter(sigma=1.7, bt=4, plane=4)
selectevery(3,1)

DeBlock_QED(quant1=70,quant2=90)

__film = last
__t0 = __film.trim(160, 3547)
__t1 = __film.trim(4404, 95641)
mainvideo = __t0 ++ __t1

noisypart = mainvideo.trim(32691, 33537)
denoisedparta = noisypart.fft3dfilter(sigma=6, plane=4)
denoisedpart = denoisedparta.Deblock(quant=35)

noisypart2 = mainvideo.trim(16895, 17369)
denoisedpartb = noisypart2.fft3dfilter(sigma=6, plane=4)
denoisedpart2 = denoisedpartb.Deblock(quant=35)

__t2 = mainvideo.trim(1, 16894)
__t3 = mainvideo.trim(17370, 32960)
__t4 = mainvideo.trim(33538, 94625)
return __t2 ++ denoisedpart2 ++ __t3 ++ denoisedpart ++ __t4

Yeah, I know it's super-messy. And I know I'm resizing before I should (I have to, otherwise there's a huge speed hit).

The problem is, the resulting video when previewed in AvsP or MPC is 9 seconds longer than it should be! If I instead use

Load_Stdcall_Plugin("C:\Program Files\megui\tools\yadif\yadif.dll")
MPEG2Source("C:\Current\Source.d2v")
ColorMatrix(d2v="C:\Current\Source.d2v")
Yadif(order=1)
Crop(2,0,-4,-8).Spline36Resize(1280,720)
AssumeFrameBased()
beforemv = last
backward_vectors = beforemv.MVAnalyse(isb = true, truemotion=false, delta = 1, idx = 1, pel=2, overlap=4)
forward_vectors = beforemv.MVAnalyse(isb = false, truemotion=false, delta = 1, idx = 1, pel=2, overlap=4)
forward_compensation = beforemv.MVCompensate(forward_vectors, idx=1)
backward_compensation = beforemv.MVCompensate(backward_vectors, idx=1)
interleave(forward_compensation, beforemv, backward_compensation)
fft3dfilter(sigma=1.7, bt=4, plane=4)
selectevery(3,1)

DeBlock_QED(quant1=70,quant2=90)

__film = last
__t0 = __film.trim(160, 3547)
__t1 = __film.trim(4404, 95641)
mainvideo = __t0 ++ __t1
return mainvideo

noisypart = mainvideo.trim(32691, 33537)
denoisedparta = noisypart.fft3dfilter(sigma=6, plane=4)
denoisedpart = denoisedparta.Deblock(quant=35)

noisypart2 = mainvideo.trim(16895, 17369)
denoisedpartb = noisypart2.fft3dfilter(sigma=6, plane=4)
denoisedpart2 = denoisedpartb.Deblock(quant=35)

__t2 = mainvideo.trim(1, 16894)
__t3 = mainvideo.trim(17370, 32960)
__t4 = mainvideo.trim(33538, 94625)
#return __t2 ++ denoisedpart2 ++ __t3 ++ denoisedpart ++ __t4Then it's good. Nine seconds shorter.

Frame 32960 seems to be the problem. Up until there, frames match between returning mainvideo and the full script. But at that frame, the full script changes scenes, whereas mainvideo keeps going.

I'm still working on this, but any help would be awesome.

Didée
23rd February 2008, 17:59
You swapped numbers:
noisypart = mainvideo.trim(32691, 33537)
denoisedparta = noisypart.fft3dfilter(sigma=6, plane=4)
denoisedpart = denoisedparta.Deblock(quant=35)

noisypart2 = mainvideo.trim(16895, 17369)
denoisedpartb = noisypart2.fft3dfilter(sigma=6, plane=4)
denoisedpart2 = denoisedpartb.Deblock(quant=35)

__t2 = mainvideo.trim(1, 16894)
__t3 = mainvideo.trim(17370, 32960)
__t4 = mainvideo.trim(33538, 94625)
return __t2 ++ denoisedpart2 ++ __t3 ++ denoisedpart ++ __t4

32960 !-->! 32691

Ranguvar
23rd February 2008, 21:54
*headdesks repeatedly*

Thanks. Although I feel terrible that was the problem and I didn't catch it :p I was hoping it'd be something I didn't know about the way AviSynth merged clips or something :p

Thanks!

Didée
23rd February 2008, 22:23
You're welcome. I've been at that (or similar) point often enough ... and you could bite yourself in the back when you finally find it, right when you started considering pixies or voodoo being at work. :D

Leak
24th February 2008, 12:06
You're welcome. I've been at that (or similar) point often enough ... and you could bite yourself in the back when you finally find it, right when you started considering pixies or voodoo being at work. :D
Well, it helps if you make a function out of it and call it with your frame numbers as parameters instead of hard-coding those magic numbers into your script... :)

This also makes editing/adapting it so much easier.

np: Markus Guentner - Sparks (Pop Ambient 2008)