![]() |
|
[Feature] Multiple passes for glsl shaders - Printable Version +- Selur's Little Message Board (https://forum.selur.net) +-- Forum: Hybrid - Support (https://forum.selur.net/forum-1.html) +--- Forum: Problems & Questions (https://forum.selur.net/forum-3.html) +--- Thread: [Feature] Multiple passes for glsl shaders (/thread-2219.html) |
[Feature] Multiple passes for glsl shaders - banjamin - 25.12.2021 I have noticed that we can select custom glsl shaders when using vapoursynth, I would like to request that we can add on to it and have multiple passes with different shaders, this allows for more adaptive filtering for different sources and can be useful when using filters like Anime4K where multiple filters are required to make the output desirable Thanks in advance RE: [Feature] Multiple passes for glsl shaders - Selur - 25.12.2021 I don't really get it. ![]() You can simply add glsl filter as often as you need it, so why multiple passes? How do you envision this to work? Cu Selur RE: [Feature] Multiple passes for glsl shaders - banjamin - 25.12.2021 (25.12.2021, 18:32)Selur Wrote: I don't really get it. Wait can we? Whenever I add another glsl filter the first one gets overwritten RE: [Feature] Multiple passes for glsl shaders - Selur - 25.12.2021 Just, tested it: # Imports
import vapoursynth as vs
# getting Vapoursynth core
core = vs.core
# Loading Plugins
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/Support/libvs_placebo.dll")
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/SourceFilter/FFMS2/ffms2.dll")
# source: 'G:\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="G:/TestClips&Co/files/test.avi",cachefile="E:/Temp/avi_6c441f37d9750b62d59f16ecdbd59393_853323747.ffindex",format=vs.YUV420P8,alpha=False)
# making sure input color matrix is set as 470bg
clip = core.resize.Bicubic(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)
# GLSL filter: ACNet.glsl
# adjusting color space from YUV420P8 to YUV444P16 for VsGLSLFilter
clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P16, range_s="limited")
clip = core.placebo.Shader(clip=clip, shader="I:/Hybrid/64bit/vsfilters/GLSL/ACNet.glsl", width=640, height=352)
# GLSL filter: adaptive-sharpen.glsl
clip = core.placebo.Shader(clip=clip, shader="I:/Hybrid/64bit/vsfilters/GLSL/adaptive-sharpen.glsl", width=640, height=352)
# adjusting output color from: YUV444P16 to YUV420P8 for x264Model
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()You need to use "Filter Queue" instead of the default "Filter Order" to add multiple instances,... read: [INFO] About Vapoursynth Filter Order/Queue Hybrid allows to add:
Cu Selur RE: [Feature] Multiple passes for glsl shaders - banjamin - 26.12.2021 (25.12.2021, 19:26)Selur Wrote: Just, tested it:Niceee thanks However it seems that Anime4K shaders cannot be applied this way? I'm not sure if it is a VS issue or the structure of Anime4K glsl shaders but they don't seem to work well with video exporting outside of mpv, maybe you can take a look? Thanks in advance RE: [Feature] Multiple passes for glsl shaders - Selur - 26.12.2021 I can confirm that if I use the glsl filters from https://github.com/bloc97/Anime4K/releases and use for example: # Imports
import vapoursynth as vs
# getting Vapoursynth core
core = vs.core
# Loading Plugins
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/Support/libvs_placebo.dll")
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/SourceFilter/FFMS2/ffms2.dll")
# source: 'G:\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="G:/TestClips&Co/files/test.avi",cachefile="E:/Temp/avi_6c441f37d9750b62d59f16ecdbd59393_853323747.ffindex",format=vs.YUV420P8,alpha=False)
# making sure input color matrix is set as 470bg
clip = core.resize.Bicubic(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)
# GLSL filter: Anime4K_Darken_VeryFast.glsl
# adjusting color space from YUV420P8 to YUV444P16 for VsGLSLFilter
clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P16, range_s="limited")
clip = core.placebo.Shader(clip=clip, shader="C:/Users/Selur/Desktop/Anime4k/Anime4K_Darken_VeryFast.glsl", width=640, height=352)
# adjusting output color from: YUV444P16 to YUV420P8 for x264Model
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()vspipe "E:\Temp\encodingTempSynthSkript_2021-12-26@07_38_12_9010.vpy" - -c y4m | x264 --preset veryfast --crf 18.00 --profile high --level 4.1 --ref 3 --direct auto --b-adapt 0 --sync-lookahead 48 --qcomp 0.50 --rc-lookahead 40 --qpmax 51 --partitions i4x4,p8x8,b8x8 --no-fast-pskip --subme 5 --aq-mode 0 --vbv-maxrate 62500 --vbv-bufsize 78125 --sar 1:1 --non-deterministic --range tv --colormatrix bt470bg --demuxer y4m --input-range tv --fps 25/1 --output-depth 8 --output "E:\Temp\2021-12-26@07_38_12_9010_03.264" -y4m [error]: bad frame header magicWild guess is that those shaders only work if there is an acctual display. Since I don't think this is a bug in Hybrid, I opened an issue entry over at https://github.com/Lypheo/vs-placebo/issues/17 to see whether the author of vs-placeco can say anything about it. Cu Selur RE: [Feature] Multiple passes for glsl shaders - banjamin - 26.12.2021 (26.12.2021, 08:53)Selur Wrote: I can confirm that if I use the glsl filters from https://github.com/bloc97/Anime4K/releases and use for example: Great to know that it isn't something due to my goofy setup Thanks for all your help Happy holidays! RE: [Feature] Multiple passes for glsl shaders - Selur - 30.01.2022 Just did a small test with: # Imports
import vapoursynth as vs
# getting Vapoursynth core
core = vs.core
# Loading Plugins
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/Support/libvs_placebo.dll")
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/SourceFilter/FFMS2/ffms2.dll")
# source: 'G:\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="G:/TestClips&Co/files/test.avi",cachefile="E:/Temp/avi_6c441f37d9750b62d59f16ecdbd59393_853323747.ffindex",format=vs.YUV420P8,alpha=False)
# making sure input color matrix is set as 470bg
clip = core.resize.Bicubic(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)
# GLSL filter: Anime4K_Darken_VeryFast.glsl
# adjusting color space from YUV420P8 to YUV444P16 for VsGLSLFilter
clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P16, range_s="limited")
clip = core.placebo.Shader(clip=clip, shader="I:/Hybrid/64bit/vsfilters/GLSL/Anime4k/Anime4K_Darken_VeryFast.glsl", width=640, height=352)
# adjusting output color from: to YUV420P8 for x264Model
= core.resize.Bicubic(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()Cu Selur RE: [Feature] Multiple passes for glsl shaders - Selur - 07.02.2022 as a small update regarding using Anime4k filters https://github.com/Lypheo/vs-placebo/issues/17 -> issue still exists, but it's not happening for all Anime4k filters, the darken filters for example work during preview and encoding. Cu Selur RE: [Feature] Multiple passes for glsl shaders - Selur - 08.02.2022 It's fixed. ![]() -> Uploaded a new dev and send you a link via pm. Cu Selur |