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 please
#31
that sample does not seem to have the flags it gets detected as bt460
# Imports
import sys
import os
import vapoursynth as vs
# getting Vapoursynth core
core = vs.core
# Limit frame cache to 48449MB
core.max_cache_size = 48449
# Import scripts folder
scriptPath = 'F:/Hybrid/64bit/vsscripts'
sys.path.insert(0, os.path.abspath(scriptPath))
# loading plugins
core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/fmtconv.dll")
core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/DGDecNV/DGDecodeNV_AVX2.dll")
# Import scripts
import validate
# Source: 'C:\Users\Selur\Desktop\selur sample.mkv'
# Current color space: YUV420P8, bit depth: 8, resolution: 700x476, frame rate: 23.976fps, scanorder: progressive, yuv luminance scale: limited, matrix: 470bg, format: AVC
# Loading 'C:\Users\Selur\Desktop\selur sample.mkv' using DGSource
clip = core.dgdecodenv.DGSource("J:/tmp/mkv_3361fb2859a06a1d0288f25dd3159329_853323747.dgi") # 23.976 fps, scanorder: progressive
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.
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
# adjusting output color from YUV420P8 to YUV420P10 for NVEncModel
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()

Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Reply
#32
well what else exactly as i supposed to do then? hybrid incorrectly flags it as 470bg, so i override the input to  smpte170m via Filterering/misc. then  i inserted before my very first filter, 

# matrix smpte170m
# transfer bt601
# primaries smpte170m
# colorrange limited
# colorformat YUV444P16
# width 700
# height 476

clip = core.std.CropRel(clip, left=10, top=0, right=10, bottom=4)
clip = core.fmtc.resample(clip, css="444", kernel="spline", taps=6)
clip = core.fmtc.bitdepth(clip, bits=16, dmode=3)
clip = core.std.SetFrameProps(clip, _Matrix=6, _Transfer=6, _Primaries=6, _ColorRange=1)


and then i tagged every other custom command with the same  (even though it never changed after)

# matrix smpte170m
# transfer bt601
# primaries smpte170m
# colorrange limited
# colorformat YUV444P16
# width 700
# height 476

You said i had to let hybrid know what was happening I DID

does this even matter? -vcodec png -dpi 0 -dpm 0 -pred 0 -vf zscale=matrixin=470bg:matrix=470bg,format=rgb48 -pix_fmt rgb48be? ots from the png tab? is is actually converting to 470bg?
Reply
#33
1. Uploaded a new dev with a 'quick-fix' which hopefully doesn't break anything else. (will also later look at whether changes in custom-sections are properly taken into account for the calculation of the output color matrix that is fed send to the encoder)
2. If the input is not properly detected, better use Filtering->Misc->Overwrite instead of custom-sections.

Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Reply
#34
I downloaded the latest dev build first thing first.  The overwrite input color matrix via Filtering/misc is set to SMPTE170m same as before   i loaded an episode  with no filter enabled, no custom scripts except 1 in before end, this is the generated script, 

# Imports
import sys
import os
import vapoursynth as vs
# getting Vapoursynth core
core = vs.core
# Import scripts folder
scriptPath = 'C:/Program Files/Hybrid/64bit/vsscripts'
sys.path.insert(0, os.path.abspath(scriptPath))
# loading plugins
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/DeinterlaceFilter/TIVTC/libtivtc.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/LSMASHSource.dll")
# defining beforeEnd-function - START
def beforeEnd(clip):
clip = core.text.FrameProps(clip)
clip.set_output()
return [clip]
# defining beforeEnd-function - END

# Import scripts
import validate
# Source: 'D:\Season 4 disk 1\A1_t00.mkv'
# Current color space: YUV420P8, bit depth: 8, resolution: 720x480, frame rate: 29.97fps, scanorder: bottom field first, yuv luminance scale: limited, matrix: 170m, format: mpeg-2
# Loading 'D:\Season 4 disk 1\A1_t00.mkvÄ using LWLibavSource
clip = core.lsmas.LWLibavSource(source="D:/Season 4 disk 1/A1_t00.mkv", format="YUV420P8", stream_index=0, cache=0, prefer_hw=0)
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_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.
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: bottom field first)
clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_BOTTOM) # scan type: bottom field first
# Deinterlacing using TIVTC
clip = core.tivtc.TFM(clip)
clip = core.tivtc.TDecimate(clip) # new fps: 23.976
# Making sure content is preceived as frame based
clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # scan type: progressive
[clip] = beforeEnd(clip)
# clip current meta; color space: YUV420P8, bit depth: 8, resolution: 720x480, fps: 23.976, color matrix: 170m, yuv luminance scale: limited, scanorder: progressive, full height: true
# 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: YUV420P8, bit depth: 8, resolution: 720x480, fps: 23.976, color matrix: 170m, yuv luminance scale: limited, scanorder: progressive, full height: true (Meta)
# script was created by Hybrid 2026.05.05.1

