Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 24th October 2008, 18:41   #981  |  Link
Adub
Fighting spam with a fish
 
Adub's Avatar
 
Join Date: Sep 2005
Posts: 2,699
Yeah, be sure to report back with your results.
__________________
FAQs:Bond's AVC/H.264 FAQ
Site:Adubvideo
Adub is offline   Reply With Quote
Old 24th October 2008, 18:48   #982  |  Link
kemuri-_9
Compiling Encoder
 
kemuri-_9's Avatar
 
Join Date: Jan 2007
Posts: 1,348
why not just use fft3dfilter's ncpu parameter?
it has built in multithreading capabilities...
__________________
custom x264 builds & patches | F@H | My Specs
kemuri-_9 is offline   Reply With Quote
Old 24th October 2008, 19:23   #983  |  Link
Fizick
AviSynth plugger
 
Fizick's Avatar
 
Join Date: Nov 2003
Location: Russia
Posts: 2,183
kemuri-_9, it is (currently) implemented not very effectively.
__________________
My Avisynth plugins are now at http://avisynth.org.ru and mirror at http://avisynth.nl/users/fizick
I usually do not provide a technical support in private messages.
Fizick is offline   Reply With Quote
Old 24th October 2008, 19:56   #984  |  Link
kemuri-_9
Compiling Encoder
 
kemuri-_9's Avatar
 
Join Date: Jan 2007
Posts: 1,348
ah i see, well is there plans to increase the efficiency of the multithreading capability?
__________________
custom x264 builds & patches | F@H | My Specs
kemuri-_9 is offline   Reply With Quote
Old 24th October 2008, 22:49   #985  |  Link
Fizick
AviSynth plugger
 
Fizick's Avatar
 
Join Date: Nov 2003
Location: Russia
Posts: 2,183
i can ask you same question
__________________
My Avisynth plugins are now at http://avisynth.org.ru and mirror at http://avisynth.nl/users/fizick
I usually do not provide a technical support in private messages.
Fizick is offline   Reply With Quote
Old 27th October 2008, 09:30   #986  |  Link
rkalwaitis
Robert
 
Join Date: Jan 2008
Location: Stuttgart
Posts: 407
Merlin, as you can see this is with the MT filter. I averaged 5.9 fps to 5.92fps. It moved around in between those numbers.

DGDecode_mpeg2source("C:\Users\Baba-Nator\Desktop\Movies\Kung Fu Hustle\VTS_01_1.d2v",cpu=4,info=3)
ColorMatrix(hints=true)
#deinterlace
crop( 0, 72, 0, -72)

#resize
#denoise
undot()
MT("fft3dfilter(sigma=3, sigma2=5, sigma3=10, sigma4=20, plane=0, bt=3, bw=16, bh=16, ow=8, oh=8, sharpen=0.7, smin=20, smax=1000, wintype=2, kratio=1.0, measure=true, interlaced=false, degrid=1)")

without the filter

DGDecode_mpeg2source("C:\Users\Baba-Nator\Desktop\Movies\Kung Fu Hustle\VTS_01_1.d2v",cpu=4,info=3)
ColorMatrix(hints=true)
#deinterlace
crop( 0, 72, 0, -72)

#resize
#denoise
undot()
fft3dfilter(sigma=3, sigma2=5, sigma3=10, sigma4=20, plane=0, bt=3, bw=16, bh=16, ow=8, oh=8, sharpen=0.7, smin=20, smax=1000, wintype=2, kratio=1.0, measure=true, interlaced=false, degrid=1)

I averaged about 5.61fps to 5.63fps
rkalwaitis is offline   Reply With Quote
Old 27th October 2008, 09:40   #987  |  Link
rkalwaitis
Robert
 
Join Date: Jan 2008
Location: Stuttgart
Posts: 407
Fizick is there a need to undot() with the fft3dfilter?
rkalwaitis is offline   Reply With Quote
Old 28th October 2008, 19:46   #988  |  Link
Fizick
AviSynth plugger
 
Fizick's Avatar
 
Join Date: Nov 2003
Location: Russia
Posts: 2,183
rkalwaitis, probably no, but who know

But somewhat is wrong with MT for you. try to add explicit paramer for number of threads to end of MT command.
and look cpu usage in Task menager
.
__________________
My Avisynth plugins are now at http://avisynth.org.ru and mirror at http://avisynth.nl/users/fizick
I usually do not provide a technical support in private messages.
Fizick is offline   Reply With Quote
Old 29th October 2008, 18:24   #989  |  Link
rkalwaitis
Robert
 
