yuv420 format for nvhost-msenc

I’m using the hardware video encoder to encode h264 video. My source is YUV420, with seperate Y U and V planes.
The resolution of this video is 1280x720, meaning my buffer sizes should be 921600 for y, and 230400 for U and V.

The resultant (encoded) video doesn’t look right. the Y channel seems to be just fine, but the colors are off. There’s a big green bar at the bottom of the video that seems to indicate my chroma samples aren’t correct.

When i look at the buffers that are mapped for my output planes, the U and V buffers are 276480 bytes wide, which is 1.2 times the size that I expect. I think that the extra space at the end of the buffer means that I’ve got my formatting wrong.

Have I missed something? I’m having trouble understanding why these buffers aren’t the size that I expect.

Thanks for any Insight.

Hi wdouglass,
Do you run gstreamer or MMAPIs? Is BSP r28.1?

I’m using the mmapis. Specifically, i’m using the v4l extensions. No gstreamer.

Also, the firmware came from Jetpack 3.2, so it’s version 28.2.

The buffer is with alignment so you have to check pitch, width, and height.

I used the ‘bytesperline’ member of the v4l2_format structure to get pitch. Works great, that’s what I was missing.

Thanks so much!