We use some essential cookies to make our website work.

We use optional cookies, as detailed in our cookie policy, to remember your settings and understand how you use our website.

5 posts • Page 1 of 1
lmkq
Posts: 6
Joined: Fri Feb 14, 2025 4:04 pm

How to get information about dropped frame, when using H264 encoder through V4L2

Fri Feb 14, 2025 4:35 pm

Hi, everyone.

While implementing v4l2 h264 encoding I have stumbled upon an issue of encoder dropping frames when bitrate overshots intended values. According to Stateful-M2M-Encoder docs I expected to receive CAPTURE buffer with V4L2_BUF_FLAG_ERROR set, but looking at the bcm2385-codec it silently returns a buffer to the VPU without notifying user space.

My question is:
Am I missing something?
Is there a way for the application to know when the encoder failed to encode and act on it?

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 18476
Joined: Wed Dec 04, 2013 11:27 am

Re: How to get information about dropped frame, when using H264 encoder through V4L2

Fri Feb 14, 2025 8:37 pm

Hmm, I thought the driver passed on the buffers when rate control dropped frames. There is a funny in the V4L2 spec where a zero length buffer can is interpreted as EOS.
Returning a buffer with state V4L2_BUF_FLAG_ERROR generally results in terminating a stream, so that isn't the desired behaviour either, and I'd still want to check what happens if length = 0.

I'll have a look when I'm next in the office (back end of next week).
Software Engineer at Raspberry Pi Ltd. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

lmkq
Posts: 6
Joined: Fri Feb 14, 2025 4:04 pm

Re: How to get information about dropped frame, when using H264 encoder through V4L2

Fri Feb 21, 2025 2:43 pm

6by9 wrote: Hmm, I thought the driver passed on the buffers when rate control dropped frames. There is a funny in the V4L2 spec where a zero length buffer can is interpreted as EOS.
Returning a buffer with state V4L2_BUF_FLAG_ERROR generally results in terminating a stream, so that isn't the desired behaviour either, and I'd still want to check what happens if length = 0.

I'll have a look when I'm next in the office (back end of next week).
Thank for your reply
Just checking if there's any information that might be helpful for you and if this issue is still somewhere on your investigation list?

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 18476
Joined: Wed Dec 04, 2013 11:27 am

Re: How to get information about dropped frame, when using H264 encoder through V4L2

Fri Feb 21, 2025 3:17 pm

I've not gotten around to it yet due to other priorities.
Could you create an issue on https://github.com/raspberrypi/linux/issues? Forum threads tend to get lost.
Software Engineer at Raspberry Pi Ltd. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.


5 posts • Page 1 of 1

Return to "Graphics programming"

AltStyle によって変換されたページ (->オリジナル) /