Jump to content

Can't figure out how to activate my webcam.


ken226

Recommended Posts

It's connected, and i've read through a dozen or so tutorials that sound like they are written in Klingon.  All I get is a blank white screen.

 

I read somewhere that there needs to be a webcam.txt file in >machine>config files.  I created one, but everything in it is commented out.  So far, all i have is a blank white screen in the webcam part of the dashboard.

 

Anyone know what I need to do?

 

Also, the mainsail documentation metions "webcamd" several times.  In one instance, it instructs to go the the top right corner of the mainsail UI, click the power button and restart "webcamd".   There no "webcamd" under than button.  What is webcamd, and where can I find it?

 

image.thumb.png.d58b13ab9d6bdc912e7206dc9b7a9b07.png

Edited by ken226
Link to comment
Share on other sites

34 minutes ago, mvdveer said:

Might be useful to read the post on this that @Stadi did here:

I actually did come across that thread earlier.  It reads like he has one working cam, and is trying to add a second one.  

 

I only have one, and am trying to get it to work.  So, for one cam I need two webcam.txt files? and also to install crownest via ssh?

Link to comment
Share on other sites

Mmmmmh. Crowsnest installed with mainsail on my setup. 

Let's try this:

Create a crowsnest.conf file (note spelling)

Copy and paste the following in the file and restart: (Note my camera is connected to the pi itself, i.e picam)

 

 

#### crowsnest.conf
#### This is mainsail / MainsailOS default config.
#### See:
#### https://github.com/mainsail-crew/crowsnest/blob/master/README.md
#### for details to configure to your needs.


#####################################################################
####                                                            #####
####      Information about ports and according URL's           #####
####                                                            #####
#####################################################################
####                                                            #####
####    Port 8080 equals /webcam/?action=[stream/snapshot]      #####
####    Port 8081 equals /webcam2/?action=[stream/snapshot]     #####
####    Port 8082 equals /webcam3/?action=[stream/snapshot]     #####
####    Port 8083 equals /webcam4/?action=[stream/snapshot]     #####
####                                                            #####
#####################################################################


[crowsnest]
log_path: ~/klipper_logs/crowsnest.log  # Default logfile in ~/klipper_logs/crowsnest.log
log_level: verbose                      # Valid Options are quiet/verbose/debug
delete_log: false                       # Deletes log on every restart, if set to true

[cam 1]
mode: mjpg                              # mjpg/rtsp
port: 8080                              # Port
device: /dev/video0                     # See Log for available ...
resolution: 640x480                     # widthxheight format
max_fps: 15                             # If Hardware Supports this it will be forced, ohterwise ignored/coerced.
#custom_flags:                          # You can run the Stream Services with custom flags.
#v4l2ctl:                               # Add v4l2-ctl parameters to setup your camera, see Log what your cam is capable of.

 

 

 

 

 

 

 

 

 

If you go to log files - is there a log for the crowsnest install. If so, what does it say. It should look something like this:

 

