23.07.2020, 04:46
Pages: 1 2
23.07.2020, 16:55
Problem is your input isn't TV scale but PC scale.
So you need to use 'pc' scale when in the Imagesequence dialog and the colors stay the same while converting between RGB and YUV.
So the script used by Hybrid:
for the conversion should be correct.
I attached the source frame and the snapshow from the vsPreview.
I also attached the Levels graphs of the source and the vsPreview png created with Paint.Net.
The whole mess you encountered happens when you use the wrong luma range.
Hybrid assumes your value to be correct and what happens is that the source then gets clamped (not scaled) to 15-235 which causes the contrast to be 'off'.
Cu Selur
So you need to use 'pc' scale when in the Imagesequence dialog and the colors stay the same while converting between RGB and YUV.
So the script used by Hybrid:
Code:
# Imports
import vapoursynth as vs
core = vs.get_core()
# loading source: C:/Users/Selur/Desktop/ImgStrmVStest/000000.png
# color sampling RGB24@24, matrix:709, scantyp: progressive
# luminance scale PC
# resolution: 1312x960
# frame rate: 1 fps
# Loading C:\Users\Selur\Desktop\ImgStrmVStest\%06d.png using vsImageReader
clip = core.imwri.Read("C:/Users/Selur/Desktop/ImgStrmVStest/%06d.png", firstnum=0)
clip = core.std.Trim(clip=clip, length=51)
# 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 YUV420P8 for x264Model (i420)
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P8, matrix_s="709", range_s="full")
# Output
clip.set_output()
I attached the source frame and the snapshow from the vsPreview.
I also attached the Levels graphs of the source and the vsPreview png created with Paint.Net.
The whole mess you encountered happens when you use the wrong luma range.
Hybrid assumes your value to be correct and what happens is that the source then gets clamped (not scaled) to 15-235 which causes the contrast to be 'off'.
Cu Selur
24.07.2020, 03:45
Except, the output video file is at "PC" range instead of "TV" range. Shoudn't the x264 output range change to "TV" if "Range Conversion" -> "full to limited (pc -> tv)" is specified on the "Color" tab for Vapoursynth?
The Vapoursynth preview stays looking correct when toggling "Range Conversion" -> "full to limited (pc -> tv)" on and off.
So shouldn't this produce a "TV" range mp4 file?
I guess I'm not understanding why it works differently in AviSynth.
The only way to get a "TV" range mp4 file (as in AviSynth), is to import at TV range and enable the "Levels" filter in Vapoursynth:
Anyways, at least we know it's not a bug!
By the way, what program did you use to take the "levels" screenshots?
Code:
# Imports
import vapoursynth as vs
core = vs.get_core()
# Loading E:\USER\fin\Joga\Bjork - Joga_%1d.00x_1312x960_Gaia-HQ_png\000000.png using vsImageReader
clip = core.imwri.Read("E:/USER/fin/Joga/Bjork - Joga_%1d.00x_1312x960_Gaia-HQ_png/000000.png", firstnum=2)
clip = core.std.Trim(clip=clip, length=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)
clip = core.resize.Point(clip, range_in_s="full", range_s="limited")
# Setting color range to TV (limited) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
# adjusting output color from: RGB24 to YUV420P8 for x264Model (i420)
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P8, matrix_s="709", range_s="limited")
# Output
clip.set_output()
The Vapoursynth preview stays looking correct when toggling "Range Conversion" -> "full to limited (pc -> tv)" on and off.
So shouldn't this produce a "TV" range mp4 file?
I guess I'm not understanding why it works differently in AviSynth.
The only way to get a "TV" range mp4 file (as in AviSynth), is to import at TV range and enable the "Levels" filter in Vapoursynth:
Code:
# Color Adjustment
clip = core.std.Levels(clip=clip, min_in=0, max_in=255, min_out=16, max_out=235)
Anyways, at least we know it's not a bug!
By the way, what program did you use to take the "levels" screenshots?
24.07.2020, 04:54
Quote:Except, the output video file is at "PC" range instead of "TV" range. Shoudn't the x264 output range change to "TV" if "Range Conversion" -> "full to limited (pc -> tv)" is specified on the "Color" tab for Vapoursynth?Yes, the video would be tv range, the same as the source images.
If you want to produce TV range out of PC range you should use the Color Matrix filters.
Code:
# Setting color range to PC (full) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=0)
clip = core.resize.Point(clip, range_in_s="full", range_s="limited")
# Setting color range to TV (limited) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
If you use the Levels filter this does the same.
If you use the Range Conversion to TV scale or change the luma levels using make sure you signal TV scale and not PC scale in your encoding settings, otherwise your output will be 'off'. My guess this is what causes part of the confusion. (In some cases Hybrid tries to adjust the encoding settings, but not in all, since it can't be sure what is done why. )
----
I can't say what's happening when you use Avisynth, since you did not share the used script and encoding settings.
Cu Selur
24.07.2020, 05:42
Doh I thought I did!
So importing at Luma range "TV" previews and exports the same as the source png's in AviSynth (exported mp4 is at "TV" luma range):
If I switch over to Vapoursynth, it's now got the off contrast/color problem, unless I import it at "PC" range. But then I don't know how to get Hybid to output an mp4 file that is at "TV" range. To do that, I have to import at TV range, then enable the levels filter. (Correct behavior?)
So importing at Luma range "TV" previews and exports the same as the source png's in AviSynth (exported mp4 is at "TV" luma range):
Code:
ClearAutoloadDirs()
LoadPlugin("C:\PROGRA~1\Hybrid\32bit\AVISYN~1\ImageSeq.dll")
SetFilterMTMode("DEFAULT_MT_MODE", MT_MULTI_INSTANCE)
# loading source: E:/USER/fin/Joga/GaiaHQ/%06d.png
# input color sampling RGB32@8, matrix:Rec.709, scantyp: progressive
# input luminance scale tv
ImageReader(file="E:\USER\fin\Joga\GaiaHQ\%06d.png", start=0, end=99, fps=25, use_DeviL=true, pixel_type="RGB24")
# current resolution: 1312x960
# adjust color to YV12
ConvertToYV12(matrix="Rec709")
PreFetch(4)
return last
Code:
x264 --preset veryslow --crf 18.00 --profile high --level 4.1 --ref 6 --sync-lookahead 12 --qpmax 51 --vbv-maxrate 62500 --vbv-bufsize 78125 --sar 1:1 --qpfile GENERATED_QP_FILE --non-deterministic --range tv --colormatrix bt709 --demuxer raw --input-res 1312x960 --input-csp i420 --input-range tv --input-depth 8 --fps 24000/1001 --output-depth 8 --output "C:\Users\Administrator\AppData\Local\Temp\GaiaHQ.264" -
If I switch over to Vapoursynth, it's now got the off contrast/color problem, unless I import it at "PC" range. But then I don't know how to get Hybid to output an mp4 file that is at "TV" range. To do that, I have to import at TV range, then enable the levels filter. (Correct behavior?)
24.07.2020, 20:43
Your source is PC range, so you need to:
1. Import as PC range
2. Use the range filter (pc->tv)
3. set the VUI color signaling in the output to TV
Cu Selur
1. Import as PC range
2. Use the range filter (pc->tv)
3. set the VUI color signaling in the output to TV
Cu Selur
25.07.2020, 02:23
Thanks Selur, I think I understand now. Although I would suggest, that if "Range conversion: full to limited (pc->tv)" is selected in Vapoursynth, then Hybrid should probably change --range pc to --range tv in the command line automatically.
25.07.2020, 04:47
I'll think about it.
Pages: 1 2