Linux-Media Archive on lore.kernel.org
 help / color / Atom feed
* Lots of hurdles for webcam usage (UVC/v4l2loopback and more?)
@ 2020-10-25 10:08 Jonas Bechtel
  0 siblings, 0 replies; only message in thread
From: Jonas Bechtel @ 2020-10-25 10:08 UTC (permalink / raw)
  To: linux-media



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 + v4lcompat.so.

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.

BR
 Jonas



Setting: 

Linux 4.19.67
v4l2loopback 0.12.1, started with
    devices=6
    video_nr=10,11,12,13,14,15
    card_label=loop10a,loop11b,loop12c,loop13d,loop14e,loop15f
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
OR
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 - Firefox+v4lcompat.so -> Same 

Camcorder - vlc -> cannot start streaming: Input/output error [__001, see bottom]
Camcorder - vlc+v4l2compat.so -> 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 - Firefox+v4lcompat.so -> 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 - vlc+v4l2compat.so -> 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/Firefox+v4lcompat.so -> 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)




[__001]
$ 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)







^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-25 10:08 Lots of hurdles for webcam usage (UVC/v4l2loopback and more?) Jonas Bechtel

Linux-Media Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-media/0 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/ https://lore.kernel.org/linux-media \
		linux-media@vger.kernel.org
	public-inbox-index linux-media

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-media


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git