Open geerlingguy opened 4 years ago
Looking at multi-gadget.sh
, though, it is not something made to be very malleable :-/
The simplest way to switch between 1080p and 720p at this point is to manually hack in this block in place of the 1080p text in multi-gadget.sh:
mkdir -p /sys/kernel/config/usb_gadget/pi4/functions/uvc.usb0/streaming/mjpeg/m/720p
cat <<EOF > /sys/kernel/config/usb_gadget/pi4/functions/uvc.usb0/streaming/mjpeg/m/720p/dwFrameInterval
5000000
EOF
cat <<EOF > /sys/kernel/config/usb_gadget/pi4/functions/uvc.usb0/streaming/mjpeg/m/720p/wWidth
1280
EOF
cat <<EOF > /sys/kernel/config/usb_gadget/pi4/functions/uvc.usb0/streaming/mjpeg/m/720p/wHeight
720
EOF
cat <<EOF > /sys/kernel/config/usb_gadget/pi4/functions/uvc.usb0/streaming/mjpeg/m/720p/dwMinBitRate
29491200
EOF
cat <<EOF > /sys/kernel/config/usb_gadget/pi4/functions/uvc.usb0/streaming/mjpeg/m/720p/dwMaxBitRate
29491200
EOF
cat <<EOF > /sys/kernel/config/usb_gadget/pi4/functions/uvc.usb0/streaming/mjpeg/m/720p/dwMaxVideoFrameBufferSize
1843200
EOF
# Remove the existing 1080p dir.
rm -f /sys/kernel/config/usb_gadget/pi4/functions/uvc.usb0/streaming/mjpeg/m/1080p
I'm gonna look into creating a fork. Might try to reincorporate changes back but for now... there are just too many little things that are annoying me.
So I did fork the project more strongly, and I made it default to 720p, 30fps, 55 brightness for now (much smoother on the Pi Zero, no dropped frames, yay!).
See my downstream fork here: https://github.com/geerlingguy/uvc-gadget
The process, right now, to change resolution:
/home/pi/uvc-gadget
):
If you want to switch after that, since you can't delete the m/[resolution] directory even as root
, you have to re-flash. There might be a workaround for that but I haven't figured it out yet...
All of these can be now configured with https://github.com/peterbay/uvc-gadget
@dgsiegel - good find! It doesn't seem like the changes are all documented there; do you know if @peterbay is working on documenting things somewhere already? Honestly, for this project, I'd be happy to make it a wrapper to be able to use any of the (dozens?) of uvc-gadget forks.
The only reason I made my fork was to try to get things a little bit more stable for the Pi Zero. It would be great if this wide community of Pi Webcam people could focus our efforts on polishing up one of these forks :)
Edit: looks like one of the current TODOs is "better readme and wiki pages"
@geerlingguy - documentation and wiki pages are been on my TODO list. Both of these tasks are limited by my free time and my knowledge of English.
I started writing documentation. This is the beginning and I will gradually add more information - uvc-gadget - documentation
@peterbay - That is awesome, thanks so much for moving things forward in your repo!
Also check out https://github.com/showmewebcam/showmewebcam where we try to bundle the efforts
From a blog post comment from David Hunt:
When I’m logged in over serial, I can issue the following commands to adjust various things…
/usr/bin/v4l2-ctl -c auto_exposure=0 /usr/bin/v4l2-ctl -c auto_exposure_bias=8 /usr/bin/v4l2-ctl -c contrast=20 /usr/bin/v4l2-ctl -c video_bitrate=25000000
We are using a new tool for this: https://github.com/peterbay/camera-control
Will be in the next showmewebcam release
Very nice. I'm getting the feeling I'll have to do a follow-up video on showmewebcam...
Haha wait for the next release then :)
Just wanted to comment saying that I've tested this out on my Pi 4B (been trying to figure out a solution myself, can't thank you enough for figuring a lot of the issues out).
Installing Raspbian 2020-02-07, not updating the system, and setting up this repo went perfectly well, and 720p video actually works perfectly. The issue comes when I change the piwebcam
file from the uvc-gadget
repo to use 1080p video instead of 720p, and here's where the issues start.
piwebcam
file - you have to specifically restart the entire Pi, which is something I believe you said you were working on. This is an issue present with all other uvc-gadget
repos I've tried on the Pi 4BThanks for all the work on this, looking forward to updates. I got this working on my HQ+pi4B as well in 720p with 2020-02-07 build, and look forward to 1080p when that's sorted. I currently have an issue where the camera is plugged in to my Win 10 based Lenovo laptop, After a while, when the camera is not in use, it seems to go to sleep and won't wake when called by an app like Teams or Camera. I don't have any sleep settings turned on for the laptop, Does the pi have any by default?
@kt-personal - The Pi doesn't have any kind of sleep functionality built in, but maybe it could be locking up or something... you'd have to log into it and see by monitoring its logs (via SSH over WiFi or serial connection).
Note that if the laptop drops power to its USB ports at some point (e.g. doing its own sleep), the Pi would shut off, then need to boot for ~30s again.
@geerlingguy - This is a cool project! 720p on a pi4B running Raspbian 2020-02-07 works great on both my Windows 10 and Linux devices. I've been using this setup for about a month and it's been very stable.
I'm also here to comment that I'm having the same issue as @HunterAP23 when I try to stream at 1080p on the pi4B. I re-flashed the 2020-02-07 build, ran the playbook, and modified the relevant scripts. Upon reboot, Windows recognizes the pi as a UVC Camera in device manager, but none of my apps display a video feed from the pi.
Jeff,
I just tested the latest showmewebcam on a Pi Zero W. It is fantastic:
You should definitely do another video.
Thanks, all!
Cool project! Just built my own using your guide. Being able to the brightness in a simple command or config file would help me a lot, as the raspistill command has no effect on the webcam settings.
heya Jeff
are there any plans to update it any time soon?
I would love an update on this for the Pi Zero 2. I need an optical zoom webcam for work, and the high-quality camera is perfect for that. I cannot get this to work on the Pi Zero 2 and don't have a Pi Zero v1.3 at my disposal.
Thanks!
@AudiThisWorld it works on the pi zero 2 if you install it on the lite image with SSH
AudiThisWorld it works on the pi zero 2 if you install it on the lite image with SSH
Thanks for that, @acidthefurry.
I have tried raspios-buster-armhf-lite version, and my M1 Max MacBook Pro does not see the camera. My Windows 11 PC does not see it either.
Unfortunately, I have spent hours and hours on this, and I just might have to go back to my Logitech camera with digital zoom, which is a shame because I have this high-quality Raspberry Pi camera looking great with all of my 3D printed parts. =(
I have tried raspios-buster-armhf-lite version, and my M1 Max MacBook Pro does not see the camera. My Windows 11 PC does not see it either.
It's most likely this bug which we fixed over at the showmewebcam project: https://github.com/showmewebcam/showmewebcam/pull/169
Unfortunately, I have spent hours and hours on this, and I just might have to go back to my Logitech camera with digital zoom, which is a shame because I have this high-quality Raspberry Pi camera looking great with all of my 3D printed parts. =(
There's some progress in making this work on the pi zero 2 here: https://github.com/showmewebcam/showmewebcam/pull/173
Indeed, I think it might be best for people to consider using showmewebcam (as it has a larger community and more development going on), and I still have it on my schedule to someday do a video on it in particular. I just have too many other things too :P
Hi I'm using a windows with the Raspberry Pi Zero W, but it looks that is not working I tried 4 times and eachone I try to follow the issue, or comments that I see but I'm not sure why is still not working some help please?
At a minimum, I'd like to be able to set:
In an ideal world, the
config.yml
could have a section at the top like: