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.

Error in Resize after after Lower Res.
#2
Think I fixed this a few days ago.
Using your steps, my dev version ends with 1920x820:
# Imports
import vapoursynth as vs
# getting Vapoursynth core
import ctypes
import os
import site
core = vs.core
# Adding torch dependencies to PATH
path = site.getsitepackages()[0]+'/torch_dependencies/bin/'
ctypes.windll.kernel32.SetDllDirectoryW(path)
path = path.replace('\\', '/')
os.environ["PATH"] = path + os.pathsep + os.environ["PATH"]
# Loading Plugins
core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/DGDecNV/DGDecodeNV.dll")
# source: 'G:\TestClips&Co\In_America_(2002).mkv'
# current color space: YUV420P8, bit depth: 8, resolution: 1920x1080, fps: 23.976, color matrix: 709, yuv luminance scale: limited, scanorder: progressive
# Loading G:\TestClips&Co\In_America_(2002).mkv using DGSource
clip = core.dgdecodenv.DGSource("J:/tmp/mkv_21c058149c797c35b163bbc419842782_853323747.dgi")# 23.976 fps, scanorder: progressive
# Setting detected color matrix (709).
clip = core.std.SetFrameProps(clip, _Matrix=1)
# Setting color transfer info (709), when it is not set
clip = clip if not core.text.FrameProps(clip,'_Transfer') else core.std.SetFrameProps(clip, _Transfer=1)
# Setting color primaries info (BT.709), when it is not set
clip = clip if not core.text.FrameProps(clip,'_Primaries') else core.std.SetFrameProps(clip, _Primaries=1)
# Setting color range to TV (limited) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
# making sure frame rate is set to 23.976
clip = core.std.AssumeFPS(clip=clip, fpsnum=24000, fpsden=1001)
clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=0) # progressive
clip = core.std.CropRel(clip=clip, left=0, right=0, top=130, bottom=130)# cropping to 1920x820
# adjusting resolution before resizing
clip = core.fmtc.resample(clip=clip, w=960, h=410, kernel="lanczos", interlaced=False, interlacedd=False)# before YUV420P8 after YUV420P16
from vsrealesrgan import realesrgan as RealESRGAN
clip = core.std.AddBorders(clip=clip, left=0, right=0, top=0, bottom=2) # add borders to archive mod 4 (vsRealESRGAN) - 960x412
# adjusting color space from YUV420P16 to RGBS for vsRealESRGAN
clip = core.resize.Bicubic(clip=clip, format=vs.RGBS, matrix_in_s="709", range_s="limited")
# resizing using RealESRGAN
clip = RealESRGAN(clip=clip, model=5, device_index=0) # 3840x1648
# resizing 3840x1648 to 1920x820
clip = core.std.CropRel(clip=clip, left=0, right=0, top=0, bottom=8) # removing borders (vsRealESRGAN) -  3840x1640
# adjusting resizing
clip = core.fmtc.resample(clip=clip, w=1920, h=820, kernel="spline64", interlaced=False, interlacedd=False)
# adjusting output color from: RGBS to YUV420P8 for x264Model
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P8, matrix_s="709", range_s="limited", dither_type="error_diffusion")
# set output frame rate to 23.976fps (progressive)
clip = core.std.AssumeFPS(clip=clip, fpsnum=24000, fpsden=1001)
# Output
clip.set_output()
=> will send you a link to my current dev via pm.

Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Reply


Messages In This Thread
RE: Error in Resize after after Lower Res. - by Selur - 18.10.2023, 19:43

Forum Jump:


Users browsing this thread: 1 Guest(s)