rkwiles
Posts: 24
Joined: Thu Dec 19, 2019 1:23 pm

mmal_queue_get returns an area too small to hold YUV image

Sun Aug 01, 2021 6:37 pm

Hi,

I am trying to understand MMAL and how to encode YUV inages into h.264 video.

I have been using 6by9's example_basic_2 source code, which I know is a h.264 decode program but I thought I could modify it to do encode.

The issue is when I call the mmal_quque_get function it returns a buffer size of 1382400 but my YUV images are 1843200 in size.

Do I send the first part of the YUV Image to the mmal_port_send_buffer and then get another mmal_queue_get buffer to send the rest of the image?

If you know of an example that takes YUV images from a file and encodes it to h.264, please send me a URL of that code. I have searched all over for an example and could not find one.

Thanks
Kelly

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 11654
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: mmal_queue_get returns an area too small to hold YUV image

Sun Aug 01, 2021 8:39 pm

mmal_queue_get just retrieves a buffer from a pool. If you've created the pool with incorrect parameters then it'll be of the wrong size.

https://github.com/6by9/mmal_encode_example
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

rkwiles
Posts: 24
Joined: Thu Dec 19, 2019 1:23 pm

Re: mmal_queue_get returns an area too small to hold YUV image

Mon Aug 02, 2021 10:54 am

That fixed my issue.

I was using MMAL_ENCODING_I420 and it needed to be MMAL_ENCODING_UYVY.

And the code example helped me greatly, it cleared up some other issues I had after the above fix.

Thank you very much 6by9.

Kelly

Return to “Graphics, sound and multimedia”