Posts: 19
Threads: 3
Joined: Feb 2021
Hello.
It is nice to see that there is a FSRCNNX GLSL resizer in Hybrid Encoder...
But the problem is that I can only use one shader at a time for upscaling...
I want to use more this...
Since I am noob at this script writing I don't know how to use it to add more GLSL.
I have all the GLSL shaders into this location C:\Program Files\Hybrid\64bit\vsfilters\ResizeFilter\GLSL
So what do I need to write in that vapoursynth Custom secton if you can help me about this then it will be nice.
Posts: 10.618
Threads: 57
Joined: May 2017
Hybrid uses GLS resizing by using vs-placebo ( https://github.com/Lypheo/vs-placebo) which has the following option in regard to using shaders:
placebo.Shader(clip clip, [string shader, int width, int height, int chroma_loc = 1, int matrix = 2, int trc = 1, string filter = "ewa_lanczos", float radius, float clamp, float taper, float blur, float param1, float param2, float antiring = 0.0, int lut_entries = 64, float cutoff = 0.001, bool sigmoidize = 1, bool linearize = 1, float sigmoid_center = 0.75, float sigmoid_slope = 6.5, string shader_s])
see: https://github.com/Lypheo/vs-placebo#pla...g-shader_s
The main part used during the resizing is:
# adjusting color space from YUV420P8 to YUV444P16 for VsGLSLResizer
clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P16, range_s="limited")
# applying the shader
clip = core.placebo.Shader(clip=clip, shader="I:/Hybrid/64bit/vsfilters/ResizeFilter/GLSL/FSRCNNX_x2_8-0-4-1.glsl", width=1280, height=704)
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/Support/libvs_placebo.dll")
In theory vs-placebo can probably be used to use other .glsl shaders in mpv syntax. I only tested a bunch of other shaders from Anime4k: https://github.com/bloc97/Anime4K/tree/master/glsl
But I have no clue what other shaders are out there an whether they could even be used using vs-placebo.
-> Without any details on what shader you want o apply to do what I can't really guess what you would need to write down in a custom section aside from:
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/Support/libvs_placebo.dll") # only needed if the library isn't already loaded
clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P16, range_s="limited") # this would need to be adjusted or left out to produce YUV44P16 from the current color space your script has at the point where the custom code gets applied.
# applying the shader
clip = core.placebo.Shader(clip=clip, shader=" PATH TO THE .glsl file", <whatever setting you placebo can/must send to your filter>)
Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Posts: 19
Threads: 3
Joined: Feb 2021
Bro I tried a lot..
but I Don't think It is working..maybe i am doing something wrong..
so Can you add 5 GLSL shaders like if i want to use it just tick them...(Mainly I need FSRCNN x2_r2_32-0-2.glsl and FSRCNNX_x2_16-0-4-1.glsl)
According to https://artoriuz.github.io/blog/mpv_upscaling.html FSRCNNX has highest score and it's fast..
I want to upscale Anime and it look really good when i upscale it..
Link to download if u can.
https://github.com/igv/FSRCNN-TensorFlow/releases
the GLSL works best are them https://ibb.co/rbPpGkY ...
Although they are really good If u can add this RAVU then it will be perfect work..since FSRCNNX is too sharper and RAVU smoothen that line ..and it will look real cool... https://github.com/bjin/mpv-prescalers RAVU_lite_R4 is the best for smoothing...
So Bro Can u please add this 6 things
Please Help me...Since I am getting error in Vapoursynth tab..
Posts: 10.618
Threads: 57
Joined: May 2017
Please properly format your text atm. it's to much of a mess to read,...
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Posts: 19
Threads: 3
Joined: Feb 2021
(25.02.2021, 19:33)Selur Wrote: Please properly format your text atm. it's to much of a mess to read,...
I don't know why it got it like that..
Some weird experience..
Posts: 10.618
Threads: 57
Joined: May 2017
25.02.2021, 20:01
(This post was last modified: 25.02.2021, 20:03 by Selur.)
Okay now I at least can read what you want.
Quote:Bro I tried a lot..
but I Don't think It is working..maybe i am doing something wrong..
For testing I did the following: - copied SRCNN x2_r2_32-0-2.glsl and FSRCNNX_x2_16-0-4-1.glsl into the "Hybrid\64bit\vsfilters\ResizeFilter\GLSL" folder
- started Hybrid
- loaded a source (resolution: 640x352)
- enable "Crop/Resize->Base->Resize"
- set "Crop/Resize->Base->Resize->Target resolution" to (width) "1280"
- enabled "Filtering->Resize->Resizer"
- selected "Filtering->Resize->Resizer->GLSL Resizer"
- selected "Filtering->Resize->Resizer->GLSL Resizer" "Hybrid/64bit/vsfilters/ResizeFilter/GLSL/FSRCNN_x2_r2_32-0-2.glsl"
- checked the "Vapoursynth Preview", preview was properly shown.
- checked the "Vapoursynth Script":
# Imports
import vapoursynth as vs
core = vs.get_core()
# Loading Plugins
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/Support/libvs_placebo.dll")
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/SourceFilter/FFMS2/ffms2.dll")
# source: 'F:\TestClips&Co\files\test.avi'
# current color space: YUV420P8, bit depth: 8, resolution: 640x352, fps: 25, color matrix: 470bg, yuv luminance scale: limited, scanorder: progressive
# Loading source using FFMS2
clip = core.ffms2.Source(source="F:/TestClips&Co/files/test.avi",cachefile="E:/Temp/avi_078c37f69bb356e7b5fa040c71584c40_853323747.ffindex",format=vs.YUV420P8,alpha=False)
# making sure input color matrix is set as 470bg
clip = core.resize.Point(clip, matrix_in_s="470bg",range_s="limited")
# making sure frame rate is set to 25
clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
# Setting color range to TV (limited) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
# adjusting color space from YUV420P8 to YUV444P16 for VsGLSLResizer
clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P16, range_s="limited")
clip = core.placebo.Shader(clip=clip, shader="I:/Hybrid/64bit/vsfilters/ResizeFilter/GLSL/FSRCNN_x2_r2_32-0-2.glsl", width=1280, height=704)
# adjusting output color from: YUV444P16 to YUV420P8 for x264Model (i420@8)
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P8, range_s="limited")
# set output frame rate to 25.000fps
clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
# Output
clip.set_output()
-> No clue where your problem is with using FSRCNN_x2_r2_32-0-2.glsl.
(I also changed to FSRCNNX_x2_16-0-4-1.glsl and that also caused no problem.)
About the pre-scalers: I don't know of any way to use those .hook files through Vapoursynth.
Quote:Since I am getting error in Vapoursynth tab..
No debut output, no mention of what error you get,.. -> no clue how to respond
Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Posts: 19
Threads: 3
Joined: Feb 2021
This is the Script i am using⬇⬇⬇⬇⬇
# Imports
import os
import sys
import ctypes
# Loading Support Files
Dllref = ctypes.windll.LoadLibrary("C:/Program Files/Hybrid/64bit/vsfilters/Support/libfftw3f-3.dll")
import vapoursynth as vs
core = vs.get_core()
# Import scripts folder
scriptPath = 'C:/Program Files/Hybrid/64bit/vsscripts'
sys.path.append(os.path.abspath(scriptPath))
# Loading Plugins
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/ResizeFilter/nnedi3/NNEDI3CL.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/Support/libvs_placebo.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/SharpenFilter/AWarpSharp2/libawarpsharp2.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/SharpenFilter/CAS/CAS.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/DenoiseFilter/DFTTest/DFTTest.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/DebandFilter/Flash3kDeband/flash3kyuu_deband.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/DenoiseFilter/KNLMeansCL/KNLMeansCL.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/Support/TCanny.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/DenoiseFilter/CTMF/CTMF.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/Support/libmvtools.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/DeblockFilter/DeblockPP7/DeblockPP7.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/DeCrawlFilter/DeDot/libdedot.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/DeCrawlFilter/DotKill/DotKill.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/vslsmashsource.dll")
# Import scripts
import muvsfunc
import mcdegrainsharp
import nnedi3_resample
import mvsfunc
import havsfunc
# source: 'E:\[Anime]\Accel_World_-_EX_[BD][h264-720p_AAC][3E56EE18]_encoded\Accel World.mkv'
# current color space: YUV420P8, bit depth: 8, resolution: 1280x720, fps: 24, color matrix: 709, yuv luminance scale: limited, scanorder: progressive
# Loading E:\[Anime]\Accel_World_-_EX_[BD][h264-720p_AAC][3E56EE18]_encoded\Accel World.mkv using LWLibavSource
clip = core.lsmas.LWLibavSource(source="E:/[Anime]/Accel_World_-_EX_[BD][h264-720p_AAC][3E56EE18]_encoded/Accel World.mkv", format="YUV420P8", cache=0, prefer_hw=0)
# making sure input color matrix is set as 709
clip = core.resize.Point(clip, matrix_in_s="709",range_s="limited")
# making sure frame rate is set to 24
clip = core.std.AssumeFPS(clip=clip, fpsnum=24, fpsden=1)
# Setting color range to TV (limited) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
clip = core.dotkill.DotKillS(clip=clip)
clip = core.dedot.Dedot(clip=clip)
# applying deblocking using DeblockPP7
clip = clip = core.pp7.DeblockPP7(clip=clip)
# removing grain using SMDegrain
clip = clip = havsfunc.SMDegrain(input=clip, interlaced=False)
# removing grain using MCDegrain
clip = clip = mcdegrainsharp.mcdegrainsharp(clip=clip, bblur=0.15, csharp=0.05, plane=4)
# denoising using KNLMeansCL
clip = core.knlm.KNLMeansCL(clip=clip)
# debanding using f3kdb
clip = core.f3kdb.Deband(clip, y=32, cb=32, cr=32, grainy=32, grainc=32, keep_tv_range=True, output_depth=8)
clip = havsfunc.LSFmod(input=clip, Smethod=3, Lmode=19, edgemaskHQ=True, preblur=3)
clip = havsfunc.EdgeCleaner(c=clip)
clip = havsfunc.FineDehalo(clip)
# deringing using HQDeringmod
clip = havsfunc.HQDeringmod(clip, nrmode=2, darkthr=3.0)
# adjusting color space from YUV420P8 to YUV444P16 for VsGLSLResizer
clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P16, range_s="limited")
clip = core.placebo.Shader(clip=clip, shader="C:/Program Files/Hybrid/64bit/vsfilters/ResizeFilter/GLSL/FSRCNN_x2_r2_32-0-2.glsl", width=1920, height=1080)
# Anti Aliasing using NNedia3aa
clip = muvsfunc.nnedi3aa(a=clip, opencl=True, device=0)
# adjusting output color from: YUV444P16 to YUV420P10 for x265Model (i420@8)
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, range_s="limited")
# set output frame rate to 24.000fps
clip = core.std.AssumeFPS(clip=clip, fpsnum=24, fpsden=1)
# Output
clip.set_output()
And Now I want to use another GLSL shader..like FSRCNNX_x2_8-0-4-1_LineArt.glsl
so now i go the custom section>select before NNEDI3aa (which one will be good insert before thing?)
So here Custom_Section what do i need do if i want to use another GLSL shader with that previous one?
Please Make an example like what do i need to write there...
Posts: 10.618
Threads: 57
Joined: May 2017
Okay, there is a bug.
All those 'clip = clip' calls are not intended. (they are no problem since they cause no harm, but they are unintended)
-> will fix that and write a small example for loading FSRCNNX_x2_8-0-4-1_LineArt.glsl
Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Posts: 10.618
Threads: 57
Joined: May 2017
Will send you a link to a dev version which fixes the 'clip = clip = '-bug.
And here's an example on how to add 'FSRCNNX_x2_8-0-4-1_LineArt.glsl' between "FSRCNN_x2_r2_32-0-2.glsl" and nnedi3aa.
What I did to create the script: - I copied the 'FSRCNNX_x2_8-0-4-1_LineArt.glsl' file into the 'Hybrid\64bit\vsfilters\ResizeFilter\GLSL' (any other folder would be fine too)
- I started Hybrid
- loaded a source (resolution: 640x352)
- enable "Crop/Resize->Base->Resize"
- set "Crop/Resize->Base->Resize->Target resolution" to (width) "1280"
- enabled "Filtering->Vaporusynth->Resize->Resizer"
- selected "Filtering->Vaporusynth->Resize->Resizer->GLSL Resizer"
- selected "Filtering->Vaporusynth->Resize->Resizer->GLSL Resizer" "Hybrid/64bit/vsfilters/ResizeFilter/GLSL/FSRCNN_x2_r2_32-0-2.glsl"
- enabled "Filtering->Vaporusynth->Line->Nedi3AA"
script now looked like this:
# Imports
import os
import sys
import vapoursynth as vs
core = vs.get_core()
# Import scripts folder
scriptPath = 'I:/Hybrid/64bit/vsscripts'
sys.path.append(os.path.abspath(scriptPath))
# Loading Plugins
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/ResizeFilter/nnedi3/vsznedi3.dll")
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/Support/libvs_placebo.dll")
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/SourceFilter/FFMS2/ffms2.dll")
# Import scripts
import mvsfunc
import muvsfunc
# source: 'F:\TestClips&Co\files\test.avi'
# current color space: YUV420P8, bit depth: 8, resolution: 640x352, fps: 25, color matrix: 470bg, yuv luminance scale: limited, scanorder: progressive
# Loading source using FFMS2
clip = core.ffms2.Source(source="F:/TestClips&Co/files/test.avi",cachefile="E:/Temp/avi_078c37f69bb356e7b5fa040c71584c40_853323747.ffindex",format=vs.YUV420P8,alpha=False)
# making sure input color matrix is set as 470bg
clip = core.resize.Point(clip, matrix_in_s="470bg",range_s="limited")
# making sure frame rate is set to 25
clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
# Setting color range to TV (limited) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
# adjusting color space from YUV420P8 to YUV444P16 for VsGLSLResizer
clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P16, range_s="limited")
clip = core.placebo.Shader(clip=clip, shader="I:/Hybrid/64bit/vsfilters/ResizeFilter/GLSL/FSRCNN_x2_r2_32-0-2.glsl", width=1920, height=1056)
# Anti Aliasing using NNedia3aa
clip = muvsfunc.nnedi3aa(a=clip)
# adjusting output color from: YUV444P16 to YUV420P8 for x264Model (i420@8)
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P8, range_s="limited")
# set output frame rate to 25.000fps
clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
# Output
clip.set_output()
- set "Filtering->Vaporusynth->Custom->Insert before" to "NNedi3AA" and enabled the custom section
- entered:
clip = core.placebo.Shader(clip=clip, shader="I:/Hybrid/64bit/vsfilters/ResizeFilter/GLSL/FSRCNNX_x2_8-0-4-1_LineArt.glsl", width=1920, height=1056)
Note that there is no need to adjust the color space since it was already adjusted to YUV444P16 for FSRCNN_x2_r2_32-0-2.glsl.
The generated script now looks like this:
# Imports
import os
import sys
import vapoursynth as vs
core = vs.get_core()
# Import scripts folder
scriptPath = 'I:/Hybrid/64bit/vsscripts'
sys.path.append(os.path.abspath(scriptPath))
# Loading Plugins
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/ResizeFilter/nnedi3/vsznedi3.dll")
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/Support/libvs_placebo.dll")
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/SourceFilter/FFMS2/ffms2.dll")
# defining beforeNNedi3AA-function - END
def beforeNNedi3AA(clip):
clip = core.placebo.Shader(clip=clip, shader="I:/Hybrid/64bit/vsfilters/ResizeFilter/GLSL/FSRCNNX_x2_8-0-4-1_LineArt.glsl", width=1920, height=1056)
return clip
# defining beforeNNedi3AA-function - END
# Import scripts
import mvsfunc
import muvsfunc
# source: 'F:\TestClips&Co\files\test.avi'
# current color space: YUV420P8, bit depth: 8, resolution: 640x352, fps: 25, color matrix: 470bg, yuv luminance scale: limited, scanorder: progressive
# Loading source using FFMS2
clip = core.ffms2.Source(source="F:/TestClips&Co/files/test.avi",cachefile="E:/Temp/avi_078c37f69bb356e7b5fa040c71584c40_853323747.ffindex",format=vs.YUV420P8,alpha=False)
# making sure input color matrix is set as 470bg
clip = core.resize.Point(clip, matrix_in_s="470bg",range_s="limited")
# making sure frame rate is set to 25
clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
# Setting color range to TV (limited) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
# adjusting color space from YUV420P8 to YUV444P16 for VsGLSLResizer
clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P16, range_s="limited")
clip = core.placebo.Shader(clip=clip, shader="I:/Hybrid/64bit/vsfilters/ResizeFilter/GLSL/FSRCNN_x2_r2_32-0-2.glsl", width=1920, height=1056)
clip = beforeNNedi3AA(clip)
# Anti Aliasing using NNedia3aa
clip = muvsfunc.nnedi3aa(a=clip)
# adjusting output color from: YUV444P16 to YUV420P8 for x264Model (i420@8)
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P8, range_s="limited")
# set output frame rate to 25.000fps
clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
# Output
clip.set_output()
No clue whether 'FSRCNN_x2_r2_32-0-2.glsl' allows additional option, but the script works fine here.
Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Posts: 19
Threads: 3
Joined: Feb 2021
Thanks a lot for trying..
I have another question..
# adjusting color space from YUV420P8 to YUV444P16 for VsGLSLResizer
clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P16, range_s="limited")
clip = core.placebo.Shader(clip=clip, shader="C:/Program Files/Hybrid/64bit/vsfilters/ResizeFilter/GLSL/FSRCNN_x2_r2_32-0-2.glsl", width=1920, height=1080)
here if I use Lanczos won't it will give me more quality output?
|