1

I am using v4l2loopback v0.12.5 and wf-recorder to record my screen on wayland. I am looking to reduce the framerate of the video stream as read by my browser. Currently I am unable to get anything other than 60fps.

I have used version wf-recorder 0.2.1 and this fork as it adds the option to set the framerate. However, I get the same output.

If I start wf-recorder with this command:

wf-recorder \
        -x yuv420p \
        -g "$x,$y ${width}x$height" \
        --muxer=v4l2 \
        --codec=rawvideo \
        --file="$device"

/sys/devices/virtual/video4linux/video0/format looks like this:

YU12:2560x1440@30

However the command output reports that the framerate is 60 not @30:

selected region 0 0 2560 1440
Framerate: 60
Choosing pixel format yuv420p
Output #0, video4linux2,v4l2, to '/dev/video0':
    Stream #0:0: Unknown: none (rawvideo)

If I open the device with ffplay I see that it reports 30fps:

Input #0, video4linux2,v4l2, from '/dev/video0':B sq=    0B f=0/0
  Duration: N/A, start: 1102.869115, bitrate: 1327104 kb/s
    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 2560x1440, 1327104 kb/s, 30 fps

Using webcamtests.com I get ~60fps reported.

If I instead start wf-recorder with the -r flag set to 6:

wf-recorder \
        -x yuv420p \
        -r 6 \
        -g "$x,$y ${width}x$height" \
        --muxer=v4l2 \
        --codec=rawvideo \
        --file="$device"

wf-recorder reports Framerate: 6 however /sys/devices/virtual/video4linux/video0/format still shows YU12:2560x1440@30.

This leads me to believe that the issue is not with wf-recorder, or rather that I can't set the framerate with that tool.

Instead I looked to change the settings on the device. Running:

echo "@6"| sudo tee /sys/devices/virtual/video4linux/video0/format

I see the format change to YU12:2560x1440@6. However, I see no change in the perceived framerate.

If I run:

sudo v4l2-ctl -d /dev/video0 -p 6

I see the format change to: YU12:2560x1440@6000/1000 but again I see no change in the perceived framerate (still 60fps in my browser).

There don't seem to be any options to set for this on the v4l2loopback kernel module.

I'm running out of ideas - anything else to try or is my poor computer doomed to processes 100Mbit video streams forever? :D

0

In the end I was able to do this with another v4l device and this gstreamer command:

gst-launch-1.0 -v v4l2src device=/dev/video0 ! videorate drop-only=true ! video/x-raw,framerate=6/1 ! v4l2sink device=/dev/video1
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.