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 20th April 2019, 19:51   #21  |  Link
Dreamject
Registered User
 
Join Date: Dec 2018
Posts: 140
>The Avisynth docs say "Video framerate is actually a ratio of two 32-bit integers". I assume there's no way 23.976 can be represented exactly as a floating point number.
It says "so for the precise number, use FrameRateNumerator and FrameRateDenominator." too...

But there is 23.976x60x60x2=172627,2 - frames in two hours
60x60x60x24/1.001=172627,37262737262737262737262737
The difference in 2 hours movie less than 1 FRAME, CARL . So there is no advantage to use clear 24000/1001, imho

Code:
# SuperSVP support vk.com/potplayerms t.me/supersvp


Try{ core=core }
catch(err){ 
fps= 45 #1..10 - 1..10X,>10 - target FPS. You can proportionally (targefps-originalfps) decrease CPU load reducing this value

Quality1= 0 Quality2=Quality1 #0-3  0-weakest, 3 - best. As I know, usually in original SVP Quality2=Quality1 , but you can control it manually
artefactremove = 0 BlockSize = 0 #artefactremove 0 - default, 50 - middle, 200 - strong. Bigger values gives less smoothing; BlockSize 0-8, 0-w32, ol0; 1-w32,ol1; 2-w32; 3-ol; 4-ol1; 5-default 16,ol2; 6-w8,ol0; 7-w8,ol1; 8-w8 . Bigger block faster and less noisy, but small have better smooth.
gpu= 1 #  0 - off | 1(11) - 1st GPU on 1st platform | 12 - 2nd GPU on 1st platform | 21 - 1st GPU on 2nd platform...
mode= 1 #1 - каждый ориг кадр используется один раз, остальное - расчётные кадры, 0 - из двух ориг кадров остаётся один, остальные расчётные (объясните, ЗАЧЕМ?! Ведь рассчётные хуже и доп нагрузка на ЦПУ), 2 - каждый ориг кадр дублируется (ЗАЧЕМ?! На выходе фейк уплавнение, нагрузка на ГПУ сильно возрастёт),  3 - по ситуации (дефолт), грузит ЦПУ примерно как 0. Я понимаю, что в сложных сценах может быть оправдан переход в 2 режим, но зачем он торчит в нулевом?!

pel= 1 # 2 is default, higher is slower. The accuracy of the motion estimation. 1 means a precision to the pixel, 2 means a precision to half a pixel, 4 - to quarter pixel (not recommended to use). But pel=1 is Okay
thsad="thsad:200"#200 default, 250 for better quality, 1000 for smooth animation, 65000 for... I do not know, but it used some time ago.
algo= "13" #13  algo for movies, 2 for animation. There is other algos, but they works bad, imho
debug=1 debugtimesec=99 #debug=0..2 0 disables messages, 1 shows message debugtimesec seconds, 2 shows them permanently

#KOSTYLI - they improve speed, may reduce quality
CoarseWidth="width:530,"#default 1050, higher is slower
weakgpu= 0 #if your GPU is overload, 1 means linear:false, 2 - cubic:0; 3 - cubic:0,linear:false . In modern version if SVP decides thay you have weak GPU, it paste only linear:false. Cubic:0 is for previous versions
SearchDistance="distance:0," #"distance:0," speeds up, but can looks good on GPU. Developers do not use it in script generator
#vectors= 3 #2 loads gpu less, but worse quality
SetMemoryMax(2700)
PPcheck=1#WIDTH
PPcheck==1? eval ("""
SetFilterMTMode("ffdshow_source",3)
ffdshow_source()
ConvertToYV12()
global threads=4 #for regular player
""") : eval ("""
global threads=round(1.83 * #CPUS) #valid only for PotPlayer. You can calculate and input numbers of CPU cores*2 manually
SetFilterMTMode("potplayer_source",3)
potplayer_source()
""")}

orignum=FrameRateNumerator
origdenom=FrameRateDenominator

super_override=""#like {scale:{up:0},gpu:1}
analyse_override=""
smoothfps_override=""