Join Date: Jan 2008
Location: Stuttgart
Posts: 407
Fizick, how do I do that?

MT("fft3dfilter(sigma=3, sigma2=5, sigma3=10, sigma4=20, plane=0, bt=3, bw=16, bh=16, ow=8, oh=8, sharpen=0.7, smin=20, smax=1000, wintype=2, kratio=1.0, measure=true, interlaced=false, degrid=1)",2)


Like this?
rkalwaitis is offline   Reply With Quote
Old 29th October 2008, 18:26   #990  |  Link
rkalwaitis
Robert
 
Join Date: Jan 2008
Location: Stuttgart
Posts: 407
I wanted to use the FFT3dGPU filter and even though my video card is listed as a good for use, I can never get it to work

The fft3dfilter is faster for me.
rkalwaitis is offline   Reply With Quote
Old 8th November 2008, 03:04   #991  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,657
Haven't seen somewhat big gain in speed with MT to my script here.

x264 encoding with Megui, E4300 cpu

Before: 2.0 fps, 60-65% cpu usage
after: 2.14 fps, 61-70% cpu usage


Code:
SetMTMode(2,0)

AVISource("source.avi")

########## Stage 1 - Denoise clip ##########
limitedsharpenfaster(strength=80)
toon(0.7)
tweak(bright=10,sat=0.9)

 source = last
 pred = source # to get stronger denoising, put denoisers here, they will change how motion vectors are predicted
 
 backward_vec2 = pred.MVAnalyse(isb = true, delta = 2, pel = 2, overlap=4, sharp=2, idx = 1, truemotion=true)
 backward_vec1 = pred.MVAnalyse(isb = true, delta = 1, pel = 2, overlap=4, sharp=2, idx = 1, truemotion=true)
 forward_vec1 = pred.MVAnalyse(isb = false, delta = 1, pel = 2, overlap=4, sharp=2, idx = 1, truemotion=true)
 forward_vec2 = pred.MVAnalyse(isb = false, delta = 2, pel = 2, overlap=4, sharp=2, idx = 1, truemotion=true)
 
 maskp1 = mvmask(kind=1, vectors=forward_vec1, ysc=255).UtoY()
 maskp2 = mvmask(kind=1, vectors=forward_vec2).UtoY()
 maskp3 = mvmask(kind=1, vectors=backward_vec1, ysc=255).UtoY()
 maskp4 = mvmask(kind=1, vectors=backward_vec2).UtoY()
 maskf = average(maskp1, 0.25, maskp2, 0.25, maskp3, 0.25, maskp4, 0.25).spline36resize(source.width, source.height)
 
SetMTMode(5)
 smooth = pred.fft3dgpu(bw=16, bh=16, ow=8, oh=8, bt=1, sigma=4, plane=0)
SetMTMode(2)
 source2 = maskedmerge(source, smooth, maskf)
 
 source3 = source2.MVDegrain2(backward_vec1,forward_vec1,backward_vec2,forward_vec2,thSAD=400,idx=2)
 source3
 ttempsmooth(maxr=7)
 gradfun2db(1.51)
 
########## Stage 2 - DeSpot denoised clip ##########
s2 = last # pass denoised clip to Stage 2

backward_vectors = s2.MVAnalyse(isb = true, truemotion=true, delta = 1, idx = 1) # we use explicit idx for more fast processing
forward_vectors = s2.MVAnalyse(isb = false, truemotion=true, delta = 1, idx = 1)
forward_compensation = s2.MVFlow(forward_vectors, idx=1, thSCD1=500) # or use MVCompensate
backward_compensation = s2.MVFlow(backward_vectors, idx=1, thSCD1=500) # or use MVCompensate
# create interleaved 3 frames sequences
interleave(forward_compensation, s2, backward_compensation)

DeSpot(p1=12,p2=1,p1percent=10,pwidth=40,pheight=40,mthres=5,mheight=5,mwidth=7,merode=30,maxpts=0,minpts=5,\
  sign=0,show=0,seg=2,color=true,motpn=true)

filtered = selectevery(3,1) # pass filtered clip to Stage 3

########## Stage 3 - Apply scene-change-frame replacement ##########
prev = filtered.selectevery(1,-1)
next = filtered.selectevery(1,1)
filtered.SCSelect(next,prev,filtered,dfactor=2)

########## Stage 4 - protect good frames manually from wrong frame replacement from Stage 3 ##########
s3 = last

