V4l2loopback + mjpg_streamer issue

1.1k Views Asked by At

Ihave a Raspberry Pi 4 B running Raspbian 10 Buster + the Raspberry Pi High Quality Camera. I need to use v4l2loopback to copy videofeed from the physical Camera (/dev/video0) to dummy device (/dev/video1) in order to access it by the mjpg-streamer and the v4l2rtspserver at the same time.

I load the v4l2loopback module:

sudo modprobe v4l2loopback

Then copy the video from /dev/video0 to /dev/video1:

ffmpeg -f video4linux2 -input_format mjpeg -i /dev/video0 -vcodec copy -f v4l2 /dev/video1

Launch the mjpg-streamer and get following error:

./mjpg_streamer -i "./input_uvc.so -d /dev/video1" -o "./output_http.so"
MJPG Streamer Version: git rev: 85f89a8c321e799fabb1693c5d133f3fb48ee748
 i: Using V4L2 device.: /dev/video1
 i: Desired Resolution: 640 x 480
 i: Frames Per Second.: -1
 i: Format............: JPEG
 i: TV-Norm...........: DEFAULT
Unable to query buffer: Invalid argument
Init v4L2 failed !! exit fatal
 i: init_VideoIn failed

Launching the mjpg-streamer on /dev/video0 works flawlessly.

I spent hours trying to find solution. Please help.

1

There are 1 best solutions below

0
On

Running into this as well. I had commented out the portion where it sets the v4l2 format. The reason is v4l2loopback already has it set so you can't change it. However even after doing that I am running into issues and segfaults.

The reason is because v4l2loopback is not a UVC device.