Topic: Potplayer with SVP flow script (no gui)
Hi!
I am running MPV with SVP (disabled in the background but bought it ofc)
in mpv.ini:
#lots of other things
[4K]
profile-desc=cond:((p["video-params/w"]>2560 or p["video-params/h"]>1440) and string.match(p.filename, "mkv")~=nil)
log-file = "4K.txt"
hwdec = nvdec-copy
hwdec-codecs = all
gpu-api=auto
glsl-shaders-clr
glsl-shaders = "~~/shaders/noise_static_luma.hook"
glsl-shaders-append = "~~/shaders/noise_static_chroma.hook"
glsl-shaders-append="~~/shaders/FSRCNNX_x2_8-0-4-1.glsl"
scale=ewa_lanczos
glsl-shaders-append = "~~/shaders/SSimDownscaler.glsl"
dscale=mitchell
linear-downscaling=no
#glsl-shaders-append="~~/shaders/KrigBilateral.glsl"
cscale=mitchell
sigmoid-upscaling=no
#glsl-shaders-append = "~~/shaders/SSimSuperRes.glsl"
#glsl-shaders-append = "~~/shaders/adaptive-sharpen.glsl"
vf = @SVP:vapoursynth="~~/vs_svp.py":buffered-frames=1:concurrent-frames=24
and my vs_svp.py that i have modified over time, works really good (but am ALL EARS for feedback, love to tweak this thing)
Sidenote, can play http://jell.yfish.us/media/jellyfish-25 … d-h264.mkv on a i7 6700k and gtx 980 with no dropped frames and super smooth.
import logging
import os
import multiprocessing
import math
import sys
from fractions import Fraction
from subprocess import call
import vapoursynth as vs
import os.path
core = vs.get_core(threads=(multiprocessing.cpu_count()))
core.max_cache_size = 80800
core.set_max_cache_size(80800)
clip = video_in
src_fps = container_fps if container_fps>0.1 else 23.976
if round(src_fps*1000)/1000 == 23.810:
src_fps = 23.976
extension = os.path.splitext(str(clip))[1][1:] #Catches the file extension name i.e wmv.
########## SVP Config ##########
block_size = int(math.pow(2, round(math.log2(clip.width//80))))
block_size = 32 if block_size > 32 else (8 if block_size < 8 else block_size)
pixel_precision = 2 if clip.width < 2000 else 1
block_overlap = 2 if clip.width < 2000 else 0
fine_search_type = 4 if clip.width < 2000 else 2
algo_var = 21 if clip.width < 2000 else 1
course_search_type = 4 if clip.width < 2000 else 2
distance = -12 if clip.width < 2000 else 0
def interpolate(clip):
#Not the most elegant, will work it over at some point
den_fps_24p = 1001
num_fps_24p = 60000
den_fps_25 = 1000
num_fps_25 = 50000
den_fps_29 = 1001
num_fps_29 = 60000
den_fps_30 = 1001
num_fps_30 = 60000
den_fps_60 = 1001
num_fps_60 = 60000
den_fps_120 = 1001
num_fps_120 = 120000
den_fps_144 = 1001
num_fps_144 = 1440000
refine_params = "[{thsad:200,search:{distance:" + str(distance//2) + "}},{thsad:200,search:{distance:" + str(distance//4) + "}}]" if clip.width > 1280 else "[{thsad:200,search:{distance:" + str(distance//2) + "}}]"
if extension == "wmv" or src_fps == 30.000:
super_params = "{pel:1,scale:{up:0},gpu:1,full:false}"
analyse_params = "{block:{overlap:0},main:{search:{coarse:{distance:-10,bad:{sad:2000}},distance:0}}},refine:" + refine_params + "}"
input_resize = clip.resize.Bicubic(format=vs.YUV420P8)
elif clip.width >=2000:
super_params = "{pel:1,scale:{up:0},gpu:1,full:false}"
analyse_params = "{block:{overlap:0},main:{search:{coarse:{distance:" + str(distance) + ",bad:{sad:2000}},distance:" + str(distance) + "}}},refine:" + refine_params + "}"
input_resize = clip.resize.Spline64(format=vs.YUV420P8)
else:
super_params = "{pel:" + str(pixel_precision) + ",scale:{up:2,down:4},gpu:1,full:true}"
analyse_params = "{gpu:1,vectors:3,block:{w:" + str(block_size) + ",h:" + str(block_size) + ",overlap:" + str(block_overlap) + "},main:{search:{coarse:{width: 1050, distance:" + str(distance) + ", bad:{sad:2000,range:0}},type:4}},refine:" + refine_params + "}"
input_resize = clip.resize.Spline64(format=vs.YUV420P8, dither_type="error_diffusion")
if src_fps == 25.000:
smoothfps_params = "{debug:{vectors:false},rate:{abs:true,den:" + str(den_fps_25) + ",num:" + str(num_fps_25) + ",algo:" + str(algo_var) + "},cubic:1,gpuid:0,block:false,linear:true,mask:{area:70,cover:50,area_sharp:1.0},scene:{mode:0,blend:false,limits:{zero:200,blocks:50}}}"
elif src_fps == 29.970:
smoothfps_params = "{debug:{vectors:false},rate:{abs:true,den:" + str(den_fps_29) + ",num:" + str(num_fps_29) + ",algo:" + str(algo_var) + "},cubic:1,gpuid:0,block:false,linear:true,mask:{area:70,cover:50,area_sharp:1.0},scene:{mode:0,blend:false,limits:{zero:200,blocks:50}}}"
elif src_fps == 30.000:
smoothfps_params = "{debug:{vectors:false},rate:{abs:true,den:" + str(den_fps_30) + ",num:" + str(num_fps_30) + ",algo:" + str(algo_var) + "},cubic:1,gpuid:0,block:false,linear:true,mask:{area:70,cover:50,area_sharp:1.0},scene:{mode:0,blend:false,limits:{zero:200,blocks:50}}}"
elif src_fps == 60.000:
smoothfps_params = "{debug:{vectors:false},rate:{abs:true,den:" + str(den_fps_60) + ",num:" + str(num_fps_60) + ",algo:" + str(algo_var) + "},cubic:1,gpuid:0,block:false,linear:true,mask:{area:70,cover:50,area_sharp:1.0},scene:{mode:0,blend:false,limits:{zero:200,blocks:50}}}"
elif display_fps == 120.000:
smoothfps_params = "{debug:{vectors:false},rate:{abs:true,den:" + str(den_fps_120) + ",num:" + str(num_fps_120) + ",algo:" + str(algo_var) + "},cubic:1,gpuid:0,block:false,linear:true,mask:{area:70,cover:50,area_sharp:1.0},scene:{mode:0,blend:false,limits:{zero:200,blocks:50}}}"
elif display_fps == 144.000:
smoothfps_params = "{debug:{vectors:false},rate:{abs:true,den:" + str(den_fps_144) + ",num:" + str(num_fps_144) + ",algo:" + str(algo_var) + "},cubic:1,gpuid:0,block:false,linear:true,mask:{area:70,cover:50,area_sharp:1.0},scene:{mode:0,blend:false,limits:{zero:200,blocks:50}}}"
else: #Must be 23.976 or 24.000Hz material.
smoothfps_params = "{debug:{vectors:false},rate:{abs:true,den:" + str(den_fps_24p) + ",num:" + str(num_fps_24p) + ",algo:" + str(algo_var) + "},cubic:1,gpuid:0,block:false,linear:true,mask:{area:70,cover:50,area_sharp:1.0},scene:{mode:0,blend:true,limits:{zero:200,blocks:50}}}"
super = core.svp1.Super(input_resize,super_params)
vectors = core.svp1.Analyse(super["clip"],super["data"],input_resize,analyse_params)
smooth = core.svp2.SmoothFps(clip,super["clip"],super["data"],vectors["clip"],vectors["data"],smoothfps_params,src=input_resize,fps=src_fps)
smooth = core.std.AssumeFPS(smooth,fpsnum=smooth.fps_num,fpsden=smooth.fps_den)
return smooth
smooth = interpolate(clip)
smooth.set_output()
Now my question, i am looking at potplayer iinstead of MPV just because i cant get thumbnail seekbar to work 100%, sometimes MPV just starts with a black screen and it takes 20sec before the video begins. Buggs the crap put of me. And sometimes with the same file, works directly. Error am getting in the cosole is:
ffmpeg co located POCs unavailable
So if anyone knows why the screen turns black or know anyway to fix it, please tell (I have tested tons of diffrent ffmpeg.exe and even made my own, no change).
But Potplayer, how do i set it up to work with my vs_svp.py file?
I have added it to potplayer under vapoursynth, i get no error when i start a file but the framerate and lagginess is terrible.
Hope someone has a tip or 2
Cheers! <3