How to get information about dropped frame, when using H264 encoder through V4L2
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?
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
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).
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.
I'm not interested in doing contracts for bespoke functionality - please don't ask.
Re: How to get information about dropped frame, when using H264 encoder through V4L2
Thank for your reply6by9 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).
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
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.
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.
I'm not interested in doing contracts for bespoke functionality - please don't ask.
Re: How to get information about dropped frame, when using H264 encoder through V4L2
Thanks for quick response, created an issue https://github.com/raspberrypi/linux/issues/6680
Return to "Graphics programming"
Jump to
- Community
- General discussion
- Announcements
- Other languages
- Deutsch
- Español
- Français
- Italiano
- Nederlands
- 日本語
- Polski
- Português
- Русский
- Türkçe
- User groups and events
- Raspberry Pi Official Magazine
- Using the Raspberry Pi
- Beginners
- Troubleshooting
- Advanced users
- Assistive technology and accessibility
- Education
- Picademy
- Teaching and learning resources
- Staffroom, classroom and projects
- Astro Pi
- Mathematica
- High Altitude Balloon
- Weather station
- Programming
- C/C++
- Java
- Python
- Scratch
- Other programming languages
- Windows 10 for IoT
- Wolfram Language
- Bare metal, Assembly language
- Graphics programming
- OpenGLES
- OpenVG
- OpenMAX
- General programming discussion
- Projects
- Networking and servers
- Automation, sensing and robotics
- Graphics, sound and multimedia
- Other projects
- Media centres
- Gaming
- AIY Projects
- Hardware and peripherals
- Camera board
- Compute Module
- Official Display
- HATs and other add-ons
- Device Tree
- Interfacing (DSI, CSI, I2C, etc.)
- Keyboard computers (400, 500, 500+)
- Raspberry Pi Pico
- General
- SDK
- MicroPython
- Other RP2040 boards
- Zephyr
- Rust
- AI Accelerator
- AI Camera - IMX500
- Hailo
- Software
- Raspberry Pi OS
- Raspberry Pi Connect
- Raspberry Pi Desktop for PC and Mac
- Beta testing
- Other
- Android
- Debian
- FreeBSD
- Gentoo
- Linux Kernel
- NetBSD
- openSUSE
- Plan 9
- Puppy
- Arch
- Pidora / Fedora
- RISCOS
- Ubuntu
- Ye Olde Pi Shoppe
- For sale
- Wanted
- Off topic
- Off topic discussion