Linux-Media Archive on
 help / color / Atom feed
From: Jonas Bechtel <>
Subject: Lots of hurdles for webcam usage (UVC/v4l2loopback and more?)
Date: Sun, 25 Oct 2020 11:08:31 +0100
Message-ID: <20201025110831.73d2cd11@mmluhan> (raw)

Dear Linux Media developers,

just wanted to tell you that it's not easy to use an old but working camcorder for videoconferencing with (GNU/)Linux.

See my tries below. So far there's no _well_ working situation, but you can make it somehow running for the browser with v42lloopback +

Unfortunately this message of mine is probably not feasible for a productive see-bug-find-error-patch-code workflow. My personal guess is that lots of programs which use video4linux were implemented as #worksforme influencing each other in using odd ioctl variations. There seems to be missing some instance which straightens common interface usage conventions.



Linux 4.19.67
v4l2loopback 0.12.1, started with
Camcorder Panasonic NV-GS11, webcam mode, driver uvcvideo, on video0 (and video1)
qv4l2 1.16.3 (seemingly same effects on 1.20+ (recent git))
ffmpeg 4.1.4
vlc 3.0.8
Firefox 68.7.0esr and 78.4.0esr (no difference)

Setting up video11:
I had to code some initialization program as v4l2loopback-ctl is invoking gst-launch-1.0 which doesn't accept RGB3 setting.
ioctl(fd, VIDIOC_S_FMT, {V4L2_BUF_TYPE_VIDEO_OUTPUT, {width=320, height=240, pixelformat=RGB3})
ioctl(fd, VIDIOC_S_PARAM, {V4L2_BUF_TYPE_VIDEO_CAPTURE[but could probably be _OUTPUT as well], {timeperframe=1/15}})

Setting up video12:
v4l2loopback-ctl set-caps "video/x-raw, format=UYVY, width=320, height=240" /dev/video12
sudo v4l2loopback-ctl set-fps 15 /dev/video12

Note that you only can configure format for loop once. After first stream use, v4l2loopback driver block further changes.

Feeding the loop:
ffmpeg -f v4l2 -i /dev/video0 -an -filter_complex "[0]format=rgb24" -f v4l2 /dev/video11
ffmpeg -f v4l2 -i /dev/video0 -an -filter_complex "[0]format=yuv420p" -f v4l2 /dev/video12
(or yuv422p)

build process for qv4l2 (v4l-utils), recent from git:
QT_SELECT=5 needed, in order to make "moc" be found by qtchooser.

Every of the methods has, if working at all, has at least a delay of ~ 500 ms to real life.

Camcorder - ffplay -> OK (despite the typical SEGV on close)

Camcorder - Firefox -> AbortError (but keeps device node blocked/reserved against others)

Camcorder - -> Same 

Camcorder - vlc -> cannot start streaming: Input/output error [__001, see bottom]
Camcorder - -> Same

Camcorder - qv4l2 click on Play -> OK (MJPG)

Camcorder - qv4l2 choose RGB3/YV12/..., click on play -> grey picture. Program has to be restarted.

Camcorder - v4l2ucp -> OK, working under any circumstances (but it's only function is to set the physical zoom)

Camcorder - ffmpeg -vf format=rgb24 - video11 - Firefox -> AbortError

Camcorder - ffmpeg -vf format=rgb24 - video11 - -> OK, but after tab-close camera not accessible any more. Not usable after accidently having opened video0 (OverConstrainedError).

Camcorder - ffmpeg -vf format=rgb24 - video11 - vlc -> OK
Camcorder - ffmpeg -vf format=rgb24 - video11 - -> OK

Camcorder - ffmpeg -vf format=rgb24 - video11 - qv4l2 -> High CPU load on settings panel (mass ioctls on VIDIOC_DQEVENT). When clicking "play" cpu load sinks but no image window opens.

Camcorder - ffmpeg -vf format=yuv422p or =yuv420p - video12 - qv4l2 -> Same

Camcorder - ffmpeg -vf format=yuv422p or =yuv420p - video12 - vlc/ -> unidentifiable picture content, repeated, heavily colorized
Firefox show still image with yuv420p and live image with yuv422p.

Camcorder - ffmpeg -vf format=yuv422p or =yuv420p - video12 - vlc/Firefox -> Same

Camcorder - ffmpeg -vf format=yuv422p - video12 - ffplay -> Same
Camcorder - ffmpeg -vf format=yuv420p - video12 - ffplay -> Same still image, additionally heavily complaining about wrong buffer sizes

Firefox with v4l2compat seems to perform some preselection (only deletes entries in webcam list), whereas Firefox without v4l2compat always shows all devices /dev/video* (but you have to no the order by heart because the names of the webcams don't get exposed to the websites)

$ LANG=C vlc v4l2:///dev/video0
VLC media player 3.0.8 Vetinari (revision 3.0.8-0-gf350b6b5a7)
[5721c270] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
libv4l2: error turning on stream: Input/output error
[e9c00b90] v4l2 demux error: cannot start streaming: Input/output error
[e9c00b90] v4l2 demux error: not a radio tuner device
libv4l2: error turning on stream: Input/output error
[e9c02540] v4l2 stream error: cannot start streaming: Input/output error
QObject::~QObject: Timers cannot be stopped from another thread

Last ioctl before first Input/output error was:
ioctl(22, VIDIOC_STREAMON, [V4L2_BUF_TYPE_VIDEO_CAPTURE]) = -1 EIO (Input/output error)

                 reply index

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201025110831.73d2cd11@mmluhan \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-Media Archive on

Archives are clonable:
	git clone --mirror linux-media/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-media linux-media/ \
	public-inbox-index linux-media

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone