- plugin USB camera was identified , check lsusb before and after
root@octopi:/home/pi# lsusb
Bus 001 Device 005: ID 2c99:0002
Bus 001 Device 004: ID 2c99:0002
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
root@octopi:/home/pi# lsusb
Bus 001 Device 005: ID 2c99:0002
Bus 001 Device 006: ID 0ac8:3500 Z-Star Microelectronics Corp.
Bus 001 Device 004: ID 2c99:0002
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
- check what process is running your first camera and where it sends output
t@octopi:/home/pi# ps -ef | grep mjpg
pi 657 578 0 04:43 ? 00:01:54 ./mjpg_streamer -o output_http.so -w ./www-octopi -n -i input_uvc.so -r 640x480 -f 10
- start new process under
root@octopi: cd /home/pi/mjpg-streamer
root@octopi:/home/pi/mjpg-streamer LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./;./mjpg_streamer -i "input_uvc.so -d /dev/video1 -y 630x480 " -o "output_http.so -w ./www-octopi -p 8801"
- Check that new process is created
root@octopi:/home/pi# ps -ef | grep mjpg
pi 657 578 0 04:43 ? 00:01:54 ./mjpg_streamer -o output_http.so -w ./www-octopi -n -i input_uvc.so -r 640x480 -f 10
pi 4559 4208 68 19:11 pts/0 00:00:07 ./mjpg_streamer -i input_uvc.so -d /dev/video1 -y 630x480 -o output_http.so -w ./www-octopi -p 8801
root 4565 4500 0 19:11 pts/1 00:00:00 grep mjpg
- Check that web stream 1 is running
http://192.168.0.213/?action=stream
- Check that second stream is running
http://192.168.0.213:8801/?action=stream
- Edit your crontab and add following line
crontab -e
@reboot /home/pi/mjpg-streamer/mjpg_streamer -i "input_uvc.so -d /dev/video1 -y 630x480 " -o "output_http.so -w ./www-octopi -p 8801"
- Setup your haproxy configuration
frontend public
bind *:80
bind 0.0.0.0:443 ssl crt /etc/ssl/snakeoil.pem
option forwardfor except 127.0.0.1
use_backend webcam if { path_beg /webcam/ }
use_backend webcam2 if { path_beg /webcam2/ }
use_backend octoprint if { path_beg /octoprint/ }
use_backend octoprint2 if { path_beg /octoprint2/ }
default_backend webcam
backend webcam2
reqrep ^([^\ :])\ /webcam2/(.) \1\ /\2
server webcam2 127.0.0.1:8801
errorfile 503 /etc/haproxy/errors/503-no-webcam.http
- restart HA proxy
root@octopi:/home/pi# sudo /etc/init.d/haproxy restart
[ ok ] Restarting haproxy (via systemctl): haproxy.service.
- disable default webcamd
root@octopi:/home/pi# more /etc/default/webcamd
# Configuration for /etc/init.d/webcamd
# Daemon
DAEMON=/root/bin/webcamd
# Log file to use
LOG=/var/log/webcamd.log
# User to run under
USER=pi
# Should we run at startup?
ENABLED=0
Original article:
I had a positive experience with RPi camera (Noir or normal) together with one small USB camera. It was quite (resources) expensive, but RPi3 was ok with that.
I have used https://github.com/jacksonliam/mjpg-streamer
In the directory mpjg-streamer was installed:
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./;./mjpg_streamer -i "input_uvc.so -d /dev/video0 -y 630x480 " -o "output_http.so -w ./www -p 8080
and for the raspberry I used this:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./;./mjpg_streamer -i "input_raspicam.so -hf -vf -x 1024 -y 768 -mm matrix -fps 3 " -o "output_http.so -w ./www -p 8088"
These commands I run using two times screen
(like screen -S rpi
and screen -S usb
) to be able to log out and leave them running. You can play with options the options for both camera (-y
on usb enables most of cams with yuv mode, -d
is sometimes needed.).
I have even a complicated script with a loop that starts cams, but I doubt it is mature enough to be widely used. You have the output as http on ports 8080 and 8088.