Yet in my preview windows i have this so the override does not work, regardless of what the script claims, I have 470bg colormatrix and primaries, 

https://ibb.co/Z0MSZ6N


Next  i added this at the top of my before end command, 

# matrix smpte170m
# transfer bt601
# primaries smpte170m
# colorrange limited        

and got this, 

https://ibb.co/R4YYtbPs
                    
lastly I added tthe actual command to force it,

# matrix smpte170m
# transfer bt601
# primaries smpte170m
# colorrange limited

clip = core.std.SetFrameProps(clip, _Matrix=6, _Transfer=6, _Primaries=6, _Range=1)
clip = core.text.FrameProps(clip)
clip.set_output()

https://ibb.co/Z1VPjqkK

As you can see the issue is not with customs commands, the override is broken. Also it would be nice to know the proper tag for SMPTE170m primaries, the tag alone didn't work  (pic 2). Hope this helps with your troubleshooting.........

O, and even with clip = core.std.SetFrameProps(clip, _Matrix=6, _Transfer=6, _Primaries=6, _Range=1) confirmed at the end of chain, and smpte170m override set hybrid still does this when output to png, -vcodec png -dpi 0 -dpm 0 -pred 0 -vf zscale=matrixin=470bg:matrix=470bg,format=rgb24 -pix_fmt rgb24
Reply
#35
# matrix smpte170m
# transfer bt601
# primaries smpte170m
# colorrange limited
vs. what the tool-tip sais:
Quote:Insert before:
Select the position the custom script addition should be inserted before.


In custom sections you can use:
- '# scantype <tff|bff|telecine|progressive>' to let Hybrid know that the scan type changed.
- '# colorformat <YUV420P8|...YUV444P16|RGB24|..|RGBS>' to let Hybrid know the color format changed.
-'# width <48-16384>' to let Hybrid know the width changed.
-'# height <48-16384>' to let Hybrid know the height changed.
-'# framerate <0.01-1000>' to let Hybrid know the frame rate changed.
-'# colormatrix <Rec.709|FCC|Rec.601/470bg/470m|..|Chroma cl>' to let Hybrid know the color matrix changed.
-'# requires mod <1-..>' to let Hybrid know the custom addition requires modX.
-'# requires colorformat <YUV420P8|...YUV444P16|RGB24|..|RGBS>' to let Hybrid know the custom addition requires a specific color format.
-'# requires colormatrix <Rec.709|FCC|Rec.601/470bg/470m|..|Chroma cl>' to let Hybrid know the custom addition requires a specific color matrix.

- '# additional output <variablename> [, colorformat: <Vapoursynth>][, width: <48-16384>][, height: <48-16384>][, fps: <0.01-1000>][, colormatrix: <Rec.709|FCC|Rec.601/470bg/470m|..|Chroma cl>][, yuvluminancescale: <limited|full>][, scanorder: <progressive|tff|bff|telecine>]' add an additional output with characteristics, all not specified characteristics will be copied from the current variable
Hybrid will also replace:
- %FILTERPATH% with the current filter base path
- %SCRIPTPATH% with the current script base path
- %INPUTFILE%" with the path to the current input
=>
0. use 'code'-tags
1. There is no way in Hybrid to change primaries and transform other than in the encoder settings, if the encoder has VUI parameters which support it.Hybrid does not change these in the script.
2. There is a bug in the handling, will try to look at it tomorrow after work
3. like I wrote use Filtering->Misc->Overwrite
4. Hybrid does not care about SetFrameProps


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


Forum Jump:


Users browsing this thread: 1 Guest(s)