Selur
22nd July 2020, 17:15
What I did so far:
I wrote wrote a short script to look at an image (https://i.imgur.com/4vmgQYj.png) using Vapoursynth.
# Imports
import vapoursynth as vs
core = vs.get_core()
# Loading C:\Users\Selur\Desktop\4vmgQYj.png using vsImageReader
clip = core.imwri.Read(["C:/Users/Selur/Desktop/4vmgQYj.png"])
clip = core.std.Loop(clip=clip, times=100)
# making sure frame rate is set to 25
clip = core.std.AssumeFPS(clip, fpsnum=25, fpsden=1)
# Setting color range to TV (limited) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
# Output
clip.set_output()
I then added:
#clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P8, transfer_in="linear", matrix_s="709", range_s="limited") # -> wrong color
#clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P8, transfer_in="linear", matrix_s="709", range_s="full") # -> wrong color
#clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P8, matrix_s="470bg", range_s="full") # -> wrong color
#clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P8, matrix_s="470bg", range_s="limited") # -> wrong color
#clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P8, matrix_s="170m", range_s="full") # -> wrong color
#clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P8, matrix_s="170m", range_s="limited") # -> wrong color
#clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P8, matrix_s="240m", range_s="full") # -> wrong color
#clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P8, matrix_s="240m", range_s="limited") # -> wrong color
#clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P8, matrix_s="fcc", range_s="full") # -> wrong color
#clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P8, matrix_s="fcc", range_s="limited") # -> wrong color
#clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P8, matrix_s="ycgco", range_s="full") # -> wrong color
#clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P8, matrix_s="ycgco", range_s="limited") # -> wrong color
to my script and alternated between those lines and the output without them to see which of those would be the one that would preserve the color properly.
None of them did. :/
I feel like I'm clearly overlooking something (basic) since all those conversions change the color quite a lot.
Only way that does seem to work is by using:
# Imports
import vapoursynth as vs
core = vs.get_core()
# Loading C:\Users\Selur\Desktop\4vmgQYj.png using vsImageReader
clip = core.imwri.Read(["C:/Users/Selur/Desktop/4vmgQYj.png"])
clip = core.std.Loop(clip=clip, times=100)
# making sure frame rate is set to 25
clip = core.std.AssumeFPS(clip, fpsnum=25, fpsden=1)
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=0) # setting flag to full range
clip = core.resize.Bicubic(clip, range_in_s="full", range_s="limited") # converting full to limited range
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1) # setting flag to full range
clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P8, matrix_s="709", range_s="limited") # using the
# Output
clip.set_output()
the rgb color and the output colors seem to be the same.
But this simply does seem wrong!
-> Can someone tell me how to do this properly?
Cu Selur
I wrote wrote a short script to look at an image (https://i.imgur.com/4vmgQYj.png) using Vapoursynth.
# Imports
import vapoursynth as vs
core = vs.get_core()
# Loading C:\Users\Selur\Desktop\4vmgQYj.png using vsImageReader
clip = core.imwri.Read(["C:/Users/Selur/Desktop/4vmgQYj.png"])
clip = core.std.Loop(clip=clip, times=100)
# making sure frame rate is set to 25
clip = core.std.AssumeFPS(clip, fpsnum=25, fpsden=1)
# Setting color range to TV (limited) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
# Output
clip.set_output()
I then added:
#clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P8, transfer_in="linear", matrix_s="709", range_s="limited") # -> wrong color
#clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P8, transfer_in="linear", matrix_s="709", range_s="full") # -> wrong color
#clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P8, matrix_s="470bg", range_s="full") # -> wrong color
#clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P8, matrix_s="470bg", range_s="limited") # -> wrong color
#clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P8, matrix_s="170m", range_s="full") # -> wrong color
#clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P8, matrix_s="170m", range_s="limited") # -> wrong color
#clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P8, matrix_s="240m", range_s="full") # -> wrong color
#clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P8, matrix_s="240m", range_s="limited") # -> wrong color
#clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P8, matrix_s="fcc", range_s="full") # -> wrong color
#clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P8, matrix_s="fcc", range_s="limited") # -> wrong color
#clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P8, matrix_s="ycgco", range_s="full") # -> wrong color
#clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P8, matrix_s="ycgco", range_s="limited") # -> wrong color
to my script and alternated between those lines and the output without them to see which of those would be the one that would preserve the color properly.
None of them did. :/
I feel like I'm clearly overlooking something (basic) since all those conversions change the color quite a lot.
Only way that does seem to work is by using:
# Imports
import vapoursynth as vs
core = vs.get_core()
# Loading C:\Users\Selur\Desktop\4vmgQYj.png using vsImageReader
clip = core.imwri.Read(["C:/Users/Selur/Desktop/4vmgQYj.png"])
clip = core.std.Loop(clip=clip, times=100)
# making sure frame rate is set to 25
clip = core.std.AssumeFPS(clip, fpsnum=25, fpsden=1)
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=0) # setting flag to full range
clip = core.resize.Bicubic(clip, range_in_s="full", range_s="limited") # converting full to limited range
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1) # setting flag to full range
clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P8, matrix_s="709", range_s="limited") # using the
# Output
clip.set_output()
the rgb color and the output colors seem to be the same.
But this simply does seem wrong!
-> Can someone tell me how to do this properly?
Cu Selur