Hi all.. a
long summary of my adventure..We are all working from home and good webcams are either hard to find or overpriced nowadays so i decided it would be worth to explore the raspberry route..and so it begins..
I will try to answer some questions that arose here also..
First I got a working camera on a pi zero and pi 3a+ ! not perfect but at least a start..
I used https://github.com/wlhe/uvc-gadget
and legacy g_webcam and am on 4.19.115 of the kernel/modules.
To answer some questions:
- the colored bars purple/green is because there is no actual source.. (due to -d)
-depending when g_webcam is loaded, by hand after boot or at cmdline.txt, the V4L /UVC device may be switched around, you need to use -u /-v options when starting uvc-gadget to correct this (you get errors like V4L2: /dev/video1 is no video capture device / UVC: /dev/video0 is no video output device)
-when you see a black image there is actually no stream arriving at the host (try to take a snapshot, you get a timeout)
- when you see a white image and are able to take a snapshot.... then streaming works but the brightness is simply way to high.. ( i think i even had to change defaults)
- g_webcam is very limited in resolutions /frame rates, so i had to made some additions here to add more resolution/framerate combinations
- i tried using uvc_config on pi zero, using script on https://gist.github.com/kbingham/c39c4c ... f5206e2f9f
and enabling the line #modprobe libcomposite... this is still pending to get it to work.. i stopped when i got legacy g_webcam going ..with the latest remarks i will have another look at it
So how to get it to work :
- make sure to connect the pi using the USB port for gadget mode
typical late night mistake...
- add modules-load=dwc2 in the cmdline.txt after rootwait
- in config.txt add dtoverlay=dwc2 (pi zero) or dtoverlay=dwc2,dr_mode=peripheral (pi 3a+)
- modprobe g_webcam (by hand method)
- start uvc gadget .. eg ./uvc-gadget -r1 -f0 -s2 (resolution 720p format V4L2_PIX_FMT_YUYV, check if your V4L /UVC device is correct)
if I use the format V4L2_PIX_FMT_YUYV in combination with r0 (360p) the image will be black and there will be no stream, vice versa f1 will not work with r1 !
so for 360p use ./uvc-gadget -r10-f1 -s2 (resolution 360p format V4L2_PIX_FMT_MJPEG)
Note that the first time your image may be all white..but as said that is a good sign.. lower your brightness.. and there you are !!!
if you switch to a resolution at the host not matching uvc-gadget resolution your screen will be black..
I still have the following issues..
- Windows does not seem to be happy with the/my current uvc info.. it will only allow me to use 360p..
- Ubuntu guvcview does allow me to use 720p, however framerate is only 4.4fps .. to be investigated still (both pi zero and 3a+ same issue)
- Ubunta guvcview 1080p won't work yet..
its late so forgive me (or correct me) if there are any mistakes here