This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

[HELP] Input resolution not divisible error
#1
Question 
Hello, I've ran into an issue with my first SD NTSC capture: AJA's ControlRoom produces 486px (vertical) file, but VapourSynth crashes with division error

Error message:
File "src\\cython\\vapoursynth.pyx", line 3123, in vapoursynth.Function.__call__
vapoursynth.Error: Analyse: failed to retrieve first frame from super clip. Error message: Resize error 1027: image dimensions must be divisible by subsampling factor

What was done: I've inserted # requires mod 2 before QTGMC. Same behavior, but padding is visible in the generated .vpy script 

A snippet from .vpy generated script:
# Current color space: YUV422P10, bit depth: 10, resolution: 720x486, frame rate: 29.97fps, scanorder: top field first, yuv luminance scale: limited, matrix: 170m, transfer: bt.709, primaries: bt.601 ntsc, format: prores
# Loading I:\kseniya_tape1_ntsc.mov using BestSource)
clip = core.bs.VideoSource(source="I:/kseniya_tape1_ntsc.mov", cachepath="I:/TEMP/kseniya_tape1_ntsc_bestSource", track=0, hwdevice="cuda")
frame = clip.get_frame(0)
# setting color matrix to 170m.
clip = core.std.SetFrameProps(clip, _Matrix=vs.MATRIX_ST170_M)
# 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_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 29.97fps
clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001)
# Converting to target color sampling
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P8, dither_type="error_diffusion")
# 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
# adjusting color format to YUV422P8 for custom section
clip = core.resize.Bicubic(clip=clip, format=vs.YUV422P8)
[clip] = beforeDeinterlace(clip)
# clip current meta; color space: YUV422P8, bit depth: 8, resolution: 720x486, fps: 29.97, color matrix: 170m, yuv luminance scale: limited, scanorder: top field first, full height: true
clip = core.std.AddBorders(clip=clip, left=0, right=0, top=0, bottom=2) # add borders to archive mod 4 (vsQTGMC) - 720x488
# Deinterlacing using QTGMC
clip = qtgmc.QTGMC(Input=clip, Preset="Medium", InputType=0, TFF=True, TR2=0, SourceMatch=1, Lossless=0, opencl=True) # new fps: 59.94
clip = core.std.Crop(clip=clip, left=0, right=0, top=0, bottom=2) # removing added borders from mod requirement (vsQTGMC) - 720x486
# Making sure content is preceived as frame based
clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # progressive
original = core.std.AddBorders(clip=original, left=0, right=0, top=0, bottom=2) # add borders to archive mod 4 (vsQTGMC) - 720x488
# Deinterlacing using QTGMC
original = qtgmc.QTGMC(original, Preset="Fast", TFF=True, opencl=True)# new fps: 59.94
original = core.std.Crop(clip=original, left=0, right=0, top=0, bottom=2) # removing added borders from mod requirement (vsQTGMC) - 720x486
# Making sure content is preceived as frame based
original = core.std.SetFrameProps(clip=original, _FieldBased=vs.FIELD_PROGRESSIVE) # progressive
# adjusting output color from: YUV422P8 to YUV420P8 for NVEncModel
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P8)
# add histogram
clip = core.hist.Classic(clip)
original = core.hist.Classic(original)
original = core.text.Text(clip=original,text="Original",scale=1,alignment=7)
clip = core.text.Text(clip=clip,text="Filtered",scale=1,alignment=7)
stacked = core.std.StackHorizontal([original,clip])
# adjusted resizing to achieve PAR 1:1 for preview
# resizing for preview to square pixel to 1310x742
stacked = core.resize.Bicubic(clip=stacked, width=1310, height=742)
# set output frame rate to 59.94fps (progressive)
stacked = core.std.AssumeFPS(clip=stacked, fpsnum=60000, fpsden=1001)

Hybrid 2025.11.09.1 was used, I've never ran into such issue before
Reply
#2
Quote:File "src\\cython\\vapoursynth.pyx", line 3123, in vapoursynth.Function.__call__
vapoursynth.Error: Analyse: failed to retrieve first frame from super clip. Error message: Resize error 1027: image dimensions must be divisible by subsampling factor
that makes sense.
Content has a resolution of 720x486, so divided by into the two fields each has 720x243.

[clip] = beforeDeinterlace(clip)
# clip current meta; color space: YUV422P8, bit depth: 8, resolution: 720x486, fps: 29.97, color matrix: 170m, yuv luminance scale: limited, scanorder: top field first, full

