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.

[BUG] x264 colormatrix option changes when "Overwrite input type scan" is enabled
#1
Bug 
I open a mpg muxed DVD (no re-encoding), and on the x264 tab, the colormatrix is correctly set at bt470bg. (There is no color space tagging in the metadata.)

It's a PAL DVD flagged as top field first, but is mostly progressive with some interlaced.

On the (De-)Interlace/Telecine tab, as soon as I tick the "Overwrite input type scan to:" checkbox, the colormatrix option (on the x264 tab) is set to bt709. It will stay there no matter what I set or do in Hybrid (un-tick Overwrite input scan, turn on AviSynth32 ColorMatrix filter, etc.) unless the file is reloaded.

If the ColorMatrix Avisynth32 filter is enabled (709 to 601) *before* the input file is loaded, then the colormatrix option on x264 will stay correct at bt470bg, even if Overwrite input type is enabled. As soon as ColorMatrix AviSynth32 filter is disabled, if the Overwrite input type is enabled, colormatrix on x264 tab will go to bt709 and stay there until file is reloaded.

I believe you should be able to reproduce this with any SD input file that is 720x480 or 720x576, that is untagged for color space. Can be worked around by setting Color matrix option on VUI tab via x264 tab for Advanced mode.
Reply
#2
Will try to reproduce and fix this this evening (mainly offline today; or tomorrow) and report back.

Cu Selur
Reply
#3
On Vapoursynth macOS it is not related to "Overwrite input type scan to" checkbox in deinterlacer.
It just always autodetects color matrix for SD files as BT.709 in x264/x265 VUI/Signalling if "to input" checkbox is selected.

If turn on color matrix filter and set to tb470bg, it autodetects tb470bg

In script it detects video input as bt470bg.  So seems it is just something with codec VUI autodetection. I personally always set VUI manually and attempt to avoid autodetection.

# loading source: /Users/shph/Desktop/TEST.vob
# color sampling YUV420P8@8, matrix:470bg, scantyp: top field first
# luminance scale TV
# resolution: 720x576
# frame rate: -1 fps
# input color space: YUV420P8, bit depth: 8, resolution: 720x576, fps: 25
# Loading /Users/shph/Desktop/TEST.vob using D2VSource
clip = core.d2v.Source(input="/Volumes/temp/Hybrid Temp/vob_d712946e7aa8c750188cbf767761112d_853323747.d2v", rff=False)
# making sure input color matrix is set as 470bg
clip = core.resize.Point(clip, matrix_in_s="470bg",range_s="limited")
Reply
#4
@shijian: will look at you issue with x265 once I fixed the issue The_Tinkerer reported, since it is not the same.
Reply
#5
Ok. Seems i mistype. It is the same in both in x264 and x265 VUI/Signalling
Reply
#6
Will look into it once I get feedback from The_Tinkerer whom I send a link to a dev version for testing.

Cu Selur
Reply
#7
Just a note, any mpg or mp4 file I load that is 8 bit 4:2:0 always has this comment in the Avisynth script:

#  input color sampling YV12@8, matrix:Rec.709, scantyp: top field first

It's just a comment so it doesn't affect anything... A straight re-encode of a muxed DVD mpg will get correctly processed and set to 601/470bg... but that particular top comment always says Rec.709. The scantyp is correct for progressive or top/bottom field first however. Again, I'm just talking about the comment. Wink
Reply
#8
Did you use the dev version I send you?
If did not, then do it.
If you did, share a debug output.
Reply
#9
Okay, the whole Avisynth ColorMatrix is broken in the dev due to some changes I made for the mac adjustments,..
-> working on it

-> send another update via PM
Reply
#10
Sorry, yes, the new dev version behaves the same way regarding the comment.


Unfortunately, it still changes to 709 on the x264 tab when I change overwrite input scan.

Here's the log as requested:


.zip   HybridDebugOutput_Overwrite_Input_Scan.zip (Size: 19,37 KB / Downloads: 11)


ALSO, this should probably get its own thread, but it's sort of related since we're talking about incorrect color matrices.

The "RGBAdjust" filter also seems to work incorrectly. If I load a DVD input file (same one as above) and then enable RGBAdjust, it incorrectly uses a Rec709 ConvertToRGB matrix:

# color modifications
ConvertToRGB(interlaced=false, matrix="Rec709")
RGBAdjust(1.00,0.95,1.00,1.00,0.00,0.00,0.00,0.00,analyze=false,dither=false)
# adjust color to YV12
ConvertToYV12(matrix="Rec601")


If I simply reload the same file while keeping the RGBAdjust filter enabled, it now writes the script correctly with Rec601 for both conversions:

# color modifications
ConvertToRGB(interlaced=false, matrix="Rec601")
RGBAdjust(1.00,0.95,1.00,1.00,0.00,0.00,0.00,0.00,analyze=false,dither=false)
# adjust color to YV12
ConvertToYV12(matrix="Rec601")

I made a separate log for this, here it is:


.zip   HybridDebugOutput_RGB_Adjust.zip (Size: 35,79 KB / Downloads: 8)

Logs include input scan.

Sorry (again) for finding so many issues! Undecided
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)