Hi, Ran into this while feeding BGR0 screen capture frames directly into h264_nvenc.
nvenc already sets the H.264/HEVC VUI and AV1 sequence header to limited-range bt470bg for packed RGB input (and gbr for gbrp) to match NVENC's fixed internal RGB-to-YUV conversion, but avctx->colorspace and avctx->color_range were left untouched. As a result, muxers reading avcodec_parameters_from_context() write the input RGB tags (gbr/pc, or a user-passed -colorspace bt709) into the container while the bitstream itself says bt470bg/tv: ffmpeg -f lavfi -i smptebars=s=640x360:d=0.2 -vf format=bgr0 -c:v h264_nvenc out.mkv ffprobe -show_streams out.mkv | grep -E 'color_space|color_range' Attached patch syncs avctx->colorspace and avctx->color_range before codec config setup, warns if an incompatible colorspace was explicitly requested on packed RGB input, and notes the fixed BT.601 conversion under rgb_mode in doc/encoders.texi. Tested on an L4 across h264_nvenc, hevc_nvenc, and av1_nvenc. (Please CC me on replies as I'm not subscribed to the list.) Thanks, Ryan Joshua Gapac
0001-avcodec-nvenc-sync-AVCodecContext-color-properties-f.patch
Description: Binary data
_______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
