NVIDIA Encoder SDK enables the creation of H.264 compressed stream from video files so that it can be quickly transferred over internet(video streaming).
The samples provided along with the SDK works on video files as shown below:

I am working with real-time applications where I do not have the video files beforehand.
To try the SDK, I am trying to encode a single image/frame and the output I am planning to give the encoded stream to the decoder code. Is this approach fine?

If possible, can anyone give me a code snippet for decoding a single frame using NVIDIA NVENC SDK?

Needed example too.