section1=s3.trim(0,3235)
section2=filtered.trim(3236,3726) # for isolation of good frames
section3=s3.trim(3727,11791)
section4=filtered.trim(11792,12167) # good frame
section5=s3.trim(12168,13116)
section6=filtered.trim(13117,13928) # good frames
section7=s3.trim(13929,0)

section1+section2+section3+section4+section5+section6+section7
lansing is offline   Reply With Quote
Old 8th November 2008, 03:17   #992  |  Link
Sagekilla
x264aholic
 
Join Date: Jul 2007
Location: New York
Posts: 1,752
If I had to give a guess, I'd say it was because your clip has very complex temporal dependencies, which isn't something that's easily multithreaded.
__________________
You can't call your encoding speed slow until you start measuring in seconds per frame.
Sagekilla is offline   Reply With Quote
Old 8th November 2008, 08:18   #993  |  Link
Fizick
AviSynth plugger
 
Fizick's Avatar
 
Join Date: Nov 2003
Location: Russia
Posts: 2,183
this script has also wrong using of idx...
__________________
My Avisynth plugins are now at http://avisynth.org.ru and mirror at http://avisynth.nl/users/fizick
I usually do not provide a technical support in private messages.
Fizick is offline   Reply With Quote
Old 8th November 2008, 19:13   #994  |  Link
Sagekilla
x264aholic
 
Join Date: Jul 2007
Location: New York
Posts: 1,752
IIRC, you need to set up a global idx and modify that inside of your MT function or something to that nature.
__________________
You can't call your encoding speed slow until you start measuring in seconds per frame.
Sagekilla is offline   Reply With Quote
Old 8th November 2008, 19:41   #995  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,657
like this?
Code:
idx1=1
idx2=2

backward_vec2 = pred.MVAnalyse(isb = true, delta = 2, pel = 2, overlap=4, sharp=2, idx = idx1, truemotion=true)

...

backward_vectors = s2.MVAnalyse(isb = true, truemotion=true, delta = 1, idx = idx2)
lansing is offline   Reply With Quote
Old 8th November 2008, 22:03   #996  |  Link
Sagekilla
x264aholic
 
Join Date: Jul 2007
Location: New York
Posts: 1,752
Sorry, ignore my last comment about global idx's. I was thinking of if you were using MT("""Function()"""). I don't think MVTools can multithread properly with SetMTMode(). I remember trying to use it but it didn't really help even on a simple script that looked like:

Code:
SetMTMode(2,0)
MPEG2Source("source.d2v")
source = last

bvec = source.MVAnalyse(isb=true, delta=1, idx=1)
fvec = source.MVAnalyse(isb=false, delta=1, idx=1)

source.MVDegrain1(bvec, fvec, idx=1)
__________________
You can't call your encoding speed slow until you start measuring in seconds per frame.
Sagekilla is offline   Reply With Quote
Old 8th November 2008, 23:58   #997  |  Link
Adub
Fighting spam with a fish
 
Adub's Avatar
 
Join Date: Sep 2005
Posts: 2,699
I use motion compensated scripts with setmtmode(2) all of the time. I am running a script as we speak with MC_Spuds with setmtmode(2). There shouldn't be any issues.
__________________
FAQs:Bond's AVC/H.264 FAQ
Site:Adubvideo
Adub is offline   Reply With Quote
Old 9th November 2008, 05:23   #998  |  Link
thetoof
Sleepy overworked fellow
 
