Author Topic: Troubleshooting Octoprint webcam streaming  (Read 13590 times)

0 Members and 1 Guest are viewing this topic.

Offline Alex_BakerTopic starter

  • Frequent Contributor
  • **
  • Posts: 292
  • Country: us
Troubleshooting Octoprint webcam streaming
« on: September 13, 2023, 12:46:29 pm »
Hey folks

For a long time now my raspberry pi refuses to stream my webcam to the octoprint webpage, I figured I would try and get it working. The webcam is a cheap generic usb one from amazon, and the PI is a 3B+ I think.

I have looked through several forum pages but they all ended up with "my mistake, the camera was broken or not plugged in all the way", not very useful to me. All the stream/snapshot urls are at their default values because I have never changed them. Going to  http://octopi.local/webcam/?action=stream I get 502 bad gateway, the snapshot stream under time lapse gives me a refused to connect error also.

Unfortunately I don't have time to screw around in the terminal right now, I know there are a few things to test. I will also try to get my hands on a different usb camera to see if that works. Anyway, there is some background, has anybody here had any experience with this kind of issue?
 

Online xrunner

  • Super Contributor
  • ***
  • Posts: 7738
  • Country: us
  • hp>Agilent>Keysight>???
Re: Troubleshooting Octoprint webcam streaming
« Reply #1 on: September 13, 2023, 12:58:19 pm »
Hey folks

For a long time now my raspberry pi refuses to stream my webcam to the octoprint webpage, I figured I would try and get it working. The webcam is a cheap generic usb one from amazon, and the PI is a 3B+ I think.

Hi,

What I can tell you is I've always had a camera on my Pi 3 B+ for Octoprint which uses a cable to the on-board CSI interaface slot on top of the Pi. It's always "just worked". Why don't you get that kind of camera?
I told my friends I could teach them to be funny, but they all just laughed at me.
 
The following users thanked this post: Lindley

Offline MarkF

  • Super Contributor
  • ***
  • Posts: 2677
  • Country: us
Re: Troubleshooting Octoprint webcam streaming
« Reply #2 on: September 13, 2023, 01:48:17 pm »
Here's what I did for my Logitech webcam:

Code: [Select]
Tools needed:
   Win32 Disk Imager from [url]https://sourceforge.net/projects/win32diskimager/[/url]
   PuTTY from [url]https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html[/url]

Images needed:
   Download OctoPi from [url]https://octoprint.org/download/[/url]

Latest image used:
   octopi-0.18.0-1.7.3-20220323100241.zip

Procedure:
   - Copy image to MicroSD card
   - Open MicroSD card
   - Edit "octopi-wpa-supplicant.txt"
         Uncomment WPA/WPA2 network section and enter WiFi SSID and PSK
         Uncomment the country Pi is in
   - Edit "octopi.txt" - Uncomment and set camera options:
         camera_usb_options="-r 960x540 -f 10"
         camera_raspi_options="-fps 10"
   - Insert card into Raspberry Pi and power up
   - Open PuTTY and access Pi:  "octopi.local"
   - Login:  username="pi" password="raspberry"
   - Change configuration:  sudo raspi-config
         Expand file system
         Change user password
         Advanced options >> Hostname
         Change PI hostname
   - Reboot

Change camera resolution:
   - Open PuTTY and access Pi:  "octopi.local"
   - Login:  username="pi" password="raspberry"
   - Change directory:  cd /root/bin
   - Edit "webcamd" file:  sudo nano webcamd
   - Change Init Config section:
         camera_usb_options="-r 960x540 -f 10"
         camera_raspi_options="-fps 10"
         CTRL-O
         CTRL-X
   - Reboot

->960x540, 864x486 smaller resolution

Get processor temperature:
   - Open PuTTY and access Pi:  "octopi.local"
   - Login:  username="pi" password="raspberry""
   - watch cat /sys/class/thermal/thermal_zone0/temp

Access OctoPrint from web browser:  http://octopi.local or http://hostname.local if hostname was changed

ALWAYS POWER DOWN RASPBERRY PI VIA OCTOPRINT (Top right system menu)

There are also some nice videos out there:
   

   
 

Offline Lindley

  • Regular Contributor
  • *
  • Posts: 206
  • Country: gb
Re: Troubleshooting Octoprint webcam streaming
« Reply #3 on: September 13, 2023, 08:06:57 pm »
Agree with @xrunner the Pi camera works fine for us and just as cheap or cheaper than a usb camera.

 

Offline Alex_BakerTopic starter

  • Frequent Contributor
  • **
  • Posts: 292
  • Country: us
Re: Troubleshooting Octoprint webcam streaming
« Reply #4 on: September 13, 2023, 10:16:59 pm »
Agree with @xrunner the Pi camera works fine for us and just as cheap or cheaper than a usb camera.

(Attachment Link)

I do like those cameras, however they will not work for my setup. I have a heated enclosure where the printer electronics are in a separate case outside, so the cable required is around 600mm, and the USB cam plugs into a panel mount USB on top of the electronics case. A delicate ribbon cable would not be very good in this scenario I don't think.

When I get a chance I will go into the terminal and try some things.
 

Online xrunner

  • Super Contributor
  • ***
  • Posts: 7738
  • Country: us
  • hp>Agilent>Keysight>???
Re: Troubleshooting Octoprint webcam streaming
« Reply #5 on: September 13, 2023, 10:53:01 pm »
I do like those cameras, however they will not work for my setup. I have a heated enclosure where the printer electronics are in a separate case outside, so the cable required is around 600mm ...

Extended cables available on Ebay, just saw one for that length.

Extended camera cable
I told my friends I could teach them to be funny, but they all just laughed at me.
 

Offline Alex_BakerTopic starter

  • Frequent Contributor
  • **
  • Posts: 292
  • Country: us
Re: Troubleshooting Octoprint webcam streaming
« Reply #6 on: September 14, 2023, 03:28:03 pm »

Extended cables available on Ebay, just saw one for that length.

Extended camera cable

Unless they make a panel mount connector that takes those ribbon cables this method won't work for my setup.

Also I may have solved my problem, we will see. While testing a few things in the terminal via ssh I was running into several issues that may have been caused by an out of date octoprint/linux install. I decided to go ahead and reinstall octoprint, it only took me about 40 minutes to get everything up and running again and so far the usb webcam is working fine. I was hoping to actually find a problem, but I guess this route is probably better in the long run.

Thanks
Alex
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf