Topic: Using custom avisynth scripts with svp

Hi guys,

I use a customized version of interframe in my HTPC, and am using the latest SVP GPU dlls.

Below is my simple piece of code thats in the ffdshow video decoder avisynth section.

Import("G:\avisynth\InterFrame.avsi")

I do this as I want complete control over all entries in this avisynth file and it works great, BUT if I use the SVP tray icon, it overwrites the contents of my ffdshow avisynth script section. Can I stop it doing this? Basically I want to use the feature of SVP that allows me to stop using avisynth when seeking.

I need this as perhaps 1 out of every 5 seeks crashes mpc-hc and its really unprofessional looking when I'm playing back a movie for guests etc. So in summary

Can I use SVP tray icon, and associated features like disabling avisynth on seek, aswell as having complete control over the avisynth script that gets run?

Re: Using custom avisynth scripts with svp

mark007
You can rewrite WinScript-file (SVPmgr.ws) of creating AVS-script:

var params,AppDataSVP,avsfile:string;
    i:integer;
begin
  params:=trim(GetCmdLineParameters);
  i:=pos(' ',params);
  params:=trim(copy(params,i+1,Length(params)-i));
  i:=pos('"',params);
  params:=trim(copy(params,i+1,Length(params)-i));
  i:=pos('"',params);
  AppDataSVP:=trim(copy(params,1,i-1));
  avsfile:=AppDataSVP+'AVS\ffdshow.avs';
  DeleteFile(avsfile);
  AddLineToFile(avsfile,'Import("G:\avisynth\InterFrame.avsi")');
end.

InterFrame.avsi must be like this:

svp_scheduler=true
SetMemoryMax(1024)
svp_cache_reduce=true
svp_flow_lib="C:\Program Files (x86)\SVP\Plugins\MVTools2\libflowgpu.dll" #or sse
LoadPlugin ("C:\Program Files (x86)\SVP\Plugins\MVTools2\mvtools2.dll")
SetMTMode(3,7) # write number of threads (7 is for my Core i5)
ffdShow_source()
SetMTMode(2)

#... your fuctions

distributor()

Can you show us what is inside your InterFrame.avsi?

3 (edited by mark007 25-02-2012 16:14:59)

Re: Using custom avisynth scripts with svp

Thanks Mag, the SVPmgr.ws workaround worked perfectly, I can see my custom script is in use.

Fantastic.

Incase you're interested, my avisynth interframe modified script is as follows, I have paths through the script mainly for 1080p (Profile called medium), 720p and less (Profile called Mark), and some pieces of script to handle pal content thats going to be slowed down by reclock, I need to change its rate to 52.08333 FPS in SVP, so that reclock can slow it down by 4% and get to an even 50.0

atm this is as high quality as I can seem to get from svp, and not get frame drops. Any suggestions of course are welcome but I'm really happy so far, and looking forward to 3.1, thanks to you guys for all of the hard work. Only issue so far is getting the settings tuned right for each machine, and my current choice is to use my own custom versions of interframe so that I know what I'm setting and can use dct=5 etc.


#------------------------------------------------------------------------------#
#                                                                              #
#                         InterFrame 1.12.1 by SubJunk                         #
#                                                                              #
#     A frame interpolation script that primarily uses MVTools2 for making     #
#        accurate estimations about the content of non-existent frames         #
#      Its main use is to give videos higher framerates like newer TVs do      #
#------------------------------------------------------------------------------#


