Topic: [script] Do interpolation in half resolution?
Hey,
I cant handle 4K sources with my rig and wanted to resize them down to 1080p before interpolation, but i cant get it to work?
This is the important part of my script.py i call from mpv.conf:
refine_params = "[{thsad:2000, search:{distance:2, type:4}}]"
super_params = "{pel:2,scale:{up:2,Down:4},gpu:1,full:true}"
analyse_params = "{block:{w:32,h:32,overlap:2},main:{levels:4,search:{type:4,distance:-24,sort:true,satd:false,coarse:{type: 4,distance: -5,satd: true,trymany: false,bad: {sad: 1000,range: 0}}},penalty:{lambda: 1.0,plevel: 4.0,lsad: 800,pnew: 5,pglobal: 5,pzero: 10,pnbour: 5,prev: 0}}},refine:" + refine_params + "}"
##THE PROBLEM##
if (clip.width > 1920 or clip.height > 1080): #Just assuming 4K for now so half that since i got a 1080p screen.
clip=core.resize.Point(clip, width=clip.width/2, height=clip.height/2, format=vs.YUV420P8)
##This works fine##
if (clip.width <= 1920 or clip.height <= 1080): # 1080p content
clip=core.resize.Point(clip, width=clip.width, height=clip.height, format=vs.YUV420P8)
def interpolate(clip):
dst_fps = display_fps
src_fps_num = int(container_fps * 1e8)
src_fps_den = int(1e8)
dst_fps_num = int(dst_fps * 1e4)
dst_fps_den = int(1e4)
clip = core.std.AssumeFPS(clip, fpsnum = src_fps_num, fpsden = src_fps_den)
smoothfps_params = "{debug:{vectors:false},rate:{abs:true,den:" + str(dst_fps_den) + ",num:" + str(dst_fps_num) + ",algo:23},cubic: 1,gpuid: 0,linear: true,mask: {cover: 10,area: 0,area_sharp: 1.0},scene: {mode: 0,blend: false,limits: {m1: 3600,m2: 7200,scene: 10400,zero: 10,blocks: 90},luma: 1.5},light: {aspect: 0.0,sar: 1.0,zoom: 0.0,lights: 16,length: 100,cell: 1.0,border: 12}}"
super = core.svp1.Super(clip,super_params)
vectors = core.svp1.Analyse(super["clip"],super["data"],clip,analyse_params)
smooth = core.svp2.SmoothFps(clip,super["clip"],super["data"],vectors["clip"],vectors["data"],smoothfps_params,src=clip,fps=src_fps)
smooth = core.std.AssumeFPS(smooth, fpsnum=smooth.fps_num, fpsden=smooth.fps_den)
return smooth
smooth = interpolate(clip)
smooth.set_output()
The error when playing 4K materials on my 1080p screen is:
[ 0.443][e][vapoursynth] Filter error at frame 0: Resize error 1027: image dimensions must be divisible by subsampling factor
[ 0.443][e][vapoursynth] Filter error at frame 1: Resize error 1027: image dimensions must be divisible by subsampling factor
[ 0.443][e][vapoursynth] Filter error at frame 2: Resize error 1027: image dimensions must be divisible by subsampling factor
[ 0.443][e][vapoursynth] failed, no action taken
[ 0.443][e][vf] Disabling filter SVP because it has failed.
[ 0.447][d][vapoursynth] destroying VS filters
[ 0.449][d][vapoursynth] returning error on reset/uninit
How do i half the clip.width and clip.height when receiving a 4K stream??
I have tested a lot of things like:
if (clip.width > 1920 or clip.height > 1080):
clip=core.resize.Point(clip,width=round((clip.width) * 0.5),height=round((clip.height) * 0.5),format=vs.YUV420P8)
Nothing works, please if someone who knows this, i need some assistance
I am using latest, vapoursynth and compatible python. Have SVP Pro with license.