This is a good sample for format convert. But my question is if I have a RGBA image (like using glReadPixel to get GL_RGBA), can I use NvBufferTransform to convert GL_RGBA image to V4L2_PIX_FMT_YUV420M? I am not sure if GL_RGBA image format is same with NvBufferColorFormat_ARGB32.
For calling NvBufferTransform(), both source and destination buffers have to be NvBuffer. Please check if you can put frame data into NvBuffer directly. RGBA is defined as NvBufferColorFormat_ABGR32.