New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
uvcdynctrl and guvcview to control webcam #87
Comments
Um, just out of curiosity and hoping to solve another issue, is this related to #86 ? I guess we can ship uvcdynctrl if it solves people trouble, but what we really need is for this to be documented. |
I don't think the issue is related. My webcam (Logitech QuickCam 9000 Pro) worked fine out of the box and didn't require the -y flag. However, it's not properly focussed on the print. Many Logitech cams have the ability to change parameters from the command line, including Focus, which I find tremendously useful. uvcdynctrl allows to change parameters, but Focus is not among them unless you also install guvcview. so, ...
|
This would mean shipping uvcdynctrl and guvcview. Alternatively we could test and add the script to the building up scripts in |
I cannot figure out how to restart "webcamDaemon" without rebooting the whole machine - can someone tell how to do it? |
This should do it:
|
awesome, thanks I'll try it out. |
THNAKYOU VERY MUCH BRADDO99!!!! |
Muradamin, I still have that problem too... with the older version of OctoPi on RPi B+ (not blaming on octopi just think there was something different between that and RPi2 etc etc) I could set the focus this way while OP is running and it would remain even after a reboot of the whole system. Now, I can't set the focus while OP is running, and it's pretty hard to set it at all because you have to shut down mjpg streamer to gain access to the camera. But as soon as you start mjpg streamer again it overrides the focus setting and goes back to blurry. For now I am just living with it but it's very annoying! |
Actually I think the logitech also has zoom control, which would be even more cool, but haven't figured out how to access that because I guess it needs particular drivers and such. |
ah, yes.. and also you need to unplug and plug the camera... |
I have seen some related discussion of getting pan/tilt and other functions to work in mjpg-streamer here: http://sourceforge.net/p/mjpg-streamer/discussion/739917/thread/709f0741/?page=1 and the solution seemed to be to make mjpg-streamer using libv4l2 option like this: make clean && make USE_LIBV4L2=true Now, raspbian doesn't have libv4l2 but it seems libv4l-dev contains it according to this: I wonder if previous versions of OctoPi installed mjpg-streamer with any switches which formerly allowed uvcdynctrl to access the camera and change focus? I wonder if there's merit to attempting to make mjpg-streamer with USE as above, but not sure what livbrary to call out since libv4l2 isn't explicitly installed as a package. In the discussion thread it seems doing such an install allowed pan/tilt (and focus/zoom I think) to show up in the actual mjpg-streamer web page. That I would like to see! |
Well I do wish I could figure out why mjpg-streamer locks out the camera and why unplugging it somehow makes it possible to register the focus control, .... but figured out a work around. (I think this mainly works for Logitech webcams, which released special compatibility with the v4l2 driver.) after OctoPi is up and running you have to "unbind" the webcam, which you need to first find out what is the device ID. So run lsusb to find it. Then lsusb -t to see the USB tree, make note of where the camera is according to this syntax bus-port.port.port etc mine is for example 1-1.4.2 Then you can run the following: sudo bash -c "echo 1-1.4.2 > /sys/bus/usb/drivers/usb/unbind" Once the webcamDaemon runs again (it's on a timer which repeats every few minutes) If you reboot the pi, you'll have to repeat this process. I still haven't figured out how to automate this even after multiple tries putting these commands into the .bashrc and in the webcamDaemon itself. |
Hi Braddo99, |
@mhdshameel You need to use the exact name of the control. In my case this was |
I'm trying to change my webcam focus settings but im stuck running guvcview. Anyone knows whats going on? The webcam is not being used by octoprint. Im getting this:
` |
Hello, |
sudo guvcview -a then: and in my case: and now all we need is some way to directly stream h264 from c920 (because c930e h264 doesn't work on linux) - that would be awesome (a lot smaller stream size for thesame quality) |
Is there a way to make a start up file for this? Im kinda noob to linux and stuff related to linux. Seems if you restart the pi these are restarted and I have to re enter these commands to reset my C920 web camera again. Would love to make a script or something to run at startup. |
sudo nano /etc/rc.local and this is what I have in mine: You can use it but you have to change the paths to those on your system (I'm using Odroid with Ubuntu and manually installed OP, and not RPi). |
What would be default location for that line on the Octiprint or how would I go and about to find this line? On my pie 2? Also thanks for the info on the starup file. |
change /odroid/ in paths to /pi/ |
Is there a way to check to see if this going off when the pi is starting. I don't think its running? I don't think my pathways are correct. I have to go in and manually turn off the autofocus from time to time. I think its not running. So is there a way to check it and see if it ran correctly? Thanks for the help. |
Ummmm... I don't really know. |
Instead of installing and running |
I have a c615 and would LOVE to adjust settings in OctoPrint. I have my c615 plugged into my pi 3 B and mounted on my PRUSA i3 MK3 but the focus is not on the print. I was interested in the time-lapse capabilities and have installed the plugin OctoLapse and while a great plugin, I can not control any camera specific settings. Please advise what to install or do to make this functionality work. TIA! |
Psyc0flyer, not sure if the C615 has the autozoom on it like the C920 or my C930. uvcdynctrl -s "Focus, Auto" 0 If you havnt installed them just installed them by normal linux commands. But I think there already installed by default. |
Correct, it has auto focus. Pan, tilt, zoom if I remember the windows software correctly. |
This doenst give you options in octiprint to control the zoom and any of the other thing. But it allows my pi to run the script to turn off the autozoom which by default was turn on always. Which really sucked because the camera was always trying to zoom in and out on the moving bed and carriage. Also this allows you to set a custom zoom number so you can tweak your zoom number and get it right were you want it. |
I never really got around to messing with time laspe stuff. But I'm just starting to mess with it now. So might like to see if that does work. Never saw that in my octoprint. It might not work like you think. I know if you command line it from SSH it will zoom in. But once you restart the pi it will lose your setting unless you setup the startup script. |
I do not know what to do to do from SSH, Advise? OctoLapse has to be added through plugins. |
I have a Logitech 9000 Pro and wanted to improve the focus. What I found after reading these threads, with some old data in them, is that I can get this to work by doing some of the things above however slightly differently:
I then did without sudo Then I didn't need to do any un/plugging of camera, just the following:
So then I tried with all types of values from 0 to 255, and found that 255 was focusing at about 3cm, and 0 being infinite. I also set some brightness, contrast and saturation values, and got a much nicer picture. There was no need to unplug, restart, switch off the daemon, nothing... it all just worked. When one time I had a problem changing resolution, whilst it was streaming, and it said the device was in use, I found this useful
However, it doesn't persist over reboot of pi, (rebooting octoprint seems to have no affect, doesn't kill or modify streaming at all) I tried adding the two commands to rc.local, however it doesn't work. Not quite sure where I go from here. |
@RicoTrevisan I would appropriate though if you keep on topic. BTW has this been solved? should I close this or should we add some form of documentation anywhere? |
Hello,
Love OctoPi - just got a new Raspi2 and got the latest image, wonderful. But, ... I forgot how much time I spent trying to figure out how to control my Logitech (and other uvc) webcams. Turns out there are a lot of things you can do to control uvc webcams from the command line like, in particular, setting the focus distance - makes it much sharper to look at a print in progress.
To make this work, you need to install uvcdynctrl and guvc view, which I had forgotten that I had installed on the previous Rpi - took me a while to figure out why it wasn't working and what to do to get it going!
Now I can type "uvcdynctrl -s "Focus" 100" on the command line and watch the camera adjust focus right in the OctoPrint window. Even better would be a focus adjustment directly from OctoPrint, but that's a suggestion for Gina!
Cheers,
Brad
The text was updated successfully, but these errors were encountered: