Sample Video ?

is the SDK document, it is noted that :
The source content can be:

8-bit YUV 4:2:0 sequence
10-bit YUV 4:2:0 sequence
ARGB input

Does this means having YUV 4:2:2 instead of 4:2:0 is going to be a problem ?
Could you please provide an example of YUV file that I can run with one of the sample code ?

Assuming you’re talking about the Video SDK, and e.g. the NvEncoder sample, from looking at the (not quite latest) 7.1.9 code yes, your input must match what you told the encoder it was.

https://media.xiph.org/video/derf/ contains lots of good test input material. You can either download something already in 4:2:0 (e.g. ducks_take_off), or use e.g. ffmpeg to convert your input to the desired format. Something like (untested):

ffmpeg -y -pix_fmt yuv422p -s 1920x1080 -r 30 -i input422.yuv -f rawvideo -pix_fmt yuv420p -s 1920x1080 -r 30 output420p.yuv

my questions is more about possibility rather than what sample code have right now, I am wondering we can use YUV 4:2:2 as an input for NVENC directly without converting it?

The SDK Programming Guide says you must call NvEncGetInputFormatCount()/NvEncGetInputFormats() to determine what input formats are acceptable. In my experience you only have 4:2:0 formats and ARGB, plus variants. nvEncodeAPI.h header from my SDK (latest, 7.1.9 – I forgot SDK 8.0 isn’t actually released yet) says:

/**
 * Input buffer formats
 */
typedef enum _NV_ENC_BUFFER_FORMAT
{
    NV_ENC_BUFFER_FORMAT_UNDEFINED                       = 0x0,      /**< Undefined buffer format. */

    NV_ENC_BUFFER_FORMAT_NV12                            = 0x1,      /**< Semi-Planar YUV [Y plane followed by interleaved UV plane] */
    NV_ENC_BUFFER_FORMAT_YV12                            = 0x10,     /**< Planar YUV [Y plane followed by V and U planes] */
    NV_ENC_BUFFER_FORMAT_IYUV                            = 0x100,    /**< Planar YUV [Y plane followed by U and V planes] */
    NV_ENC_BUFFER_FORMAT_YUV444                          = 0x1000,   /**< Planar YUV [Y plane followed by U and V planes] */
    NV_ENC_BUFFER_FORMAT_ARGB                           = 0x1000000, /**< 8 bit Packed A8R8G8B8 */
    NV_ENC_BUFFER_FORMAT_ARGB10                         = 0x2000000, /**< 10 bit Packed A2R10G10B10 */
    NV_ENC_BUFFER_FORMAT_AYUV                           = 0x4000000, /**< 8 bit Packed A8Y8U8V8 */
} NV_ENC_BUFFER_FORMAT;

Thanks Nathan, my problem is I am dealing with streams of video that are Monochrome or color 4:2:2 and I don’t wanna spend any CPU/GPU time to convert them, since I am dealing with a real-time application, any conversion is going to cause failure.

You should be able to do the colour conversion in hardware at very little cost. Poke the SDK samples; I think there might be an example of using DXVA for that. Even using e.g. libyuv to do conversion in software should be less than 5ms on moderate hardware for a 1920x1080 frame, so unless you’re dealing in 8K 60fps content, real-time shouldn’t be a big issue.