Unintended contrast spread when using Jetson, GStreamer, and H265 to encode videos

Hi,

Using BT709 I see a difference between the “normal” and extended range. BT709 in normal range is closer to the original images and could be a first but not perfect solution.

Using BT601 I see no difference between the normal and extended range. I did some research on how they should differ and also looked at the YUV files: Regardless of the specified range, the color transformation is performed using extended range. Is there another way to force normal range for BT601?

Command to create YUV files:

gst-launch-1.0 multifilesrc location=ramp228/image_ramp_%d.png start-index=1 stop-index=1000 caps="image/png, framerate=25/1, format=GRAY8" ! pngdec ! queue ! videoconvert ! video/x-raw,format=I420,colorimetry="1:4:0:0" ! multifilesink location=YUV/dump_%05d.YUV

Command to create compressed video:

gst-launch-1.0 multifilesrc location=ramp228_3/image_ramp_%d.png start-index=1 stop-index=1000 caps="image/png, framerate=25/1, format=GRAY8" ! pngdec ! queue ! videoconvert ! video/x-raw,format=I420,colorimetry="1:4:0:0" ! x265enc ! h265parse ! qtmux ! filesink location=ramp228.mp4

My result:

colormetry np.min(img) np.max(img) img[1, 1]
original 25 248 [228 228 228]
1;3;0;0 6 255 [244 247 244]
2;3;0;0 17 247 [224 226 225]
1;4;0;0 8 255 [245 245 245]
2;4;0;0 8 255 [245 245 245]

legend: colormetry=range:matrix:transfers:primaries

range: 1 → RANGE_0_255, 2 → RANGE_16_235
matrix: 3 → MATRIX_BT709, 4 → MATRIX_BT601
transfer: 0 → TRANSFER_UNKNOWN
primaries: 0 → PRIMARIES_UNKNOWN