Quote:I've inserted # requires mod 2 before QTGMC. Same behavior, but padding is visible in the generated .vpy script
This should have no effect, since the input (720x486) already is mod2.
[clip] = beforeDeinterlace(clip)
# clip current meta; color space: YUV422P8, bit depth: 8, resolution: 720x486, fps: 29.97, color matrix: 170m, yuv luminance scale: limited, scanorder: top field first, full height: true
Does indicate that nothing was done,.. resolution didn't change

clip = core.std.AddBorders(clip=clip, left=0, right=0, top=0, bottom=2) # add borders to archive mod 4 (vsQTGMC) - 720x488
# Deinterlacing using QTGMC
clip = qtgmc.QTGMC(Input=clip, Preset="Medium", InputType=0, TFF=True, TR2=0, SourceMatch=1, Lossless=0, opencl=True) # new fps: 59.94
clip = core.std.Crop(clip=clip, left=0, right=0, top=0, bottom=2) # removing added borders from mod requirement (vsQTGMC) - 720x486
should work,...
argh,.. mvtools internally does 3 divisions,..

I probably always force mod16, just to be same => looking into it

Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Reply
#3
Yeah, writing "requires mod 2" was silly... Anyway, mod 16 doesn't work either: for some reason QTGMC works with initial clip resolution instead of padded one
clip = core.std.AddBorders(clip=clip, left=0, right=0, top=0, bottom=10) # add borders to archive mod 16 for custom section - 720x496
# adjusting color format to YUV422P8 for custom section
clip = core.resize.Bicubic(clip=clip, format=vs.YUV422P8)
[clip] = beforeDeinterlace(clip)
clip = core.std.CropRel(clip=clip, left=0, right=0, top=0, bottom=10) # removing borders for custom section - 720x486
# clip current meta; color space: YUV422P8, bit depth: 8, resolution: 720x486, fps: 29.97, color matrix: 170m, yuv luminance scale: limited, scanorder: top field first, full height: true
clip = core.std.AddBorders(clip=clip, left=0, right=0, top=0, bottom=2) # add borders to archive mod 4 (vsQTGMC) - 720x488
# Deinterlacing using QTGMC
clip = qtgmc.QTGMC(Input=clip, Preset="Medium", InputType=0, TFF=True, TR2=0, SourceMatch=1, Lossless=0, opencl=True) # new fps: 59.94
clip = core.std.Crop(clip=clip, left=0, right=0, top=0, bottom=2) # removing added borders from mod requirement (vsQTGMC) - 720x486
Reply
#4
clip = core.std.AddBorders(clip=clip, left=0, right=0, top=0, bottom=10) # add borders to archive mod 16 for custom section - 720x496
# adjusting color format to YUV422P8 for custom section
clip = core.resize.Bicubic(clip=clip, format=vs.YUV422P8)
[clip] = beforeDeinterlace(clip)
clip = core.std.CropRel(clip=clip, left=0, right=0, top=0, bottom=10) # removing borders for custom section - 720x486
Ahh, Hybrid does automatically remove the mod requirement, so adding '# require mod XY' in a custom section only influences that section.

Now I don't get what you did to run into your error at all.
=>
1. Share a short sample or your source.
2. Share a step-by-step on how to reproduce the problem.

Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Reply
#5
Sample
Steps to reproduce:
1. Import footage
2. Try to run any preview/start processing

I'm skeptical that QTGMC's settings are somehow influencing the outcome, but that's what I used:
clip = qtgmc.QTGMC(Input=clip, Preset="Medium", InputType=0, TFF=True, TR2=0, SourceMatch=1, Lossless=0, opencl=True)