[06/16/22 09:57:01] crowsnest: crowsnest - A webcam Service for multiple Cams and Stream Services.
[06/16/22 09:57:01] crowsnest: Version: v2.4.0-15-ge42799b
[06/16/22 09:57:01] crowsnest: Prepare Startup ...
[06/16/22 09:57:01] crowsnest: INFO: Checking Dependencys
[06/16/22 09:57:01] crowsnest: Dependency: 'crudini' found in /usr/bin/crudini.
[06/16/22 09:57:02] crowsnest: Dependency: 'find' found in /usr/bin/find.
[06/16/22 09:57:02] crowsnest: Dependency: 'logger' found in /usr/bin/logger.
[06/16/22 09:57:02] crowsnest: Dependency: 'xargs' found in /usr/bin/xargs.
[06/16/22 09:57:02] crowsnest: Dependency: 'ffmpeg' found in /usr/bin/ffmpeg.
[06/16/22 09:57:02] crowsnest: Dependency: 'ustreamer' found in bin/ustreamer/ustreamer.
[06/16/22 09:57:02] crowsnest: Dependency: 'rtsp-simple-server' found in bin/rtsp-simple-server/rtsp-simple-server.
[06/16/22 09:57:02] crowsnest: INFO: Detect available Devices
[06/16/22 09:57:02] crowsnest: INFO: Found 1 total available Device(s)
[06/16/22 09:57:02] crowsnest: Detected 'Raspicam' Device -> /dev/video0
[06/16/22 09:57:02] crowsnest: INFO: No usable CSI Devices found.
[06/16/22 09:57:02] crowsnest: V4L2 Control:
[06/16/22 09:57:02] crowsnest: No parameters set for [cam 1]. Skipped.
[06/16/22 09:57:02] crowsnest: Try to start configured Cams / Services...
[06/16/22 09:57:03] crowsnest: INFO: Configuration of Section [cam 1] looks good. Continue...
[06/16/22 09:57:03] crowsnest: Starting ustreamer with Device /dev/video0 ...
[06/16/22 09:57:05] crowsnest: ... Done!

 

The following info is if you are not using a Rapberri pi and may be relevant:

 

 

 

If you are not using a Raspberry Pi then /dev/video0 might not work and you might encounter an "Video capture not supported by the device" error in the crowsnest.log log file.

In this case you should use the direct device ID for the USB camera found in the /dev/4vl/by-id directory, like in the following example:

device: /dev/v4l/by-id/usb-PixArt_Imaging_Inc._USB2.0_Camera-video-index0

Please be aware that all available devices are always listed in the crowsnest.log log file, so you can always copy the appropriate device ID from there.

 

 

Link to comment
Share on other sites

That didn't change anything. Still a blank white screen.

 

When that didnt work, i went back and scrolled through all the text in putty from the crowsnest install, and it appears that there are alot of dependencies that failed to install.  Possibly due to the program not being designed for debian.

 

So, is just one webcam not possible without crowsnest?

Link to comment
Share on other sites

You don't need crowsnest, as far as I can tell. I have a singular Camera on my V0 and I've no crows nest. Well actually technically I have two cameras as I was mucking about with my set up when I was trying looking at Stadi's multi-camera issue.

You are correct you need a "webcam.txt" file in the klipper config directory. Everything is commented out as most stuff just sits at defaults. The most I've got is a:

camera="raspi"

line in the file as I am using the raspberry PI camera, but if it was a USB camera changing the line to camera="usb" should work. Having said that the default is "auto" so it should figure out for itself.

I guess a couple of basic questions are: How is the camera connected and are you using it really is connected OK? Is the wiring OK?

I'll have a poke at my PI with the camera to see if anything leaps out at me.

Link to comment
Share on other sites

The first camera was relatively easy to set up. At the top right on the gears and then in the submenu "Webcams".
here I am then on "add webcam" and that's it. I have neither installed Crownest nor created a Webcam.txt. I even read somewhere that the instructions for Multicam are outdated and you no longer need the various Webcam.txt. I haven't tried it, I'm glad it works so I'll keep my hands off it.
What surprises me is the white screen. When the camera didn't work for me, "No Signal" was displayed. I get a white camera image if the service is not set to MJPEG.001.thumb.jpg.c4d28926acf82d818e5cc2fedb4e03d3.jpg

002.jpg.363071b21e01a8ed0565840debcb51ce.jpg

  • Like 1
Link to comment
Share on other sites

6 hours ago, smirk said:

 

I guess a couple of basic questions are: How is the camera connected and are you using it really is connected OK? Is the wiring OK?

 

It's a Logitech C270, plugged into the Orange Pi's usb port.  I checked on the orange pi via ssh, and the cam shows up.

 

I don't remember the line i copied pasted into the terminal to show the cams, but it showed two logitechs, identical except one ended in index 0 and the other ended in index 1.

 

 

Link to comment
Share on other sites

1 hour ago, ken226 said:

It's a Logitech C270, plugged into the Orange Pi's usb port.  I checked on the orange pi via ssh, and the cam shows up.

I don't remember the line i copied pasted into the terminal to show the cams, but it showed two logitechs, identical except one ended in index 0 and the other ended in index 1.

My two cameras are also displayed multiple times via the SSH query, each with a different index. I think this comes from trying them on different USB ports on the Pi.
What you haven't told us yet: is a camera displayed in Mainsail's "webcam menu"? If not, have you tried adding one? If so, is the video format (MJPEG) correct?

I think the Crownest.conf was only created (automatically) when I added the first camera in the menu.

Link to comment
Share on other sites

36 minutes ago, Stadi said:

My two cameras are also displayed multiple times via the SSH query, each with a different index. I think this comes from trying them on different USB ports on the Pi.
What you haven't told us yet: is a camera displayed in Mainsail's "webcam menu"? If not, have you tried adding one? If so, is the video format (MJPEG) correct?

I think the Crownest.conf was only created (automatically) when I added the first camera in the menu.

 

Sorry,  I saw the question earlier, but after further reading it slipped my mind.

 

Yes, I added it. 

After plugging in the camera, I went to the mainsail webcam menu, and it showed no cameras.  It wasn't there automatically, so I added it, after which I started getting the white screen.  I originally tried the MJPEG option, and when that didn't work I tried the other three options.  MJPEG (experimental), and the other two.  I don't remember the names of the options.

Edited by ken226
Link to comment
Share on other sites

Very strange, what changes on the display when changing the video codec or when the camera is unplugged? When unplugging, a "No Signal" should definitely come up

Is there a Crownest.config now?

In your picture above it looks like Crownest is not listed in the update manager, is that possible?

 

Edited by Stadi
Link to comment
Share on other sites

1 hour ago, Stadi said:

Very strange, what changes on the display when changing the video codec or when the camera is unplugged? When unplugging, a "No Signal" should definitely come up

Is there a Crownest.config now?

In your picture above it looks like Crownest is not listed in the update manager, is that possible?

Crowsnest wouldn't install correctly,  so I removed it.

 

I get the same white screen regardless of what the cam is doing.

 

I still get the white screen whether the cam is plugged in or not.   

 

I'm starting to think this issue has something to do with the orange pi, drivers, ports, or something else that would require a week of studying Linux command line stuff that looks like Klingon hieroglyphs.

 

This guy is/was working on something similar.  His last few paragraphs are webcam related.

I'll read it a few more times, try and make sense of it, then try to get it working. 

https://github.com/benjjyman/klipper-orangepi4-Kiauh

Edited by ken226
Link to comment
Share on other sites

7 hours ago, claudermilk said:

I have the default webcam.txt file in my base Klipper config location. The only uncommented line is camera="auto". I just turned it on from within Mainsail and it just worked, just like @Stadi showed above.

 

Just to make sure i'm not making an incorrect assumption.  This:  "I have the default webcam.txt file in my base Klipper config location."

Means here?:

image.jpeg.5a9926214c3ac652fad36b9fe0d710a0.jpeg

Link to comment
Share on other sites

10 hours ago, Stadi said:

The first camera was relatively easy to set up. At the top right on the gears and then in the submenu "Webcams".
here I am then on "add webcam" and that's it. I have neither installed Crownest nor created a Webcam.txt. I even read somewhere that the instructions for Multicam are outdated and you no longer need the various Webcam.txt. I haven't tried it, I'm glad it works so I'll keep my hands off it.
What surprises me is the white screen. When the camera didn't work for me, "No Signal" was displayed. I get a white camera image if the service is not set to MJPEG.001.thumb.jpg.c4d28926acf82d818e5cc2fedb4e03d3.jpg

002.jpg.363071b21e01a8ed0565840debcb51ce.jpg

 

 

Yes, mine is set up exactly like that.

 

The lsusb command in the terminal shows the cam:

 

image.jpeg.c50a8f68517f5dfbdfdb99d08ded5053.jpeg

 

Edited by ken226
Link to comment
Share on other sites