bit=GetProcessInfo()
Try{LoadPlugin(""+String(bit)+"\svpflow1.dll")
LoadPlugin(""+String(bit)+"\svpflow2.dll")}
catch(err){LoadPlugin("AviSynth\"+String(bit)+"\svpflow1.dll")
LoadPlugin("AviSynth\"+String(bit)+"\svpflow2.dll")}
#LoadPlugin("RoboCrop_x86.dll")
#LoadPlugin("C:\Program Files (x86)\SVP 4\plugins\svpflow1.dll")
#LoadPlugin("C:\Program Files (x86)\SVP 4\plugins\svpflow2.dll")
#LoadPlugin("C:\Program Files (x86)\SVP 4\plugins64\svpflow1.dll")
#LoadPlugin("C:\Program Files (x86)\SVP 4\plugins64\svpflow2.dll")
SetFilterMTMode("DEFAULT_MT_MODE",2)
SetFilterMTMode("SVSuper",1)
SetFilterMTMode("SVAnalyse",1)

denum=10000
origframerate=framerate
num=ceil(float(fps)*denum/Framerate)

fps <= 10 ? eval("""rate = "num:"+String(fps)+",den:1" """) : eval(""" rate = "num:"+String(num)+",den:"+String(denum)+",abs:false" """)

weakgpuparam= weakgpu==1? "linear:false," : weakgpu==2? "cubic:0," : weakgpu==3? "linear:false,cubic:0," : ""
gpuid = (gpu>1) ? "gpuid:"+String(gpu)+"," : ""



Quality1 == 0 ? eval("""
AnalyseMainSearchCoarse="satd:false,"
""") : Quality1 == 1 ? eval("""
AnalyseMainSearchCoarse="type:2,distance:-6,"
""") : Quality1 == 2 ? eval("""
AnalyseMainSearchCoarse="distance:-8,"
""") : Quality1 == -1 ? eval("""
AnalyseMainSearchCoarse="distance:-8,"#okay...
super_override=""#like {scale:{up:0},pel:1,gpu:1}
analyse_override="{block:{w:32,overlap:0},main:{search:{type:2,distance:0,coarse:{width:530,type:2,distance:-1,satd:false,bad:{range:0}}},refine:[{thsad:200,search:{type:2,distance:0}}]}}}"
smoothfps_override=""
""") : Quality1 == -2 ? eval("""
AnalyseMainSearchCoarse="distance:-8,"#okay...
super_override="{scale:{up:0,down:2},gpu:1,pel:1,full:false}"#like {scale:{up:0},gpu:1}
analyse_override="{block:{w:32,overlap:0},main:{search:{type:2,distance:0,coarse:{width:530,type:2,distance:-1,satd:false,bad:{range:0}}},refine:[{thsad:0,search:{type:2,distance:0}}]}}}"
smoothfps_override=""
""") : eval ("""
AnalyseMainSearchCoarse="distance:-12,"
""")

AnalyseMainQuality2=""

Quality2 == 0 ? eval("""
AnalyseMainQuality2="range:0"
""") : Quality2 == 1 ? eval("""
""") : Quality2 == 2 ? eval("""
AnalyseMainQuality2="sad:2000,range:24"
""") : eval ("""
AnalyseMainQuality2="sad:2000"
""")

pel < 2 ? eval("""
pelparams="pel:1,full:false"
""") : eval("""
pelparams="pel:"+String(pel)+""
""")
AnalyseBlock = BlockSize==0 ? "block:{w:32,overlap:0}," : BlockSize==1 ? "block:{w:32,overlap:1}," : BlockSize==2 ? "block:{w:32}," : BlockSize==3 ? "block:{overlap:0}," : BlockSize==4 ? "block:{overlap:1}," : BlockSize==5 ? "block:{}," : BlockSize==6 ? "block:{w:8,overlap:0}," : BlockSize==7 ? "block:{w:8,overlap:1}," : BlockSize==8 ? "block:{w:8}," : "block:{}," 
gpuparams = gpu>0 ? "scale:{up:0},gpu:1" : "scale:{up:2},gpu:0"

#MultiplerW=width/DisplayW
#MultiplerH=height/DisplayH
##width*height<DisplayW*DisplayW? OverrideRes=0 : OverrideRes=1
#OverrideRes==1?eval(""" """)
#MultiplerW>MultiplerH? cropstring="width/MultiplerW,height/MultiplerH,c=0.75":cropstring=""

#RoboCrop()

global source_width = width
global source_height = height
global crop_string  = ""
global resize_string = ""#BicubicResize(1366,768,b=0,c=0.75)"
global super_params     = super_override=="" ? "{"+gpuparams+","+pelparams+"}" : super_override
#global analyse_params   = "{"+AnalyseBlock+"main:{search:{type:2,"+SearchDistance+"coarse:{"+CoarseWidth+""+AnalyseMainSearchCoarse+" bad:{"+AnalyseMainQuality2+"}}},refine:[{"+thsad+"}]}}}"
part1="{"+AnalyseBlock+"main:{search:{"+SearchDistance+"coarse:{"+CoarseWidth+""+AnalyseMainSearchCoarse+""
part2="bad:{"+AnalyseMainQuality2+"}}},refine:[{"+thsad+",search:{}}]}}}"
global analyse_params = analyse_override == "" ? ""+part1+""+part2+"" :  analyse_override
global smoothfps_params = smoothfps_override=="" ? "{"+weakgpuparam+"rate:{"+rate+"},"+gpuid+"algo:"+algo+",mask:{area:"+String(artefactremove)+"},scene:{mode:"+String(mode)+"}}" : smoothfps_override

global demo_mode=0
global stereo_type=0

########## BEGIN OF base.avs ##########
# This file is a part of SmoothVideo Project (SVP) ver.4
# This is NOT the full AVS script, all used variables are defined via
# JScript code that generates the full script text.


NewWidth = 1366
NewHeight = 768
SourceAspect = float(source_width) / float(source_height)
MyAspect = float(NewWidth) / float(NewHeight)
SourceAspect > MyAspect ? eval("""
ResizedWidth=NewWidth
ResizedHeight=round(float(source_height) * float(NewWidth) / float(source_width) / 2.0) * 2
""") : eval("""
ResizedHeight=NewHeight
ResizedWidth=round(float(source_width) * float(NewHeight) / float(source_height) / 2.0  ) * 2
""")
#resize_string="BicubicResize("+String(ResizedWidth)+","+String(ResizedHeight)+",b=0,c=0.75)"

function interpolate(clip src)
{
	input = crop_string=="" ? src : eval("src."+crop_string)
	input = resize_string=="" ? input : eval("input."+resize_string)

	#MT-MODE-1  #do not remove this line!

	super=SVSuper(input, super_params)
	vectors=SVAnalyse(super, analyse_params, src=input)
	smooth=SVSmoothFps(input, super, vectors, smoothfps_params, mt=threads, src=src)

	#MT-MODE-2  #do not remove this line!

	return demo_mode==0 ? smooth : demo(input,smooth)
}

input=last

	stereo_type==0 ? eval(""" interpolate(input)	
""") : 	stereo_type==1 ? eval("""
		lf = interpolate(input.crop(0,0,input.width/2,0))
		rf = interpolate(input.crop(input.width/2,0,0,0))
		StackHorizontal(lf, rf)
""") : 	stereo_type==2 ? Eval("""
		lf = interpolate(input.crop(0,0,0,input.height/2))
		rf = interpolate(input.crop(0,input.height/2,0,0))
		StackVertical(lf, rf)""") : input

########### END OF base.avs ###########

#override= analyse_override=="" || smoothfps_override=="" ||super_override=="" ? "" : "OVERRIDE MODE" WTF why dont works
override= analyse_override!="" ? "OVERRIDE MODE" : smoothfps_override!="" ? "OVERRIDE MODE" : super_override!="" ? "OVERRIDE MODE" : ""

SourceAspect = float(source_width) / float(source_height)
targetframerate=framerate
debugtime= debug==2? (Framecount-1) : round(float(FrameRateNumerator)*debugtimesec/FrameRateDenominator)	
debug>0? eval("""
Subtitle( \
 "SuperSVP support vk.com/potplayerms t.me/supersvp \n" + \  
 ""+String(source_width)+"x"+String(source_height)+" "+String(SourceAspect)+":1 "+String(origframerate)+"*"+String(num)+"/"+String(denum)+"="+String(targetframerate)+"("+String(fps)+") "+override+"\n" + \  
 "Quality1="+String(Quality1)+"/3,Quality2="+String(Quality2)+"/3\n" + \  
 "artefactremove="+String(artefactremove)+",BlockSize="+String(BlockSize)+"/8\n" + \  
"Orignumden="+String(orignum)+"/"+String(Origdenom)+"->"+String(FrameRateNumerator)+"/"+String(FrameRateDenominator)+"/8\n" + \  
 "gpu="+String(gpu)+",mode="+String(mode)+"/3\n" + \  
 "pel="+String(pel)+"/4,threads="+String(threads)+"\n" + \  
 "weakgpu="+String(weakgpu)+"/3,CoarseWidth="+String(CoarseWidth)+",SearchDistance="+String(SearchDistance)+"\n" + \
 "debugtime="+String(debugtime)+",debugtimesec="+String(debugtimesec)+"\n" + \   
  "\n\n\n\n\n\n"  + \  
  "PPcheck:"+String(PPcheck)+"\n" + \
  ""+super_params+"\n" + \
  ""+part1+"\n"  + \
  ""+part2+"\n"  + \
  ""+smoothfps_params+"\n", \
         font="Comic Sans MS", size=40*width/1920, lsp=10, last_frame = debugtime )
""") : ("")

WriteFileStart("someinfo.txt", "analyse_params")




Prefetch(threads)
Dreamject 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 15:02.


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