A = core.lasmas.LWLibavSource("1.jpg") # pick a large picture, w > 1024 or h > 576. This returns a YUV420 clip
B = core.imwri.Read("1.jpg") # this returns a RGB clip
mvf.Preview([A, B]).set_output() # should observe typical color errors when a 601 source is processed with 709 matrix.
The problem is that JPEG is hardcoded to use 601 (unless ICC included), and ffmpeg clearly labels the fact in frame props, however, mvf.Preview
/mvf.ToRGB
/mvf.GetMatrix
does not use that info when determining which matrix to convert YUV to RGB.
I understand the reason for not honoring the frame properties because at the time of script execution, there is no way to query frame properties (unless it calls synchronous get_frame(0)
to get the first frame and even if it did so, there is no guarantee that the frame properties stay the same.) Therefore, it should be the responsibility for downstream filters to honor this. Normally they do, but as mvf.GetMatrix
always return an explicit matrix, such functionality is overridden.
(To test this hypothesis, I modified GetMatrix
to always return None
, and the above reproduction program works fine.)