![]() |
|
VS preview error with smdegrain refine motion, block & overlap size, and color format - 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: VS preview error with smdegrain refine motion, block & overlap size, and color format (/thread-4502.html) |
VS preview error with smdegrain refine motion, block & overlap size, and color format - andrewschen - 03.10.2026 In SMDegrain, there are certain combinations of refine motion, block & overlap size, and color format which cause error in VS preview. Are they bugs, or supposed so? In Hybrid_dev_2026.06.25-152245 (old version of SMDegrain): YUV410p8, YUV411p8: always error refine motion on + overlap size 2 + YUV ( != 444 ) : error Not happening in refine motion off / overlap size != 2 / YUV444&GRAY In Hybrid_dev_2026.10.02-19438: YUV410p8, YUV411p8: always error and in other situation, if YUV ( != 444 ), these combination will cause error: refine motion 1/2/3 pass + size(block,overlap) = (32,2) refine motion 2/3/4 pass + size(block,overlap) = (64,4) sample code & error output: refine motion 1 pass + size(block,overlap) = (32,2) # Imports
import sys
import os
import vapoursynth as vs
# using Vapoursynth R79
# getting Vapoursynth core
core = vs.core
# Import scripts folder
scriptPath = 'D:/APPD/Hybrid_dev_20261002-19438/64bit/vsscripts'
sys.path.insert(0, os.path.abspath(scriptPath))
# loading plugins
core.std.LoadPlugin(path="D:/APPD/Hybrid_dev_20261002-19438/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/akarin/libakarin.dll")
core.std.LoadPlugin(path="D:/APPD/Hybrid_dev_20261002-19438/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/mvutensils/mvutensils.dll")
core.std.LoadPlugin(path="D:/APPD/Hybrid_dev_20261002-19438/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/fmtconv.dll")
core.std.LoadPlugin(path="D:/APPD/Hybrid_dev_20261002-19438/64bit/vsfilters/SourceFilter/LSmashSource/LSMASHSource.dll")
# Import scripts
import nnedi3_resample
import smdegrain
import validate
# Source: 'C:\Users\mmddffkk\Desktop\tmp\SAMPLE.mkv'
# clip current meta; color space: YUV420P8, bit depth: 8, resolution: 1920x1080, fps: 23.976, color matrix: 709, color primaries: Unspecific, color transfer: Unspecified, yuv luminance scale: limited, scanorder: progressive, full height: true (Source)
# Loading 'C:\Users\mmddffkk\Desktop\tmp\SAMPLE.mkv' using LWLibavSource
clip = core.lsmas.LWLibavSource(source="C:/Users/mmddffkk/Desktop/tmp/SAMPLE.mkv", format="YUV420P8", stream_index=0, cache=0, prefer_hw=0)
frame = clip.get_frame(0)
# setting color matrix to 709.
clip = core.std.SetFrameProps(clip, _Matrix=vs.MATRIX_BT709)
# setting color transfer (vs.TRANSFER_BT709), if it is not set.
if validate.transferIsInvalid(clip):
clip = core.std.SetFrameProps(clip=clip, _Transfer=vs.TRANSFER_BT709)
# setting color primaries info (to vs.PRIMARIES_BT709), if it is not set.
if validate.primariesIsInvalid(clip):
clip = core.std.SetFrameProps(clip=clip, _Primaries=vs.PRIMARIES_BT709)
# setting color range to TV (limited) range.
prop_name = '_Range' if core.core_version.release_major >= 74 else '_ColorRange'
clip = core.std.SetFrameProps(clip=clip, **{prop_name: vs.RANGE_LIMITED})
# making sure frame rate is set to 23.976fps
clip = core.std.AssumeFPS(clip=clip, fpsnum=24000, fpsden=1001)
# making sure the detected scan type is set (detected: progressive)
clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # scan type: progressive
# removing grain using SMDegrain
clip = smdegrain.SMDegrain(clip, RefineMotion=1, interlaced=False, overlap=2, blksize=32, thSCD1=1600, tools={'mv': 'mvutensils', 'expr': 'akarin', 'nnedi3': 'znedi3', 'dfttest': 'dfttest', 'nlmeans': 'nlm_ispc', 'bm3d': 'bm3d', 'rg': 'zsmooth', 'median': 'zsmooth', 'boxblur': 'std', 'scd': 'std'})
# adjusting output color from YUV420P8 to YUV420P10 for SvtAv1Model
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10)
# set output frame rate to 23.976fps (progressive)
clip = core.std.AssumeFPS(clip=clip, fpsnum=24000, fpsden=1001)
# output
clip.set_output()
# clip current meta; color space: YUV420P10, bit depth: 10, resolution: 1920x1080, fps: 23.976, color matrix: 709, color primaries: Unspecific, color transfer: Unspecified, yuv luminance scale: limited, scanorder: progressive, full height: true (Meta)
# script was created by Hybrid 2026.10.02.1Failed to evaluate the script:
Python exception: Degrain: Degrain2: Failed to retrieve first frame from super clip. Error message: Recalculate: The chosen block size has no multiple that will process the entire frame without exceeding the super clip padding, derive a new suitable super clip and try again
Traceback (most recent call last):
File "vapoursynth.pyx", line 3832, in vapoursynth._vpy_evaluate
File "vapoursynth.pyx", line 3833, in vapoursynth._vpy_evaluate
File "\\fx705d\ENCTMP\tempPreviewVapoursynthFile02_48_22_671.vpy", line 41, in
clip = smdegrain.SMDegrain(clip, RefineMotion=1, interlaced=False, overlap=2, blksize=32, thSCD1=1600, tools={'mv': 'mvutensils', 'expr': 'akarin', 'nnedi3': 'znedi3', 'dfttest': 'dfttest', 'nlmeans': 'nlm_ispc', 'bm3d': 'bm3d', 'rg': 'zsmooth', 'median': 'zsmooth', 'boxblur': 'std', 'scd': 'std'})
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\APPD\Hybrid_dev_20261002-19438\64bit\vsscripts\smdegrain.py", line 259, in SMDegrain
output = MV.Degrain(mfilter, super_render, *vectors, thsad=thSAD, thsadc=thSADC, plane=plane, limit=limit, limitc=limitc, thscd1=thSCD1, thscd2=thSCD2,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\APPD\Hybrid_dev_20261002-19438\64bit\vsscripts\misc.py", line 1410, in Degrain
return self._degrain(clip, super, *vectors, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\APPD\Hybrid_dev_20261002-19438\64bit\vsscripts\misc.py", line 1352, in _degrain
return core.mvu.Degrain(clip, super, vec_list, limit=mvu_limit, **weight_args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "vapoursynth.pyx", line 3559, in vapoursynth.Function.__call__
vapoursynth.Error: Degrain: Degrain2: Failed to retrieve first frame from super clip. Error message: Recalculate: The chosen block size has no multiple that will process the entire frame without exceeding the super clip padding, derive a new suitable super clip and try againRE: VS preview error with smdegrain refine motion, block & overlap size, and color format - Selur - 03.10.2026 YUV410p8, YUV411p8: always errorSeems like I need to add some padding when mvutensils is used. As a workaround you can set SMDegrain->Tools->MV to MV. From what I can see, this is not a bug, but a limitation of mvutensils which I was not aware of. => I'll look at it tomorrow and think of a general workaround. (my guess is that this might also happen in some other filters) Cu Selur RE: VS preview error with smdegrain refine motion, block & overlap size, and color format - Selur - 03.10.2026 Replacing the files in Hybrid\64bit\vsscripts with the latest from https://github.com/Selur/VapoursynthScriptsInHybrid should fix the problem. (will release new dev version with this tomorrow) Cu Selur |