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.

Green Tint with Resize
#1
Hello. I'm using Hybrid with Vapoursynth enabled (my source content is 4:2:2, and Vapoursynth seems to handle it better).

I'm having an issue where when I encode the media, everything works as expected. However, if I also resize the media, the resulting video seems to shift slightly green. I suspect color information is being lost.

I'm using Windows 10 (x64), and version 2017.05.06.1 of Hybrid.

Attached is the debug output.

Example of exported file which was NOT resized: https://od.lk/d/M18xNjIzOTg3MzBf/NotResized.mp4
Example of export file which WAS resized: https://od.lk/d/M18xNjIzOTg3MzFf/Resized.mp4

You'll see if you switch back/forth between the two clips, that the resized version has shifted slightly green.

Thank you for your help. Hybrid is awesome!
-= Brandon.
Reply
#2
Can't play around with Vapoursynth to reproduce the issue without a sample of the source. Wink
Using:
# Imports
import vapoursynth as vs
core = vs.get_core()
# Loading Plugins
core.std.LoadPlugin(path="G:/Hybrid/vsfilters/Support/fmtconv.dll")
core.std.LoadPlugin(path="G:/Hybrid/vsfilters/SourceFilter/LSmashSource/vslsmashsource.dll")
# Loading C:\Users\Selur\Desktop\NotResized.mp4 using LibavSMASHSource
notresized = core.lsmas.LibavSMASHSource(source="C:/Users/Selur/Desktop/NotResized.mp4") # 720x480
notresized = core.sub.Subtitle(notresized, "NOT Resized")
notresized = core.text.FrameProps(notresized)
resized = core.lsmas.LibavSMASHSource(source="C:/Users/Selur/Desktop/Resized.mp4") # 640x480
resized = core.sub.Subtitle(resized, "Resized")
resized = core.std.AddBorders(resized, 40, 40)
resized = core.text.FrameProps(resized)
mixed = core.std.Interleave([notresized, resized])
# Output
mixed.set_output()
I see the green tint.
Might be a problem with a resizer. (iirc there were posts over at doom9s about color issues with some resizers but I thought those were fixed)
-> Have you tried other resizers?
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Reply
#3
Sorry about that. If it's still useful, here's the source: https://od.lk/d/M18xNjI0MjYxODlf/Source.avi

Regarding other resizers, I'm not sure what you mean. Is there an option to use other resizers in Hybrid?