# For instructions and further information see the included InterFrame.html
# For news go to spirton.com
    realpal=true
    FlowPath="C:\Program Files (x86)\AviSynth 2.5\plugins\"
    GPU=true
    NewNum=50
    NewDen=1
    Tuning="Film"
    
    Setmemorymax(1536)
    #svp_scheduler=true
    svp_cache_reduce=true
    SetMTMode(1,16)
    Input = ffdshow_source()
    SetMTMode(2)

    (Input.Framerate == 25 && realpal == true) ? Eval("""
        Preset="Medium"
    """)  : (Input.Framerate >29 && Input.Framerate <= 30) ? Eval("""
        Preset="Medium"
    """)  : (Input.Height <= 720) ? Eval ("""
        Preset="Medium"
    """) : Eval("""
        Preset="Mark"
    """)
    
    # Create processed clip for slower presets
    Preset == "Mark" || Preset == "Placebo" || Preset == "Medium" || Preset == "Fast" || Preset == "Faster" ? Eval("""
        ProcessedSource = Input.RemoveGrain(mode=17)
    """) : Eval("""
        # Don't want ProcessedSource
    """)

    # Set variables controlled by Tuning
    BlockSize = (Tuning == "Film" || Tuning == "Animation") ? 16 : \
       (Tuning == "Weak") ? 32 : 16
    Overlap1 = (Tuning == "Animation") ? 0 : 4
    Overlap2 = (Tuning == "Animation") ? 0 : 2
    Algo = (Tuning == "Smooth") ? 23 : 13
    SadML = (Tuning == "Smooth") ? 150 : 0

    # Create super clip/s
    SuperRegular = MSuper(Input, hpad=BlockSize, vpad=BlockSize, rfilter=4)

    Preset == "Placebo" ? Eval("""
        CustomLuma   = EEDI2(Input, field=1).Spline36Resize(2*width(Input), 2*height(Input), src_left=0.25             )
        CustomChroma = EEDI2(Input, field=1).Spline36Resize(2*width(Input), 2*height(Input), src_left=0.5 , src_top=0.5)

        CustomPelClip = MergeChroma(CustomLuma, CustomChroma, 1)

        Super = MSuper(ProcessedSource, hpad=BlockSize, vpad=BlockSize, rfilter=4, pelclip=CustomPelClip)
    """) : Preset == "Medium" ? Eval("""
        Super = MSuper(ProcessedSource, hpad=BlockSize, vpad=BlockSize, rfilter=4)
    """) : Preset == "Mark" ? Eval("""
        Super = MSuper(ProcessedSource, hpad=BlockSize, vpad=BlockSize, rfilter=4)
    """) : Eval("""
        Super = MSuper(Input, hpad=BlockSize, vpad=BlockSize, rfilter=4)
    """)

    # Make interpolation vector clip
    Preset == "Ultra Fast" ? Eval("""
        backward = MAnalyse(Super, blksize=BlockSize, plevel=0, isb=true , chroma=false, lambda=1000 * BlockSize * Blocksize / 128, lsad=1600)
        forward  = MAnalyse(Super, blksize=BlockSize, plevel=0, isb=false, chroma=false, lambda=1000 * BlockSize * Blocksize / 128, lsad=1600)
    """) : Preset == "Super Fast" ? Eval("""
        backward = MAnalyse(Super, blksize=BlockSize, plevel=0, isb=true , overlap=Overlap1, lambda=1000 * BlockSize * Blocksize / 128, lsad=1600)
        forward  = MAnalyse(Super, blksize=BlockSize, plevel=0, isb=false, overlap=Overlap1, lambda=1000 * BlockSize * Blocksize / 128, lsad=1600)
    """) : Preset == "Very Fast" ? Eval("""
        backward = MAnalyse(Super, blksize=BlockSize, plevel=0, isb=true , overlap=Overlap1, lambda=1000 * BlockSize * Blocksize / 128, lsad=1600)
        forward  = MAnalyse(Super, blksize=BlockSize, plevel=0, isb=false, overlap=Overlap1, lambda=1000 * BlockSize * Blocksize / 128, lsad=1600)
        backward = MRecalculate(Super, backward, blksize=8, overlap=Overlap2)
        forward  = MRecalculate(Super, forward,  blksize=8, overlap=Overlap2)
    """) : Preset == "Faster" ? Eval("""
        backward = MAnalyse(Super, blksize=BlockSize, plevel=0, isb=true , overlap=Overlap1, search=3, pelsearch=3, lambda=1000 * BlockSize * Blocksize / 128, lsad=1600)
        forward  = MAnalyse(Super, blksize=BlockSize, plevel=0, isb=false, overlap=Overlap1, search=3, pelsearch=3, lambda=1000 * BlockSize * Blocksize / 128, lsad=1600)
        backward = MRecalculate(Super, backward, blksize=8, overlap=Overlap2, search=3)
        forward  = MRecalculate(Super, forward,  blksize=8, overlap=Overlap2, search=3)
    """) : Preset == "Fast" ? Eval("""
        backward = MAnalyse(Super, blksize=BlockSize, plevel=0, isb=true , overlap=Overlap1, search=3, pelsearch=3, lambda=1000 * BlockSize * Blocksize / 128, lsad=1600)
        forward  = MAnalyse(Super, blksize=BlockSize, plevel=0, isb=false, overlap=Overlap1, search=3, pelsearch=3, lambda=1000 * BlockSize * Blocksize / 128, lsad=1600)
        backward = MRecalculate(Super, backward, blksize=8, overlap=Overlap2, search=3)
        forward  = MRecalculate(Super, forward,  blksize=8, overlap=Overlap2, search=3)
    """) : Preset == "Medium" ? Eval("""
        backward = MAnalyse(Super, blksize=BlockSize, plevel=0, isb=true , overlap=Overlap1, search=3, pelsearch=3, lambda=1000 * BlockSize * Blocksize / 128, lsad=1600, dct=5)
        forward  = MAnalyse(Super, blksize=BlockSize, plevel=0, isb=false, overlap=Overlap1, search=3, pelsearch=3, lambda=1000 * BlockSize * Blocksize / 128, lsad=1600, dct=5)
        backward = MRecalculate(Super, backward, blksize=8, overlap=Overlap2, search=3, dct=5)
        forward  = MRecalculate(Super, forward,  blksize=8, overlap=Overlap2, search=3, dct=5)
    """) : Preset == "Mark" ? Eval("""
        backward = MAnalyse(Super, blksize=BlockSize, plevel=0, isb=true, search=3, lambda=1000 * BlockSize * Blocksize / 128, lsad=1600,dct=5,searchparam=1)
        forward  = MAnalyse(Super, blksize=BlockSize, plevel=0, isb=false, search=3, lambda=1000 * BlockSize * Blocksize / 128, lsad=1600,dct=5,searchparam=1)
        backward = MRecalculate(Super, backward, blksize=8, search=3,searchparam=1)
        forward  = MRecalculate(Super, forward,  blksize=8, search=3,searchparam=1)    
    """) : Eval("""
        backward = MAnalyse(Super, blksize=BlockSize, plevel=0, isb=true , overlap=Overlap1, search=3, pelsearch=3, lambda=1000 * BlockSize * Blocksize / 128, lsad=1600, dct=5)
        forward  = MAnalyse(Super, blksize=BlockSize, plevel=0, isb=false, overlap=Overlap1, search=3, pelsearch=3, lambda=1000 * BlockSize * Blocksize / 128, lsad=1600, dct=5)
        backward = MRecalculate(Super, backward, blksize=8, overlap=Overlap2, search=3, dct=5)
        forward  = MRecalculate(Super, forward,  blksize=8, overlap=Overlap2, search=3, dct=5)

    """)

    # Determine new framerate
    NewNum != 0 ? Eval("""
        # Use user values
    """) : Input.Framerate == 25 ? Eval("""
        NewNum = 50
        NewDen = 1
    """) : Input.Framerate == 30 ? Eval("""
        NewNum = 60
        NewDen = 1
    """) : Eval("""
        NewNum = 60000
        NewDen = 1001
    """)

    # See whether to use GPU-acceleration or not
    svp_flow_lib = GPU == true ? FlowPath+"libflowgpu.dll" : FlowPath+"libflowsse.dll"
    Finest = GPU == true ? SuperRegular : MFinest(Input, SuperRegular)

    (Input.Framerate == 50 && realpal == false) ? Eval("""
MSmoothFps(Input, SuperRegular, backward, forward, finest=Finest, num=5208333, den=100000, algo=Algo, ml=0, sadml=SadML, sadgamma=2, block=false, blend=true)

    """)  : (Input.Framerate == 25 && realpal == true) ? Eval("""
MSmoothFps(Input, SuperRegular, backward, forward, finest=Finest, num=2*Input.FramerateNumerator(), den=Input.FramerateDenominator(), algo=Algo, ml=0, sadml=SadML, sadgamma=2, block=false, blend=true)

    """)  : (Input.Framerate <= 29) ? Eval("""
MSmoothFps(Input, SuperRegular, backward, forward, finest=Finest, num=NewNum, den=NewDen, algo=Algo, ml=0, sadml=SadML, sadgamma=2, block=false, blend=true)

    """)  : (Input.Framerate >29 && Input.Framerate <= 30) ? Eval("""
MSmoothFps(Input, SuperRegular, backward, forward, finest=Finest, num=2*Input.FramerateNumerator(), den=Input.FramerateDenominator(), algo=Algo, ml=0, sadml=SadML, sadgamma=2, block=false, blend=true)

    """) : Eval ("""
MSmoothFps(Input, SuperRegular, backward, forward, finest=Finest, num=Input.FramerateNumerator(), den=Input.FramerateDenominator(), algo=Algo, ml=0, sadml=SadML, sadgamma=2, block=false, blend=true)

    """)
SetMTMode(1)
GetMTMode(false) > 0 ? distributor() : last