NV multimedia encode API only supports V4L2_PIX_FMT_YUV420M for outplane?

In my program, I need encode RGBA format images to H264 bitstream, I checked some documents and sample code. (Jetson Linux API Reference: V4L2 Video Encoder | NVIDIA Docs)

It looks only V4L2_PIX_FMT_YUV420M for outplane is supported. Is it right? If so, is there any mmapi can convert RGBA format to YUV420M?

Yes, only YUV420 or NV12 is supported. There’s a hardware converter and you can call NvBufferTransform() to convert RGBA to YUV420 or NV12.

I did not find RGBA format for NvBufferTransform, but NvBufferColorFormat_ARGB32.

I suppose RGBA is 4 bytes and with order by R, G, B, A. NvBufferColorFormat_ARGB32 is A, R, G, B. They are not same byte order, right?

@harry_xiaye ,

It would be nice if you provide feedback to suggested solutions.

For this case, you may find information looking at sample:


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.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.