Page 1 of 1

How to enforce low FPS in v4l2 for /dev/video0?

Posted: Wed Dec 07, 2016 10:35 pm
by hasselh
I am running 2 Philips SPC900NC Webcams under Debian Jessie (3.4 and 4.7 kernels). The cam is doing great in low light situations, if FPS can be reduced to 10 FPS or even 5 FPS. This works fine e.g. by recording a video with ffmpeg via:

Code: Select all

ffmpeg -f v4l2 -framerate 5 -video_size 640x480 -i /dev/video0 test.mp4
But with surveillance tools like Motion and ZoneMinder, the cam always defaults to 15FPS - independently of any FPS rates I set in these programs. Also running "v4l2-ctl --set-parm 5" gets overwritten when Motion or ZoneMinder are started (I checked with: v4l2-ctl --get-parm).

I played with v4l2loopback and the following config is actually enforcing 5fps: /dev/video0 -> ffmpeg -> /dev/video1 -> Zoneminder. But the problem is additional CPU consumption of ffmpeg.

Is there any possibility to archive 5 FPS by enforcing the FPS in v4l2 natively (avoiding adding v4l2loopback/ffmpeg to the mix) or directly through ZoneMinder ?

P.S.: I asked the same question in stackoverflow a few days ago, but got no responses so far:
https://stackoverflow.com/questions/409 ... dev-video0

Re: How to enforce low FPS in v4l2 for /dev/video0?

Posted: Tue Dec 27, 2016 4:20 am
by mythedoff
I can only offer an alternative. I use two Logitech webcams, a C920 for detection and Quickcam Pro 9000 recording at high resolution and I have no problems with framerate. I don't remember the command to get resolutions and framerates for webcams but resolutions only work with certain framerates.
Mine are running on a different machine than the zoneminder server and using mjpg-streamer. I call a script in crontab

Code: Select all

@reboot sh /path/to/cam-stream.sh
cam-stream.sh

Code: Select all

#!/bin/sh



# Logitech C920
# The higher resolution works but at 2 fps.
#/usr/bin/mjpg_streamer -i "input_uvc.so -r 2304x1536 -yuv -d /dev/video1" -o "output_http.so -w ./www -c USER:PASSWORD" &

# will do 10 fps at this resolution
/usr/bin/mjpg_streamer -i "input_uvc.so -r 1280x720 -yuv -f 10 -d /dev/video1" -o "output_http.so -w ./www -c USER:PASSWORD" &

wait 5

# Logitech Pro 9000
# at this resolution will only do 5 fps
/usr/bin/mjpg_streamer -i "input_uvc.so -r 1600x1200 -yuv -d /dev/video0" -o "output_http.so -p 8077 -w ./www -c USER:PASSWORD" &
C920 image quality is not very good no matter what setting I tried but detection is good.

Re: How to enforce low FPS in v4l2 for /dev/video0?

Posted: Sat Jan 28, 2017 7:47 pm
by knight-of-ni
Since the device in question is a local device and not an IP stream, you should be able to control the framerate directly from zoneminder by placing a value into the max fps field.