Video
ID                          : 1
Format                      : ProRes
Format version              : Version 0
Format profile              : 422
Codec ID                    : apcn
Duration                    : 51 s 433 ms
Source duration            : 51 s 418 ms
Bit rate mode              : Constant
Bit rate                    : 47.1 Mb/s
Width                      : 720 pixels
Clean aperture width        : 704 pixels
Height                      : 486 pixels
Clean aperture height      : 480 pixels
Display aspect ratio        : 4:3
Clean aperture display aspe : 4:3
Frame rate mode            : Constant
Frame rate                  : 29.970 (30000/1001) FPS
Standard                    : NTSC
Color space                : YUV
Chroma subsampling          : 4:2:2
Scan type                  : Interlaced
Scan type, store method    : Interleaved fields
Scan order                  : Bottom Field First
Bits/(Pixel*Frame)          : 4.495
Stream size                : 289 MiB (97%)
Source stream size          : 289 MiB (97%)
Writing library            : AJA Kona Hardware
Language                    : English
Encoded date                : 2026-04-29 21:54:47 UTC
Tagged date                : 2026-04-29 21:54:47 UTC
Color primaries            : BT.601 NTSC
Transfer characteristics    : BT.709
Matrix coefficients        : BT.601
Reply
#6
Using:
clip = qtgmc.QTGMC(Input=clip, Preset="Medium", InputType=0, TFF=True, TR2=0, SourceMatch=1, Lossless=0, opencl=True)
Creates:
core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/libbestsource.dll")
# Import scripts
import qtgmc
import validate
# Source: 'C:\Users\Selur\Desktop\ntsc_sample_486px.mov'
# Current color space: YUV422P10, bit depth: 10, resolution: 720x486, frame rate: 29.97fps, scanorder: top field first, yuv luminance scale: limited, matrix: 170m, transfer: bt.709, primaries: bt.601 ntsc, format: prores
# Loading 'C:\Users\Selur\Desktop\ntsc_sample_486px.mov' using BestSource
clip = core.bs.VideoSource(source="C:/Users/Selur/Desktop/ntsc_sample_486px.mov", cachepath="J:/tmp/ntsc_sample_486px_bestSource", track=0, hwdevice="opencl")
frame = clip.get_frame(0)
# setting color matrix to 170m.
clip = core.std.SetFrameProps(clip, _Matrix=vs.MATRIX_ST170_M)
# 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_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.
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 29.97fps
clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001)
# making sure the detected scan type is set (detected: top field first)
clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_TOP) # scan type: top field first
# Deinterlacing using QTGMC
clip = qtgmc.QTGMC(Input=clip, Preset="Medium", InputType=0, TFF=True, TR2=0, SourceMatch=1, Lossless=0, opencl=True) # new fps: 59.94
# Making sure content is preceived as frame based
clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # scan type: progressive
# adjusting output color from YUV422P10 to YUV420P10 for NVEncModel
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10)
# set output frame rate to 59.94fps (progressive)
clip = core.std.AssumeFPS(clip=clip, fpsnum=60000, fpsden=1001)
# output
clip.set_output()
for me.
and preview works fine.
Can't reproduce this with the dev I use.
=> Uploaded a new dev which is the version I use atm., if it still crashes for you with that version provide a DebugOutput.

Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Reply
#7
Welp, it seems I broke something (again) Big Grin 

Btw, why does Hybrid converts 4:2:2 to 4:2:0 before deinterlacing? No crop/resize was active. It shouldn't mess with color (in theory), but looks strange
# Converting to target color sampling
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P8, dither_type="error_diffusion")
# making sure the detected scan type is set (detected: top field first)
clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_TOP) # scan type: top field first
# adjusting color format to YUV422P8 for custom section
clip = core.resize.Bicubic(clip=clip, format=vs.YUV422P8)
[clip] = beforeDeinterlace(clip)

Debug output
Reply
#8
Python exception: Analyse: failed to retrieve first frame from super clip. Error message: Resize error 1027: image dimensions must be divisible by subsampling factor

Traceback (most recent call last):
  File "vapoursynth.pyx", line 3524, in vapoursynth._vpy_evaluate
  File "vapoursynth.pyx", line 3525, in vapoursynth._vpy_evaluate
  File "I:\TEMP\tempPreviewVapoursynthFile16_23_42_262.vpy", line 63, in <module>
    clip = qtgmc.QTGMC(Input=clip, Preset="Medium", InputType=0, TFF=True, TR2=0, SourceMatch=1, Lossless=0, opencl=True) # new fps: 59.94
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Hybrid\64bit\vsscripts\qtgmc.py", line 720, in QTGMC
    bVec1 = srchSuper.mv.Analyse(isb=True, delta=1, **analyse_args)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "vapoursynth.pyx", line 3260, in vapoursynth.Function.__call__
vapoursynth.Error: Analyse: failed to retrieve first frame from super clip. Error message: Resize error 1027: image dimensions must be divisible by subsampling factor
seems like it's still broken.
No clue, why this does not happen here,..

will look at it after some sleep.

Quote:Btw, why does Hybrid converts 4:2:2 to 4:2:0 before deinterlacing?
Write a step-by-step which allows to reproduce this.
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Reply
#9
Only way I get:
# Converting to target color sampling
is when I explicitly enable 'Convert to target color space after source filter'.
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Reply
#10
(03.05.2026, 02:46)Selur Wrote: Only way I get:
# Converting to target color sampling
is when I explicitly enable 'Convert to target color space after source filter'.

Just uploaded a quick walk-through my current settings

That last Debug file should have almost exact settings (aside from mod). As you can see, no resize or chroma subsampling transforms are used explicitly and yet it tries to convert 422->420 (at least with proper field-based tag)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)