As already written, the webcam.txt was only relevant for the second camera, before that I didn't have it either. While googling for the Orange Pi, I read that it is a bit bitchy with installations and that many automatic installation scripts do not work. So you would have to get Crownest installed manually somehow. Unfortunately I can't tell you how to do that. But I think this is where the main problem lies. Or you can get a Raspberry Pi to avoid such problems in the future.

Link to comment
Share on other sites

Ok.  I got it, finally.

And, it sucked.

 

For future reference, since Raspberry Pi's are being scalped for ridiculous prices and Orange Pi's are becoming more common in these type of applications.  In case someday, someone is searching the web  looking for a way to get their webcam set up with an Orange Pi 4 for Mainsail.

 

First, after multiple attempts to create webcam.txt files, trying to download and install "Crowsnest", sacrificing a live chicken and then beating it against the side of my Voron, I started taking screenshots of everything, and comparing them to each other when the next failure occurred.

So, crowsnest failed to install because the Orange Pi didn't have an FFMpeg,  whatever the f... that is.  So i spent half an hour googling "debian install FFMpeg.  Found a command line script to install it, and ran the script.  That, of course failed, because I neede the following "dependencies".

image.thumb.jpeg.eb40ac7c542b95889c80c649fb005a8f.jpeg

 

Geat, so another hour or so google searching each of these things by name, until i found a copy/paste command line to install each.  After I managed to install some of these things, apparently of them was just the right one, and afterwards I got the option to "accept this solution".  I typed Y, hit enter, and it installed a whole bunch of shit.

 

  I went back and tried the "ffmpeg" install command again.  For the first time, something actually worked.  Oddly, this time It gave me a list of other dependencies that needed to be installed as well.  So, I typed Y and hit enter, again,  and got this:

 

image.thumb.jpeg.9f2f5b7fdb61aba03b19339189469ae1.jpeg

 

Naturally, at this point the cam still wasn't working in Mainsail.  So, i went back to the Crowsnest github thing, and copied/pasted the install command into the ssh terminal, and oddly, it worked.  Crowsnest installed this time.

 

Feeling confident, i rebooted the Orange Pi and opened up Sailboat, and it was working!  No webcam.txt files. No config files.  Just, a webcam image of my assistant, who took care of the sacrificed chicken.

 

image.thumb.jpeg.a594144a252fe19a15a8b8b5bc790ab5.jpeg

 

There.  Done!

  • Like 3
  • Thanks 1
Link to comment
Share on other sites

Glad you got this sorted. Sounded frustrating as. Thanks for sharing. I am sure this will help some other poor fellow struggling with the complexities of operating systems - like me 😁

  • Like 1
Link to comment
Share on other sites

55 minutes ago, ken226 said:

FFMpeg,  whatever the f...

Audio and video codecs library, basically you want to do anything video related on Linux you need ffmpeg. Good detective work figuring this out, and really helpful that you have publised it.

As you say we're goint to see more of these issues as people branch away from PIs. To be fair it's not the PI that's the issue rather the OS distro someone has put together. We are all often spoiled by the huge amount of work various teams put into creating these distros (bit like VoronDesign's excellent work)......and there again equally frustrated when the efforts are lacking various "standard" or "expected" components.

  • Like 2
Link to comment
Share on other sites

Untitled2.thumb.jpg.6f3e892f08a7cdaadb2ba534a215b119.jpgThanks for all the help guys.

 

I modeled up and printed a mount for the C270.  It replaces the little clip thing that comes on the camera.

Just peel off the rubber screw covers, remove the screw, push the pin out and replace the clip with this part.

 

I printed my in black ABS.

Here it is for download, on Printables.

Ken226 | Printables.com

 

 

 

Untitled2.thumb.jpg.6f3e892f08a7cdaadb2ba534a215b119.jpg

Untitled.thumb.jpg.952842ee7f27d17ac1ac79fb807c2808.jpg

IMG_20221213_204718606.jpg

Edited by ken226
  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...