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.

[HELP] AviSynth 32 bit - ColorMatrix filter not working for video?
#1
Question 
Try loading the attached "ColorTest.mp4" video into Hybrid.

Enable the ColorMatrix filter for AviSynth, clear "Adjust by Resolution", then select From: Rec.709, To: Rec.601.

Open the previewer, then toggle the check box for ColorMatrix on and off. It has no effect on the preview.

The script looks like this:

ClearAutoloadDirs()
SetFilterMTMode("DEFAULT_MT_MODE", MT_MULTI_INSTANCE)
LoadCPlugin("C:\PROGRA~1\Hybrid\32bit\AVISYN~1\ffms2.dll")
LoadPlugin("C:\PROGRA~1\Hybrid\32bit\AVISYN~1\ColorMatrix.dll")
# loading source: E:\USER\ColorTest.mp4
#  color sampling YV12@8, matrix: bt709, scantyp: progressive, luminance scale: limited
FFVideoSource("E:\USER\COLORT~1.MP4",colorspace="YV12")
# current resolution: 1440x1080
# color modifications
ColorMatrix(mode="Rec.709->Rec.601",interlaced=false,hints=false)
# filtering
PreFetch(4)
return last


The thing is, the ColorMatrix filter DOES work for VapourSynth.

Enable it for VapourSynth and use the same settings...  clear "Adjust by resolution", then select From: Rec.709, To: Rec.601. Open the previewer and toggle it, and you will see the correct color change.

The script looks like this:

# Imports
import vapoursynth as vs
core = vs.get_core()
# Loading Plugins
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/vslsmashsource.dll")
# source: 'E:\USER\ColorTest.mp4'
# current color space: YUV420P8, bit depth: 8, resolution: 1440x1080, fps: 23.976, color matrix: 709, yuv luminance scale: limited, scanorder: progressive
# Loading E:\USER\ColorTest.mp4 using LibavSMASHSource
clip = core.lsmas.LibavSMASHSource(source="E:/USER/ColorTest.mp4")
# making sure input color matrix is set as 709
clip = core.resize.Point(clip, matrix_in_s="709",range_s="limited")
# making sure frame rate is set to 23.976
clip = core.std.AssumeFPS(clip, fpsnum=24000, fpsden=1001)
# Setting color range to TV (limited) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
# ColorMatrix: adjusting color matrix from 709 to 470bg
clip = core.resize.Bicubic(clip=clip, matrix_in_s="709", matrix_s="470bg", range_in=0, range=0)
# Output
clip.set_output()


I checked, and this behavior is the same in Hybrid version 2020.02.19.1. So it's been like this for a while.

The AviSynth ColorMatrix filter DOES work as expected when using IMAGE streams. It shifts colors the same as the VapourSynth filter does. You can verify this by loading the attached image as an image stream and toggling the filter.

(The reason I'm wanting to do 709 to 601, is I'm processing DVD's with other applications that force a shift to 709 (like running ColorMatrix from 601 to 709). Running this filter afterwards shifts it back to the correct colors.)

I've attached some logs, as well as the source file and single image.

Logs:
[attachment=1086]
[attachment=1087]
[attachment=1085]

Test Video:
[attachment=1088]

Test Image:
[attachment=1089]
Reply


Messages In This Thread
AviSynth 32 bit - ColorMatrix filter not working for video? - by The_Tinkerer - 19.10.2020, 01:54

Forum Jump:


Users browsing this thread: 2 Guest(s)