Hi, I am having trouble to correctly generate an h264 stream that has the correct information to inform the decoder about the colorspace. This happens on an Orin dev kit running r36.3.
We experience the issue with gstreamer, but it can be nailed down to the encoder itself by running the 01_video_encoder sample. A raw source is encoded, option is given to notify the encoder it is bt709. The produced h264 stream has only partial information about the colorspace, that the decoder cannot correctly identify as bt709.
$ ./video_encode colorbar.raw 1920 1080 H264 test.h264 --color-space 2 --insert-vui
Creating Encoder in blocking mode
Opening in BLOCKING MODE
NvMMLiteOpen : Block : BlockType = 4
===== NvVideo: NVENC =====
NvMMLiteBlockCreate : Block : BlockType = 4
875967048
842091865
H264: Profile = 66 Level = 51
NVMEDIA: Need to set EMC bandwidth : 846000
NvVideo: bBlitMode is set to TRUE
Could not read complete frame from input file
File read complete.
Got 0 size buffer in capture
App run was successful
$ ./video_decode H264 -o out.raw --report-input-metadata --disable-rendering test.h264
Set governor to performance before enabling profiler
Creating decoder in blocking mode
Opening in BLOCKING MODE
NvMMLiteOpen : Block : BlockType = 261
NvMMLiteBlockCreate : Block : BlockType = 261
Setting frame input mode to 1
NVMMLITE_NVVIDEODEC, <NvMMLiteNvVideoDecSetAttribute:9359> Error status reporting set to 1
Input file read complete
Starting decoder capture loop thread
Got EoS at output plane
Video Resolution: 1920x1080
Video SAR width: 0 SAR height: 0
Decoder colorspace ITU-R BT.601 with standard range luma (16-235)
Query and set capture successful
Got EoS at capture plane
Exiting decoder capture loop thread
App run was successful
A deeper analysis of the h264 stream show that some parameter might not be properly set:
$ ffmpeg -i test.h264 -c copy -bsf:v trace_headers -f null - 2>&1 | grep -A 10 vui
[trace_headers @ 0xaaaac6be6e30] 87 vui_parameters_present_flag 1 = 1
[trace_headers @ 0xaaaac6be6e30] 88 aspect_ratio_info_present_flag 0 = 0
[trace_headers @ 0xaaaac6be6e30] 89 overscan_info_present_flag 0 = 0
[trace_headers @ 0xaaaac6be6e30] 90 video_signal_type_present_flag 1 = 1
[trace_headers @ 0xaaaac6be6e30] 91 video_format 101 = 5
[trace_headers @ 0xaaaac6be6e30] 94 video_full_range_flag 0 = 0
[trace_headers @ 0xaaaac6be6e30] 95 colour_description_present_flag 1 = 1
[trace_headers @ 0xaaaac6be6e30] 96 colour_primaries 00000000 = 0
[trace_headers @ 0xaaaac6be6e30] 104 transfer_characteristics 00000000 = 0
[trace_headers @ 0xaaaac6be6e30] 112 matrix_coefficients 00000001 = 1
[trace_headers @ 0xaaaac6be6e30] 120 chroma_loc_info_present_flag 0 = 0
Turns out that colour_primaries and transfer_characteristics are set to 0 (reserved value according to the norm), while other encoders set them to 1.
What could be done to help us getting a full bt709 support?