-= Brandon.
Reply
#4
Since I can't reproduce the issue with:
# Imports
import os
import sys
import ctypes
Dllref = ctypes.windll.LoadLibrary("G:/Hybrid/vsfilters/Support/libfftw3f-3.dll")
# Loading Support Fileslsmas
Dllref = ctypes.windll.LoadLibrary("G:/Hybrid/vsfilters/Support/OpenCL.dll")
import vapoursynth as vs
core = vs.get_core()
# Import scripts folder
scriptPath = 'G:/Hybrid/vsscripts'
sys.path.append(os.path.abspath(scriptPath))
# Loading Plugins
core.std.LoadPlugin(path="G:/Hybrid/vsfilters/GrainFilter/AddGrain/AddGrain.dll")
core.std.LoadPlugin(path="G:/Hybrid/vsfilters/DenoiseFilter/FFT3DFilter/vsfft3dfilter.dll")
core.std.LoadPlugin(path="G:/Hybrid/vsfilters/DenoiseFilter/DFTTest/DFTTest.dll")
core.std.LoadPlugin(path="G:/Hybrid/vsfilters/DenoiseFilter/KNLMeansCL/KNLMeansCL.dll")
core.std.LoadPlugin(path="G:/Hybrid/vsfilters/ResizeFilter/NNEDI3/libnnedi3.dll")
core.std.LoadPlugin(path="G:/Hybrid/vsfilters/Support/libmvtools.dll")
core.std.LoadPlugin(path="G:/Hybrid/vsfilters/Support/temporalsoften.dll")
core.std.LoadPlugin(path="G:/Hybrid/vsfilters/Support/scenechange.dll")
core.std.LoadPlugin(path="G:/Hybrid/vsfilters/Support/fmtconv.dll")
core.std.LoadPlugin(path="G:/Hybrid/vsfilters/SourceFilter/LSmashSource/vslsmashsource.dll")
# Import scripts
import havsfunc as havsfunc
# Loading D:\VHS Testing\2017.06.25\source.avi using LWLibavSource
clip = core.lsmas.LWLibavSource(source="C:/Users/Selur/Desktop/source.avi", format="YUV422P8", cache=0)
# making sure input color matrix is set as 470bg
clip = core.resize.Point(clip, matrix_in_s="470bg")
# making sure input color range is set to TV (16-235) scale.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
# setting field order to what QTGMC should assume
clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=1)
# Deinterlacing using QTGMC
clip = havsfunc.QTGMC(Input=clip, Preset="Slower", TFF=False, InputType=0, TR2=0, Sharpness=1.9, SourceMatch=0, Lossless=0)
clip = core.resize.Point(clip=clip, format=vs.YUV422P8, matrix_s="470bg")
clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=0)
#clip.set_output()
# resizing to 640x480
resized = core.fmtc.resample(clip=clip, kernel="spline16", w=640, h=480, interlaced=False, interlacedd=False)
resized = core.sub.Subtitle(resized, "Resized")
resized = core.std.AddBorders(resized, 40, 40)
resized = core.resize.Point(clip=resized, format=vs.YUV422P8, matrix_s="470bg")
#resized = core.text.FrameProps(resized)
#clip = core.text.FrameProps(clip)
mixed = core.std.Interleave([clip, resized])
# Output
mixed.set_output()
I will try later whether it changes anything if I enforce a specific color space for output.
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Reply
#5
I encoded the clip with different resizers and created a small compare script, see: https://drive.google.com/open?id=0B_WxUS...ENUTVQtTTQ .
Download the files, adjust the paths in thte compare.vyp to your setup, open the compare.vpy with vedit and open the preview (Script->Preview)
The more I see the result, the more I'm unsure if this is really a bug or if this is just due to the original coloring of the clip and the normal color perception change if you compress an image.
Do you also have this effect with a source which doesn't have a green tint to begin with?

Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Reply
#6
Yeah, each of those resizes exhibit the same green tint.

I'm hesitant to think the green shift is just the effect of compressing the image. Keep in mind, the AVI I included earlier is the source file. The file named "NotResized.mp4" is still a compressed version of the file, just not resized. If it were the compression causing it, wouldn't we see it on the NotResized version as well? The NotResized file does not show the green tint. It appears identically to the source AVI. The green tinting only occurs when you resize the video, as demonstrated in the Resized.mp4 file.

If you're just talking about horizontal compression, rather than just file compression, I don't think that's it either. For example, if you play NotResized.mp4 in MPC-HC, and set the Video Frame Aspect Ratio to 4:3 (horizontally compressing/squishing the image), you'll see the green tint does not occur. It still appears identically to the source AVI, with no green tinting. See the screenshots below...

Screenshot from NotResized.mp4 with 4:3 aspect ratio in player (no green tint)
https://od.lk/d/M18xNjI1ODU1MjVf/NotResized.png

Screenshot from Resized.mp4 (has green tint)
https://od.lk/d/M18xNjI1ODU1Mjlf/Resized.png

Thanks again. Hopefully we'll be able to get to the bottom of this!
-= Brandon.
Reply
#7
I'll try a few things over the weekend (busy week) to get to the bottom of this or at least file a proper bug report to the Vapoursynth developers in case I can't figure out why this happens.
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Reply
#8
send you a link to a Hybrid version which enforces the output color space/sampling of the Vapoursynth script to make sure that ffmpeg doesn't do any color space conversions,..
(couldn't properly test myself, since I'm only using my laptop atm. - which doesn't have a good display)

Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Reply
#9
Also, please
a. Try the script from https://forum.selur.net/Thread-Green-Tin...d=89#pid89 (with adjustments to your environment). To see whether this is a bug in Vapoursynth or a problem with the output handling.
b. Try whether this also happens when x265 is used instead of x264?

Cu Selur

Ps.: probably offline the whole day tomorrow, so I won't probably get to look at it again before Friday after work.
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Reply
#10
Created another version which avoids the intermediate ffmpeg call, which might fix the issue.

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)