Page 1 of 1

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

Posted: Fri Feb 14, 2025 4:35 pm
by lmkq
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?

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

Posted: Fri Feb 14, 2025 8:37 pm
by 6by9
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).

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

Posted: Fri Feb 21, 2025 2:43 pm
by lmkq
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?

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

Posted: Fri Feb 21, 2025 3:17 pm
by 6by9
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.

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

Posted: Fri Feb 21, 2025 5:15 pm
by lmkq
Thanks for quick response, created an issue https://github.com/raspberrypi/linux/issues/6680

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