Skip to content

Instantly share code, notes, and snippets.

@phiresky
Last active July 20, 2017 16:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phiresky/8f4af83692b2915044cd3b01d28fc6e7 to your computer and use it in GitHub Desktop.
Save phiresky/8f4af83692b2915044cd3b01d28fc6e7 to your computer and use it in GitHub Desktop.
# 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
super_params = "{scale:{up:2},gpu:0,rc:true}"
analyse_params = "{block:{w:32},main:{search:{coarse:{type:2,distance:-6,bad:{sad:2000,range:24}},type:2}},refine:[{thsad:250}]}"
smoothfps_params = "{rate:{num:5,den:2},algo:2,scene:{}}"
src_fps = container_fps if container_fps>0.1 else 23.976
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):
# DO NOT REMOVE this comment
# input_um - original frame in 4:2:0
# input_m - cropped and resized (if needed) frame
# input_m8 - input_m converted to 8-bit
input_um = clip.resize.Point(format=vs.YUV420P8)
input_m = input_um
input_m8 = input_m
super = core.svp1.Super(input_m8,super_params)
vectors = core.svp1.Analyse(super["clip"],super["data"],input_m8,analyse_params)
smooth = core.svp2.SmoothFps(input_m,super["clip"],super["data"],vectors["clip"],vectors["data"],smoothfps_params,src=input_um,fps=src_fps)
smooth = core.std.AssumeFPS(smooth,fpsnum=smooth.fps_num,fpsden=smooth.fps_den)
if demo_mode==1:
return demo(input_m,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()
diff --git a/ani.py b/ani-240fps.py
index 6194a70..cdcbbfb 100644
--- a/ani.py
+++ b/ani-240fps.py
@@ -2,17 +2,18 @@
# Check https://www.svp-team.com for more details.
import vapoursynth as vs
+import sys
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 = core.ffms2.Source(source="24fps/native.mkv")
super_params = "{scale:{up:2},gpu:0,rc:true}"
analyse_params = "{block:{w:32},main:{search:{coarse:{type:2,distance:-6,bad:{sad:2000,range:24}},type:2}},refine:[{thsad:250}]}"
-smoothfps_params = "{rate:{num:5,den:2},algo:2,scene:{}}"
+smoothfps_params = "{rate:{num:20,den:2},algo:2,scene:{}}"
-src_fps = container_fps if container_fps>0.1 else 23.976
+src_fps = 24
demo_mode = 0
stereo_type = 0
@@ -33,6 +34,7 @@ def interpolate(clip):
super = core.svp1.Super(input_m8,super_params)
vectors = core.svp1.Analyse(super["clip"],super["data"],input_m8,analyse_params)
smooth = core.svp2.SmoothFps(input_m,super["clip"],super["data"],vectors["clip"],vectors["data"],smoothfps_params,src=input_um,fps=src_fps)
+ print(f"{smooth.fps_num} {smooth.fps_den} {smoothfps_params}", file=sys.stderr)
smooth = core.std.AssumeFPS(smooth,fpsnum=smooth.fps_num,fpsden=smooth.fps_den)
if demo_mode==1:
@@ -53,4 +55,4 @@ else:
########### END OF base.py ###########
-smooth.set_output()
\ No newline at end of file
+smooth.set_output()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment