Have to RESTART WEBCAMD to get video feed

Just installed a second webcam and got both services running but now just a few random things that i cant seem to figure out....

What is the problem?

  1. If only first camera (called on by webcamd) is plugged in, it will start automatically BUT if both ARE plugged in, it does not. (second camera called on by webcam2d)

  2. Second camera will not startup on boot automatically

What did you already try to solve it?

  1. use the command sudo service webcamd restart in putty to enable camera1
  2. launch the file by typing /root/bin/webcam2d to enable camera2

BOTH work until i close putty or restart.

Logs
octoprint.log (3.6 MB) serial.log (148 Bytes)

Additional information about your setup

model: Raspberry Pi 4 Model B Rev 1.2
octopi_version: 0.17.0
octoprint 1.3.12 (will update soon now that i see TouchUI is fixed).....(How much would the community have to chip in to get you to incorporate something similar directly into octoprint @foosel :rofl)

I'm having a similar problem. I have 2 cameras: a RasPiCam and a Logitech C615. When I start up my RPi, I can see the power-on light for the Logitech USB camera come on initially, but then it goes off, but the associated webcam service is still running:

 pi@octopi:~ $ systemctl status webcamd2.service
● webcamd2.service - the OctoPi webcam daemon with the user specified config
   Loaded: loaded (/etc/systemd/system/webcamd2.service; enabled; vendor preset:
   Active: active (running) since Tue 2020-03-17 13:46:01 EDT; 1min 32s ago
  Process: 400 ExecStart=/root/bin/webcamd2 (code=exited, status=0/SUCCESS)
 Main PID: 500 (mjpg_streamer)
    Tasks: 2 (limit: 3911)
   Memory: 1.7M
   CGroup: /system.slice/webcamd2.service
           └─500 ./mjpg_streamer -o output_http.so -w ./www -p 8081 -i input_uvc

Mar 17 13:46:00 octopi mjpg_streamer[500]: MJPG-streamer [500]: commands........
Mar 17 13:46:00 octopi mjpg_streamer[500]: MJPG-streamer [500]: starting input p
Mar 17 13:46:00 octopi mjpg_streamer[500]: MJPG-streamer [500]: starting output 
Mar 17 13:46:01 octopi webcamd2[400]: Done bring up all configured video device
Mar 17 13:46:01 octopi webcamd2[400]: Goodbye...
Mar 17 13:46:01 octopi systemd[1]: Started the OctoPi webcam daemon with the use
Mar 17 13:46:41 octopi webcamd2[400]:  i: select() timeout
Mar 17 13:46:41 octopi webcamd2[400]:  i: cleaning up resources allocated by inp
Mar 17 13:46:41 octopi mjpg_streamer[500]: MJPG-streamer [500]: select() timeout
Mar 17 13:46:41 octopi mjpg_streamer[500]: MJPG-streamer [500]: cleaning up reso
lines 1-20/20 (END)...skipping...
● webcamd2.service - the OctoPi webcam daemon with the user specified config
   Loaded: loaded (/etc/systemd/system/webcamd2.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2020-03-17 13:46:01 EDT; 1min 32s ago
  Process: 400 ExecStart=/root/bin/webcamd2 (code=exited, status=0/SUCCESS)
 Main PID: 500 (mjpg_streamer)
    Tasks: 2 (limit: 3911)
   Memory: 1.7M
   CGroup: /system.slice/webcamd2.service
           └─500 ./mjpg_streamer -o output_http.so -w ./www -p 8081 -i input_uvc.so -d /dev/videoC615 -r 1920x1080 -f 30

Mar 17 13:46:00 octopi mjpg_streamer[500]: MJPG-streamer [500]: commands.............: enabled
Mar 17 13:46:00 octopi mjpg_streamer[500]: MJPG-streamer [500]: starting input plugin input_uvc.so
Mar 17 13:46:00 octopi mjpg_streamer[500]: MJPG-streamer [500]: starting output plugin: output_http.so (ID: 00)
Mar 17 13:46:01 octopi webcamd2[400]: Done bring up all configured video device
Mar 17 13:46:01 octopi webcamd2[400]: Goodbye...
Mar 17 13:46:01 octopi systemd[1]: Started the OctoPi webcam daemon with the user specified config.
Mar 17 13:46:41 octopi webcamd2[400]:  i: select() timeout
Mar 17 13:46:41 octopi webcamd2[400]:  i: cleaning up resources allocated by input thread
Mar 17 13:46:41 octopi mjpg_streamer[500]: MJPG-streamer [500]: select() timeout
Mar 17 13:46:41 octopi mjpg_streamer[500]: MJPG-streamer [500]: cleaning up resources allocated by input thread

When I go to the web address for the camera, I get a black screen. If I restart the service, it works fine until I reboot. Restarting Octoprint has no effect.

Raspberry Pi 4B
Octopi 0.17.0
Octoprint 1.4.0

1 Like

You could have those commands executed at startup, by editing etc/rc.local:
sudo nano /etc/rc.local
And than add those commands
before
exit 0
at the very end of the file, like this:

1 Like

I experienced a similar issue with a single A4Tech PK-910 HD 1080P Webcam. I noticed that even with a normal PI OS image mjpeg_streamer failed to start the stream on the first run, but on the second run the camera was successfully initialized and started streaming.

After reboot the webcam stream would not display in control, but running sudo service webcamd restart would start it immediately.

I added sudo service webcamd restart to rc.local and the problem is resolved.

1 Like

thx.
My single USB cam has the same issue sometimes.

Should I need to add both lines:
sudo service webcamd restart
/root/bin/webcam2d