Convert YUV422 to YUV420 for GPU decoding


I am using nVidia Video Codec SDK 12.1.14 SDK samples to decode live video stream. I am getting H265 video stream with pixel format YUV422. NVidia doesn’t support this format.

Is there any way that I am able to convert the stream after FFmpegDemuxer to YUV420 format. Infact before feeding the stream to nvDecoder I would like to convert it to the desired format of YUV422. Kindly help me finding any API or way out for this conversion as I am stuck with my video stream.

Note: input video stream format will not be changed. So I have to convert it using nVidia Video Codec SDK or FFmpeg.