Join Date: Feb 2008
Location: Maple syrup's homeland
Posts: 933
Or.... get MVTools2 to to prevent any idx mess up.
__________________
AnimeIVTC() - v2.00
-http://boinc.berkeley.edu/-
Let all geeks use their incredibly powerful comps for the greater good (no, no, it won't slow your filtering/encoding :p)
thetoof is offline   Reply With Quote
Old 20th November 2008, 07:37   #999  |  Link
halsboss
likes to tinker
 
Join Date: Jan 2004
Location: girt by sea
Posts: 635
bug MT/HCenc ? frame skip backward then goes forward

Looks like there might be a bug in the combination of MT with HCenc, to do with scene changes ? After a scene change, the 1st to 2nd frame "go backward" and then motion starts forward again. Very unusual and quite offputting to view.

Took me quite a while to get around to checking it out as I thought it was just my eyes... then I got jack of it and did 2 HCEnc encodes of exactly the same clip, one with MT and the other without ... and sure enough the problem is there when frame-by-frame forwarding one and then not in the other when frame-by-frame forwarding the other.

Any suggestions ?

MT code (has been chopped up a bit from a larger .avs from which I comment/uncomment options):
Code:
SetMTmode(mode=5,threads=4) # start with mode=5 forAVIsource http://forum.doom9.org/showthread.php?p=1067216#post1067216 
SetMemoryMax(256)                    
# snip
AviSource("G:\DVD\src\src.avi", audio=false) 
AssumeFPS(25) 
SetMTmode(mode=2,threads=4) # mode=2 for temporal multi-threading (interleaved frames) 

ConvertToYV12(interlaced=FALSE) # for Deblock_QED_MT2 and DeHalo_alpha 
Deblock_QED_MT2(quant1=30) 

SetMTmode(mode=2,threads=4) # mode=2 for temporal multi-threading (interleaved frames) 
ConvertToYUY2(interlaced=FALSE) # Ensure YUY2 for the rest including Convolution3D  

SetMTmode(mode=5,threads=4) # # mode=5 for safety including using MT 
Function Do_Stuff_In_MT(clip "inpclp") { 
   zMTclp=inpclp 
   zMTclp=zMTclp.Convolution3D(0, 6, 10, 6, 8, 2.8, 0)  
   zMTclp=zMTclp.spline36resize(720,zMTclp.height()) # 1st half of resize (2nd half outside this MT function !! 
   RETURN zMTclp 
} # end of function Do_Stuff_In_MT 
MT("Do_Stuff_In_MT(LAST)",threads=4,overlap=4,splitvertical=false) 
MT("spline36resize(last.width(),576).LimitedSharpenFaster(smode=4,strength=100)",threads=4,overlap=4,splitvertical=true)  
SetMTmode(mode=2,threads=4) # mode=2 for temporal multi-threading (interleaved frames) 
Converttoyv12() 
SetPlanarLegacyAlignment(True) 
Distributor() # use this when using HC and SetMTmode, per http://forum.doom9.org/showthread.php?p=1063622#post1063622
non-MT code (has been chopped up a bit from a larger .avs from which I comment/uncomment options):
Code:
AviSource("G:\DVD\src\src.avi", audio=false) 
AssumeFPS(25) 

ConvertToYV12(interlaced=FALSE) 
Deblock_QED_MT2(quant1=30) 

ConvertToYUY2(interlaced=FALSE)  
Convolution3D(0, 6, 10, 6, 8, 2.8, 0)  
LimitedSharpenFaster(smode=4, dest_x=720, dest_y=576) 

Converttoyv12() 
SetPlanarLegacyAlignment(True)

Last edited by halsboss; 20th November 2008 at 07:41. Reason: spelling
halsboss is offline   Reply With Quote
Old 20th November 2008, 08:58   #1000  |  Link
Adub
Fighting spam with a fish
 
Adub's Avatar
 
Join Date: Sep 2005
Posts: 2,699
One reason could be that you are multithreading the crap out of that script. It is usually a good idea to use either MT OR SetMTMode, not both. Also, you don't need to keep calling setmtmode(2,4).

Example:

Quote:
SetMTmode(mode=5,threads=4) # start with mode=5 forAVIsource http://forum.doom9.org/showthread.ph...16#post1067216
SetMemoryMax(256)
# snip
AviSource("G:\DVD\src\src.avi", audio=false)
AssumeFPS(25)
SetMTmode(mode=2,threads=4) # mode=2 for temporal multi-threading (interleaved frames)

ConvertToYV12(interlaced=FALSE) # for Deblock_QED_MT2 and DeHalo_alpha
Deblock_QED_MT2(quant1=30)
ConvertToYUY2(interlaced=FALSE) # Ensure YUY2 for the rest including Convolution3D

#SetMTmode(mode=5,threads=4) # # mode=5 for safety including using MT ####This should only be used if you are seeing issues with it commented, otherwise enable it.
Convolution3D(0, 6, 10, 6, 8, 2.8, 0)
Converttoyv12()
spline36resize(720,576).LimitedSharpenFaster(smode=4,strength=100)
SetPlanarLegacyAlignment(True)
Distributor() # use this when using HC and SetMTmode, per http://forum.doom9.org/showthread.ph...22#post1063622
BIG FAT DISCLAIMER: I have not tested this script at all. I do not know if it will function. I posted this edited version to give an example of my point. This will need to be fully tested and probably tweaked for full compatibility, but right now it is just provided as an example.
__________________
FAQs:Bond's AVC/H.264 FAQ
Site:Adubvideo

Last edited by Adub; 20th November 2008 at 09:02.
Adub is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 16:05.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.