Posts: 208
Threads: 66
Joined: Apr 2019
16.10.2020, 21:59
Using Hybrid Dev version 2020.10.15.1.
Do a VapourSynth Levels filter for a RGB24 png image. (I attached the one I used in the below image, but I've tested it and the problem affects any image stream I've tried so far.)
Turn the Levels filter on for VapourSynth, no need to even adjust anything.
The script inserts some really strange numbers into the in/out levels, and the preview turns to weird hallucination colors.
This appears to only affect image stream input.
[attachment=1063]
Posts: 10.981
Threads: 57
Joined: May 2017
I see the problem.
Due to some bug Hybrid assumes a 'bit depth' of 24bit for the input and it also identifies the image as RGB32.
Strange thing is that when I open the attached image here it's detected as:
# current color space: RGB24, bit depth: 8, resolution: 1440x1080, fps: 25, color matrix: 709, yuv luminance scale: full, scanorder: progressive
and thus the whole script looks fine:
# Imports
import vapoursynth as vs
core = vs.get_core()
# source: 'C:/Users/Selur/Desktop/Test-AdobeRGB.png'
# current color space: RGB24, bit depth: 8, resolution: 1440x1080, fps: 25, color matrix: 709, yuv luminance scale: full, scanorder: progressive
# Loading C:\Users\Selur\Desktop\Test-AdobeRGB.png using vsImageReader
clip = core.imwri.Read(["C:/Users/Selur/Desktop/Test-AdobeRGB.png"])
clip = core.std.Loop(clip=clip, times=100)
# Input color space is assumed to be RGB24.
# making sure frame rate is set to 25
clip = core.std.AssumeFPS(clip, fpsnum=25, fpsden=1)
# Setting color range to PC (full) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=0)
# Color Adjustment
clip = core.std.Limiter(clip=clip, min=0, max=255)
# adjusting output color from: RGB24 to YUV420P8 for x264Model (i420@8-bit)
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P8, matrix_s="709", range_s="full")
# Output
clip.set_output()
Got it, seems like I fixed that yesterday after uploading the dev version.
-> will send you a new link in ~1/2 hour.
Cu Selur
Posts: 785
Threads: 16
Joined: Mar 2020
Seems there is also a problem that 16 bit RGB image imported to Hybrid incorrectly processed as 8 bit RGB24
# Imports
import vapoursynth as vs
core = vs.get_core()
# loading source: /Users/shph/Desktop/No name.tif
# color sampling RGB24@16, matrix:709, scantyp: progressive
# luminance scale PC
# resolution: 800x600
# frame rate: -1 fps
# Loading /Users/shph/Desktop/No name.tif using vsImageReader
clip = core.imwri.Read(["/Users/shph/Desktop/No name.tif"])
clip = core.std.Loop(clip=clip, times=100)
# Input color space is assumed to be RGB24.
# making sure frame rate is set to 25
clip = core.std.AssumeFPS(clip, fpsnum=25, fpsden=1)
# Setting color range to PC (full) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=0)
# adjusting output color from: RGB24 to YUV422P10 for ProResModel (i422)
clip = core.resize.Bicubic(clip=clip, format=vs.YUV422P10, matrix_s="709", range_s="full")
# Output
clip.set_output()
Posts: 785
Threads: 16
Joined: Mar 2020
And here is how it looks if i apply Levels to 16 bit image. min_in=4096, max_in=60160 are correct numbers for 16 bit but it should detect it as RGB48 instead of RGB24
# Imports
import vapoursynth as vs
core = vs.get_core()
# loading source: /Users/shph/Desktop/No name.tif
# color sampling RGB24@16, matrix:709, scantyp: progressive
# luminance scale PC
# resolution: 800x600
# frame rate: 25 fps
# Loading /Users/shph/Desktop/No name.tif using vsImageReader
clip = core.imwri.Read(["/Users/shph/Desktop/No name.tif"])
clip = core.std.Loop(clip=clip, times=100)
# Input color space is assumed to be RGB24.
# making sure frame rate is set to 25
clip = core.std.AssumeFPS(clip, fpsnum=25, fpsden=1)
# Setting color range to PC (full) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=0)
# Color Adjustment
clip = core.std.Levels(clip=clip, min_in=4096, max_in=60160, min_out=4096, max_out=60160)
# adjusting output color from: RGB24 to YUV422P10 for ProResModel (i422)
clip = core.resize.Bicubic(clip=clip, format=vs.YUV422P10, matrix_s="709", range_s="full")
# Output
clip.set_output()
Same problem with 32 bit imported image:
# Imports
import vapoursynth as vs
core = vs.get_core()
# loading source: /Users/shph/Desktop/No name 32bit.tif
# color sampling RGB32@32, matrix:709, scantyp: progressive
# luminance scale PC
# resolution: 800x600
# frame rate: 25 fps
# Loading /Users/shph/Desktop/No name 32bit.tif using vsImageReader
clip = core.imwri.Read(["/Users/shph/Desktop/No name 32bit.tif"])
clip = core.std.Loop(clip=clip, times=100)
# Input color space is assumed to be RGB24.
# making sure frame rate is set to 25
clip = core.std.AssumeFPS(clip, fpsnum=25, fpsden=1)
# Setting color range to PC (full) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=0)
# Color Adjustment
clip = core.std.Levels(clip=clip, min_in=268435456, max_in=-352321536, min_out=268435456, max_out=-352321536)
# adjusting output color from: RGB24 to YUV422P10 for ProResModel (i422)
clip = core.resize.Bicubic(clip=clip, format=vs.YUV422P10, matrix_s="709", range_s="full")
# Output
clip.set_output()
Also seems it depends of file format:
8 bit JPEG and TIFF image detected by Levels correctly: "min_in=16, max_in=235"
8 bit PNG image detected by Levels incorrectly: "min_in=1048576, max_in=15400960"
Posts: 10.981
Threads: 57
Joined: May 2017
can you share example images?
Posts: 785
Threads: 16
Joined: Mar 2020
Here are updated test images with different bit depth.
Posts: 10.981
Threads: 57
Joined: May 2017
17.10.2020, 08:07
(This post was last modified: 17.10.2020, 08:15 by Selur.)
32bit png should be RGB 24bit + 8bit alpha, right?
Vapoursynth supports the following color spaces:
RGB24 = 8bit per component
RGB27 = 9bit per component
RGB30 = 10bit per component
RGB48 = 16bit per component
RGBH = float half percision
RGBS = single precision
COMPATBGR32 = no clue
Question is how should Hybrid map color types of images?
Posts: 785
Threads: 16
Joined: Mar 2020
Not sure how to generate PNG 32-bit. When i try to export PNG as 32 bit from image editor it give me message: "Images with unsupported bit depth"
For images only need:
RGB24 = 8bit per component
RGB48 = 16bit per component
RGBS = single precision (probably used for 32 bit TIFF file)
Posts: 10.981
Threads: 57
Joined: May 2017
17.10.2020, 08:25
(This post was last modified: 17.10.2020, 08:25 by Selur.)
I don't think Hybrid can support 32 bit PNGs or TIFFs since I have no clue which color space to map them in Vapoursynth.
Name | MediaInfo | Vapoursynth
TIFF 8-bit | RGB 8-bit | RGB24
TIFF 16-bit | RGB 16-bit | RGB48
TIFF 32-bit | RGB 32-bit | RGBS
PNG 8-bit | RGB 8-bit | RGB24
PNG 16-bit | RGB 16-bit | RGB48
JPEG 8-bit | 4:2:0 8-bit | YUV420P8
PNG 32-bit | RGB 32-bit | ??? (RGBS?)
Okay, I can adjust Hybrid to this,..
Posts: 785
Threads: 16
Joined: Mar 2020
JPEG may be different depending of settings. If enable high quality at export Jpeg became 444. Hybrid can detect 420 and 444 JPEG. Not sure why it detects JPEG as YUV444P8@8 and same time other image formats as RGB24@8. Maybe JPEG is somehow special...
In most cases "high quality" is always enabled in JPEG. Seems i just uncheck it by accident when exported test image.
Have no any idea about how 32-bit PNG works.
|