v4l2tools icon indicating copy to clipboard operation
v4l2tools copied to clipboard

v4l2compress encodes as fast as possible instead of at device FPS

Open gabenell opened this issue 5 years ago • 3 comments

I noticed that v4l2compress uses 100% CPU when running, and that when I serve the output of v4l2compress using v4l2rtspserver, it sends hundreds of FPS. My video source is a v4l2loopback device.

The problem seems to be the while loop in v4l2compress.cpp, which encodes as fast as possible. I verified by adding a sleep that the CPU usage dropped and the FPS received by the RTSP client went down to a sane rate.

Is there any way to make v4l2compress run at the native framerate of the source device? Trying to achieve this by sleeping is not ideal.

gabenell avatar Sep 23 '20 05:09 gabenell

@gabenell I find myself on this same situation. Did you manage to get it fixed? Where did you put the sleep, as a fallback option?

Edit: I just put it at the end of the loop, but when serving the stream through v4l2rtspserver now I get a static image :-/.

flixman avatar Jul 24 '21 18:07 flixman

Even when using a USB camera as source, how would one decide to compress a 15fps stream instead of the max 30fps stream?

There is no framerate option for v4l2compress nor v4l2compress_omx.

Also I don't see how I could modify the device framerate with v4l2-ctl ... ?

Thank you.

fplanque avatar Mar 24 '24 01:03 fplanque

Hi @fplanque

This tools are not setting fps, you should set it using v4l2-ctl --set-parm.

Best Regards, Michel.

mpromonet avatar Mar 24 '24 14:03 mpromonet