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.

vapoursynth.Error: StackHorizontal
#1
When I try enable resize the input file 720:480 to 820:548 and prees preview button - appears error:

Quote:vapoursynth.Error: StackHorizontal: clip format and height must match


Attached Files
.zip   HybridDebugOutput.zip (Size: 27,92 KB / Downloads: 14)
Reply
#2
MediaInfo reported the source as:
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Hybrid remembered:
video_colorspace: YUV
video_color: 4:2:0
Vapoursynth script used:
# Imports
import vapoursynth as vs
# getting Vapoursynth core
import sys
import os
core = vs.core
# Import scripts folder
scriptPath = 'D:/!_System/Hybrid/64bit/vsscripts'
sys.path.insert(0, os.path.abspath(scriptPath))
# loading plugins
core.std.LoadPlugin(path="D:/!_System/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
core.std.LoadPlugin(path="D:/!_System/Hybrid/64bit/vsfilters/SourceFilter/AviSource/avisource.dll")
# Import scripts
import validate
# Source: 'L:\!_convert\1\2007.avi'
# Current color space: YUV420P8, bit depth: 8, resolution: 720x480, frame rate: 30fps, scanorder: progressive, yuv luminance scale: limited, matrix: 470bg
# Loading L:\!_convert\1\2007.avi using VsAviSource
clip = core.avisource.AVISource(path="L:/!_convert/1/2007.avi")
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 30fps
clip = core.std.AssumeFPS(clip=clip, fpsnum=30, fpsden=1)
# making sure the detected scan type is set (detected: progressive)
clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # progressive
original = clip
from vsrealesrgan import realesrgan as RealESRGAN
# adjusting color space from YUV420P8 to RGBS for vsRealESRGAN
clip = core.resize.Bicubic(clip=clip, format=vs.RGBS, matrix_in_s="470bg", range_s="limited")
# resizing using RealESRGAN
clip = RealESRGAN(clip=clip, model=5, device_index=0) # 2880x1920
# resizing 2880x1920 to 820x548
# adjusting resizing
clip = core.fmtc.resample(clip=clip, w=820, h=548, kernel="spline64", interlaced=False, interlacedd=False)
original = core.resize.Bicubic(clip=original, width=820, height=548)
# adjusting output color from: RGBS to YUV420P8 for FFV1Model
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P8, matrix_s="470bg", range_s="limited", dither_type="error_diffusion")
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])
# set output frame rate to 30fps (progressive)
stacked = core.std.AssumeFPS(clip=stacked, fpsnum=30, fpsden=1)
# output
stacked.set_output()
Original should be YUV420P8 which got resized to width=820, height=548
original = core.resize.Bicubic(clip=original, width=820, height=548)
Filtered clip was YUV420P8 which got converted to RGBS for RealESRGAN,
clip = core.resize.Bicubic(clip=clip, format=vs.RGBS, matrix_in_s="470bg", range_s="limited")
then downscaled to 820x548
clip = core.fmtc.resample(clip=clip, w=820, h=548, kernel="spline64", interlaced=False, interlacedd=False)
and converted to YUV420P:
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P8, matrix_s="470bg", range_s="limited", dither_type="error_diffusion")
at:
stacked = core.std.StackHorizontal([original,clip])
both clips should be YUV420P and 820x548, Vapoursyth complains about:
S t a c k H o r i z o n t a l :   c l i p   f o r m a t   a n d   h e i g h t   m u s t   m a t c h

From what I see, everything Hybrid does is correct.
My guess atm. is that the AviSource source filter does not output YUV420P8, but something other.
Would need a small sample of the source, which also causes the problem to look into it.
Does it also happen when not using AviSource?

Cu Selur
Reply
#3
source

Quote:Does it also happen when not using AviSource?

It's the same in both options.
Reply
#4
I can reproduce the problem, looking into it.
Reply
#5
AviSource, outputs: YUV422P8 and since Hybrid detects that the vfw decoder is available it uses for UT-Video AviSource.

So to be clear, this is not a bug in Hybrid, but either a bug in:
  • MediaInfo for reporting the wrong color sampling, or
  • UT Video for not signaling the correct color sampling, or
  • the vfw decoder returning the wrong color sampling.
Argh.
As a workaround, I added a new option: 'Never use AviSource'.

Enabling it will cause Hybrid to not use AviSource and using BestSource or LWLibAVSource works fine here.
(In general, I would not recommend enabling this, but it should help with your problem.)

=> uploaded a new dev with the new option.

Cu Selur
Reply
#6
Thank you, now working!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)