7 hours ago
When I try to enable FineDeHalo in Hybrid 2025.03.09.1 the program crashes. I can't output a file, and when I try to preview
![[Image: finedehalo.png]](https://i.ibb.co/ycdBHMm0/finedehalo.png)
This is the script:
# Imports
import vapoursynth as vs
# getting Vapoursynth core
import ctypes
import sys
import os
core = vs.core
# Import scripts folder
scriptPath = 'D:/Film/Hybrid/64bit/vsscripts'
sys.path.insert(0, os.path.abspath(scriptPath))
# Loading Support Files
Dllref = ctypes.windll.LoadLibrary("D:/Film/Hybrid/64bit/vsfilters/Support/libfftw3f-3.dll")
# loading plugins
core.std.LoadPlugin(path="D:/Film/Hybrid/64bit/vsfilters/ResizeFilter/nnedi3/NNEDI3CL.dll")
core.std.LoadPlugin(path="D:/Film/Hybrid/64bit/vsfilters/DenoiseFilter/CTMF/CTMF.dll")
core.std.LoadPlugin(path="D:/Film/Hybrid/64bit/vsfilters/Support/vszip.dll")
core.std.LoadPlugin(path="D:/Film/Hybrid/64bit/vsfilters/DenoiseFilter/KNLMeansCL/KNLMeansCL.dll")
core.std.LoadPlugin(path="D:/Film/Hybrid/64bit/vsfilters/GrainFilter/RemoveGrain/RemoveGrainVS.dll")
core.std.LoadPlugin(path="D:/Film/Hybrid/64bit/vsfilters/GrainFilter/AddGrain/AddGrain.dll")
core.std.LoadPlugin(path="D:/Film/Hybrid/64bit/vsfilters/DenoiseFilter/NEO_FFT3DFilter/neo-fft3d.dll")
core.std.LoadPlugin(path="D:/Film/Hybrid/64bit/vsfilters/DenoiseFilter/DFTTest/DFTTest.dll")
core.std.LoadPlugin(path="D:/Film/Hybrid/64bit/vsfilters/Support/EEDI3m.dll")# vsQTGMC
core.std.LoadPlugin(path="D:/Film/Hybrid/64bit/vsfilters/ResizeFilter/nnedi3/vsznedi3.dll")
core.std.LoadPlugin(path="D:/Film/Hybrid/64bit/vsfilters/Support/libmvtools.dll")
core.std.LoadPlugin(path="D:/Film/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
core.std.LoadPlugin(path="D:/Film/Hybrid/64bit/vsfilters/MiscFilter/MiscFilters/MiscFilters.dll")
core.std.LoadPlugin(path="D:/Film/Hybrid/64bit/vsfilters/DeinterlaceFilter/Bwdif/Bwdif.dll")
core.std.LoadPlugin(path="D:/Film/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/LSMASHSource.dll")
# Import scripts
import edi_rpow2
import dehalo
import qtgmc
import validate
# Source: 'D:\mymovie.avi'
# Current color space: YUV422P8, bit depth: 8, resolution: 720x576, frame rate: 25fps, scanorder: top field first, yuv luminance scale: limited, matrix: 470bg, format: HuffYUV
# Loading D:\mymovie.avi using LWLibavSource
clip = core.lsmas.LWLibavSource(source="D:/mymovie.avi", format="YUV422P8", stream_index=0, cache=0, prefer_hw=0)
frame = clip.get_frame(0)
# setting color matrix to 470bg.
clip = core.std.SetFrameProps(clip, _Matrix=vs.MATRIX_BT470_BG)
# setting color transfer (vs.TRANSFER_BT601), if it is not set.
if validate.transferIsInvalid(clip):
clip = core.std.SetFrameProps(clip=clip, _Transfer=vs.TRANSFER_BT601)
# setting color primaries info (to vs.PRIMARIES_BT470_BG), if it is not set.
if validate.primariesIsInvalid(clip):
clip = core.std.SetFrameProps(clip=clip, _Primaries=vs.PRIMARIES_BT470_BG)
# setting color range to TV (limited) range.
clip = core.std.SetFrameProps(clip=clip, _ColorRange=vs.RANGE_LIMITED)
# making sure frame rate is set to 25fps
clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
# making sure the detected scan type is set (detected: top field first)
clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_TOP) # tff
original = clip
# Deinterlacing using QTGMC
clip = qtgmc.QTGMC(Input=clip, Preset="Faster", TFF=True) # new fps: 50
# Making sure content is preceived as frame based
clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # progressive
# Deinterlacing using QTGMC
original = qtgmc.QTGMC(Input=original, Preset="Faster", TFF=True) # new fps: 50
# Making sure content is preceived as frame based
original = core.std.SetFrameProps(clip=original, _FieldBased=vs.FIELD_PROGRESSIVE) # progressive
# ColorMatrix: adjusting color matrix from 470bg to 709
clip = core.resize.Bicubic(clip=clip, matrix_in_s="470bg", matrix_s="709", range_in=1, range=1)
clip = core.std.Crop(clip=clip, left=20, right=24, top=4, bottom=8)# cropping to 676x564
original = core.std.Crop(clip=original, left=20, right=24, top=4, bottom=8)# cropping to 676x564
# Denoising using QTGMC
clip = qtgmc.QTGMC(Input=clip, Preset="Fast", InputType=1, TR2=1, SourceMatch=0, Lossless=0, EZDenoise=0.80, NoisePreset="Fast", Denoiser="KNLMeansCL")
# applying FineDeHalo to remove halos
clip = dehalo.FineDehalo(clip)
# resizing using NNEDI3CL
# current: 676x564 target: 1440x1080 -> pow: 4
clip = edi_rpow2.nnedi3cl_rpow2(clip=clip, rfactor=4, nsize=1, nns=4) # 2704x2256
# resizing 2704x2256 to 1440x1080
clip = core.fmtc.resample(clip=clip, w=1440, h=1080, kernel="lanczos", interlaced=False, interlacedd=False)# before YUV422P8 after YUV422P16
original = core.resize.Bicubic(clip=original, width=1440, height=1080)
# letterboxing 1440x1080 to 1920x1080
clip = core.std.AddBorders(clip=clip, left=240, right=240, top=0, bottom=0)
# letterboxing 1440x1080 to 1920x1080
original = core.std.AddBorders(clip=original, left=240, right=240, top=0, bottom=0)
# adjusting output color from: YUV422P8 to YUV422P10 for ProResModel
original = core.resize.Bicubic(clip=original, format=vs.YUV422P10, range_s="limited")
# adjusting output color from: YUV422P16 to YUV422P10 for ProResModel
clip = core.resize.Bicubic(clip=clip, format=vs.YUV422P10, range_s="limited", dither_type="error_diffusion")
original = core.text.Text(clip=original,text="Original",scale=2,alignment=7)
clip = core.text.Text(clip=clip,text="Filtered",scale=2,alignment=7)
stacked = core.std.StackHorizontal([original,clip])
# adjusted resizing to achieve PAR 1:1 for preview
# resizing for preview to square pixel to 3452x1080
stacked = core.resize.Bicubic(clip=stacked, width=3452, height=1080)
# set output frame rate to 50fps (progressive)
stacked = core.std.AssumeFPS(clip=stacked, fpsnum=50, fpsden=1)
# output
stacked.set_output()
And this is the log output:
2025-05-04 10:57:24.236
Failed to evaluate the script:
Python exception: expected 'else' after 'if' expression (dehalo.py, line 63)
Traceback (most recent call last):
File "src\\cython\\vapoursynth.pyx", line 3365, in vapoursynth._vpy_evaluate
File "src\\cython\\vapoursynth.pyx", line 3366, in vapoursynth._vpy_evaluate
File "C:\Users\Johan\AppData\Local\Temp\tempPreviewVapoursynthFile10_57_23_740.vpy", line 31, in
import dehalo
File "D:\Film\Hybrid\64bit\vsscripts\dehalo.py", line 63
so = so.vszip.Limiter() if hasattr(core,'vszip') so.std.Limiter()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: expected 'else' after 'if' expression
![[Image: finedehalo.png]](https://i.ibb.co/ycdBHMm0/finedehalo.png)
This is the script:
# Imports
import vapoursynth as vs
# getting Vapoursynth core
import ctypes
import sys
import os
core = vs.core
# Import scripts folder
scriptPath = 'D:/Film/Hybrid/64bit/vsscripts'
sys.path.insert(0, os.path.abspath(scriptPath))
# Loading Support Files
Dllref = ctypes.windll.LoadLibrary("D:/Film/Hybrid/64bit/vsfilters/Support/libfftw3f-3.dll")
# loading plugins
core.std.LoadPlugin(path="D:/Film/Hybrid/64bit/vsfilters/ResizeFilter/nnedi3/NNEDI3CL.dll")
core.std.LoadPlugin(path="D:/Film/Hybrid/64bit/vsfilters/DenoiseFilter/CTMF/CTMF.dll")
core.std.LoadPlugin(path="D:/Film/Hybrid/64bit/vsfilters/Support/vszip.dll")
core.std.LoadPlugin(path="D:/Film/Hybrid/64bit/vsfilters/DenoiseFilter/KNLMeansCL/KNLMeansCL.dll")
core.std.LoadPlugin(path="D:/Film/Hybrid/64bit/vsfilters/GrainFilter/RemoveGrain/RemoveGrainVS.dll")
core.std.LoadPlugin(path="D:/Film/Hybrid/64bit/vsfilters/GrainFilter/AddGrain/AddGrain.dll")
core.std.LoadPlugin(path="D:/Film/Hybrid/64bit/vsfilters/DenoiseFilter/NEO_FFT3DFilter/neo-fft3d.dll")
core.std.LoadPlugin(path="D:/Film/Hybrid/64bit/vsfilters/DenoiseFilter/DFTTest/DFTTest.dll")
core.std.LoadPlugin(path="D:/Film/Hybrid/64bit/vsfilters/Support/EEDI3m.dll")# vsQTGMC
core.std.LoadPlugin(path="D:/Film/Hybrid/64bit/vsfilters/ResizeFilter/nnedi3/vsznedi3.dll")
core.std.LoadPlugin(path="D:/Film/Hybrid/64bit/vsfilters/Support/libmvtools.dll")
core.std.LoadPlugin(path="D:/Film/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
core.std.LoadPlugin(path="D:/Film/Hybrid/64bit/vsfilters/MiscFilter/MiscFilters/MiscFilters.dll")
core.std.LoadPlugin(path="D:/Film/Hybrid/64bit/vsfilters/DeinterlaceFilter/Bwdif/Bwdif.dll")
core.std.LoadPlugin(path="D:/Film/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/LSMASHSource.dll")
# Import scripts
import edi_rpow2
import dehalo
import qtgmc
import validate
# Source: 'D:\mymovie.avi'
# Current color space: YUV422P8, bit depth: 8, resolution: 720x576, frame rate: 25fps, scanorder: top field first, yuv luminance scale: limited, matrix: 470bg, format: HuffYUV
# Loading D:\mymovie.avi using LWLibavSource
clip = core.lsmas.LWLibavSource(source="D:/mymovie.avi", format="YUV422P8", stream_index=0, cache=0, prefer_hw=0)
frame = clip.get_frame(0)
# setting color matrix to 470bg.
clip = core.std.SetFrameProps(clip, _Matrix=vs.MATRIX_BT470_BG)
# setting color transfer (vs.TRANSFER_BT601), if it is not set.
if validate.transferIsInvalid(clip):
clip = core.std.SetFrameProps(clip=clip, _Transfer=vs.TRANSFER_BT601)
# setting color primaries info (to vs.PRIMARIES_BT470_BG), if it is not set.
if validate.primariesIsInvalid(clip):
clip = core.std.SetFrameProps(clip=clip, _Primaries=vs.PRIMARIES_BT470_BG)
# setting color range to TV (limited) range.
clip = core.std.SetFrameProps(clip=clip, _ColorRange=vs.RANGE_LIMITED)
# making sure frame rate is set to 25fps
clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
# making sure the detected scan type is set (detected: top field first)
clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_TOP) # tff
original = clip
# Deinterlacing using QTGMC
clip = qtgmc.QTGMC(Input=clip, Preset="Faster", TFF=True) # new fps: 50
# Making sure content is preceived as frame based
clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # progressive
# Deinterlacing using QTGMC
original = qtgmc.QTGMC(Input=original, Preset="Faster", TFF=True) # new fps: 50
# Making sure content is preceived as frame based
original = core.std.SetFrameProps(clip=original, _FieldBased=vs.FIELD_PROGRESSIVE) # progressive
# ColorMatrix: adjusting color matrix from 470bg to 709
clip = core.resize.Bicubic(clip=clip, matrix_in_s="470bg", matrix_s="709", range_in=1, range=1)
clip = core.std.Crop(clip=clip, left=20, right=24, top=4, bottom=8)# cropping to 676x564
original = core.std.Crop(clip=original, left=20, right=24, top=4, bottom=8)# cropping to 676x564
# Denoising using QTGMC
clip = qtgmc.QTGMC(Input=clip, Preset="Fast", InputType=1, TR2=1, SourceMatch=0, Lossless=0, EZDenoise=0.80, NoisePreset="Fast", Denoiser="KNLMeansCL")
# applying FineDeHalo to remove halos
clip = dehalo.FineDehalo(clip)
# resizing using NNEDI3CL
# current: 676x564 target: 1440x1080 -> pow: 4
clip = edi_rpow2.nnedi3cl_rpow2(clip=clip, rfactor=4, nsize=1, nns=4) # 2704x2256
# resizing 2704x2256 to 1440x1080
clip = core.fmtc.resample(clip=clip, w=1440, h=1080, kernel="lanczos", interlaced=False, interlacedd=False)# before YUV422P8 after YUV422P16
original = core.resize.Bicubic(clip=original, width=1440, height=1080)
# letterboxing 1440x1080 to 1920x1080
clip = core.std.AddBorders(clip=clip, left=240, right=240, top=0, bottom=0)
# letterboxing 1440x1080 to 1920x1080
original = core.std.AddBorders(clip=original, left=240, right=240, top=0, bottom=0)
# adjusting output color from: YUV422P8 to YUV422P10 for ProResModel
original = core.resize.Bicubic(clip=original, format=vs.YUV422P10, range_s="limited")
# adjusting output color from: YUV422P16 to YUV422P10 for ProResModel
clip = core.resize.Bicubic(clip=clip, format=vs.YUV422P10, range_s="limited", dither_type="error_diffusion")
original = core.text.Text(clip=original,text="Original",scale=2,alignment=7)
clip = core.text.Text(clip=clip,text="Filtered",scale=2,alignment=7)
stacked = core.std.StackHorizontal([original,clip])
# adjusted resizing to achieve PAR 1:1 for preview
# resizing for preview to square pixel to 3452x1080
stacked = core.resize.Bicubic(clip=stacked, width=3452, height=1080)
# set output frame rate to 50fps (progressive)
stacked = core.std.AssumeFPS(clip=stacked, fpsnum=50, fpsden=1)
# output
stacked.set_output()
And this is the log output:
2025-05-04 10:57:24.236
Failed to evaluate the script:
Python exception: expected 'else' after 'if' expression (dehalo.py, line 63)
Traceback (most recent call last):
File "src\\cython\\vapoursynth.pyx", line 3365, in vapoursynth._vpy_evaluate
File "src\\cython\\vapoursynth.pyx", line 3366, in vapoursynth._vpy_evaluate
File "C:\Users\Johan\AppData\Local\Temp\tempPreviewVapoursynthFile10_57_23_740.vpy", line 31, in
import dehalo
File "D:\Film\Hybrid\64bit\vsscripts\dehalo.py", line 63
so = so.vszip.Limiter() if hasattr(core,'vszip') so.std.Limiter()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: expected 'else' after 'if' expression