Video

~/.config/mpv/vapoursynth/svp4tv.vpy

Rina Kawakita 2020. 1. 8. 19:01
~/.config/mpv/vapoursynth/svp4tv.vpy
# vim: set ft=python:
# This script was generated by SVP 4 Manager.
# Check https://www.svp-team.com for more details.

import vapoursynth as vs
core = vs.get_core(threads=9)

core.std.LoadPlugin("/opt/svp/plugins/libsvpflow1_vs64.so")
core.std.LoadPlugin("/opt/svp/plugins/libsvpflow2_vs64.so")

clip = video_in
clip = clip.resize.Bicubic(format=vs.YUV420P8)

crop_string  = ""
resize_string = ""
super_params     = "{pel:1,scale:{up:2},gpu:1,full:false,rc:true}"
analyse_params   = "{vectors:2,block:{w:32,overlap:0},main:{search:{coarse:{distance:-8,bad:{range:0}},distance:0}}}"
#smoothfps_params = "{rate:{num:5,den:2},algo:1,scene:{}}"
#smoothfps_params = "{rate:{num:2,den:1},algo:1,scene:{}}"
smoothfps_params = "{gupid:11,rate:{num:2,den:1},algo:1,scene:{}}"

demo_mode   = 0
stereo_type = 0

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

def interpolate(clip):
	input = clip
	if crop_string!='':
		input = eval(crop_string)
	if resize_string!='':
		input = eval(resize_string)

	super   = core.svp1.Super(input,super_params)
	vectors = core.svp1.Analyse(super["clip"],super["data"],input,analyse_params)
	smooth  = core.svp2.SmoothFps(input,super["clip"],super["data"],vectors["clip"],vectors["data"],smoothfps_params,src=clip,fps=container_fps)
	smooth  = core.std.AssumeFPS(smooth,fpsnum=smooth.fps_num,fpsden=smooth.fps_den)

	if demo_mode==1:
		return demo(input,smooth)
	else:
		return smooth

if stereo_type == 1:
	lf = interpolate(core.std.CropRel(clip,0,(int)(clip.width/2),0,0))
	rf = interpolate(core.std.CropRel(clip,(int)(clip.width/2),0,0,0))
	smooth = core.std.StackHorizontal([lf, rf])
elif stereo_type == 2:
	lf = interpolate(core.std.CropRel(clip,0,0,0,(int)(clip.height/2)))
	rf = interpolate(core.std.CropRel(clip,0,0,(int)(clip.height/2),0))
	smooth = core.std.StackVertical([lf, rf])
else:
	smooth =  interpolate(clip)
########### END OF base.py ###########


smooth.set_output()