Enable lossless Feature


I am using Nvidia Video Codec to encode RGB stream to H.264 (I convert RGB frames to NV12 format before encoding).
I would like to enable lossless:

  • I changed the buffer format from NV_ENC_BUFFER_FORMAT_NV12 to NV_ENC_BUFFER_FORMAT_YUV444.
  • I set QP to 0 and RC_mode to NV_ENC_PARAMS_RC_CONSTQP
  • I set the presetGUID to NV_ENC_PRESET_LOSSLESS_DEFAULT_GUID and the profileGUID to NV_ENC_H264_PROFILE_HIGH_444_GUID.
  • I set the flags qpPrimeYZeroTransformBypassFlag to 1 and chromaFormatIDC to 3.

But I got the error NV_ENC_ERR_INVALID_PARAM when nvEncEncodePicture() is executing.
If I enable the separate colour plane mode (separateColourPlaneFlag = 1), the error is not displayed.

Is it mandatory to enable separateColourPlaneFlag for lossless mode ?

PS : my GPU is M2000.

Thank you.

Hi abrevet,

Could you provide us some additional information:

  1. Operating system
  2. Driver version?

Ryan Park


Operating system : Win7 - 64 bit
Driver version : 382.05


We are not able to reproduce the problem with this driver. To isolate further, could you please answer the following questions?

  1. Are you using CABAC or CAVLC for entropy coding? CABAC is not supported with 4:4:4 encoding.
  2. Can you try if 4:2:0 lossless encoding works?

Thanks for your help.

  2. I tried 4:2:0 lossless encoding (without separateColourPlaneFlag) and it works properly.

How can I have more debug information when NVENC returns the error NV_ENC_ERR_INVALID_PARAM ? Which parameter is invalid for instance.