Skip to content

Instantly share code, notes, and snippets.

@jneilliii
Last active June 8, 2024 18:22
Show Gist options
  • Save jneilliii/fb40f42d16887649b58699f002fe48ec to your computer and use it in GitHub Desktop.
Save jneilliii/fb40f42d16887649b58699f002fe48ec to your computer and use it in GitHub Desktop.

SSH to Pi using putty, run these commands

curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo groupadd docker
sudo usermod -aG docker $USER
sudo systemctl disable webcamd
sudo systemctl disable ffmpeg_hls
sudo service webcamd stop
sudo service ffmpeg_hls stop
logout

log back in to SSH.

Choose ONE of the following

  • run this command for an IP camera using RTSP
docker run -d --restart unless-stopped \
    --name restreamer \
    -e "RS_USERNAME=..." -e "RS_PASSWORD=..." -e "RS_MODE=USBCAM" \
    -e "RS_USBCAM_FPS=10" -e "RS_USBCAM_WIDTH=1280" -e "RS_USBCAM_HEIGHT=720" \
    -e "RS_SNAPSHOT_INTERVAL=10s" \
    -p 8080:8080 \
    -v /mnt/restreamer/db:/restreamer/db \
    --tmpfs /var/run/hls \
    datarhei/restreamer-armv7l:latest
  • run this command for a usb camera, make sure the device (/dev/video0) is the correct path to your camera by running v4l2-ctl --list-devices.
docker run -d --restart unless-stopped \
    --name restreamer \
    -e "RS_USERNAME=..." -e "RS_PASSWORD=..." -e "RS_MODE=USBCAM" \
    -e "RS_USBCAM_FPS=10" -e "RS_USBCAM_WIDTH=1280" -e "RS_USBCAM_HEIGHT=720" \
    -e "RS_SNAPSHOT_INTERVAL=10s" -e "RS_INPUTSTREAM=rtmp://127.0.0.1/live/usbcam.stream" \
    -p 8080:8080 \
    -v /mnt/restreamer/db:/restreamer/db \
    --device /dev/video0:/dev/video \
    --tmpfs /var/run/hls \
    datarhei/restreamer-armv7l:latest
  • run this command for a raspi camera, make sure the device (/dev/video0) is the correct path to your camera by running v4l2-ctl --list-devices.
docker run -d --restart unless-stopped \
    --name restreamer \
    -e "RS_USERNAME=..." -e "RS_PASSWORD=..." -e "RS_MODE=RASPICAM" \
    -e "RS_RASPICAM_FPS=10" -e "RS_RASPICAM_WIDTH=1920" -e "RS_RASPICAM_HEIGHT=1080" \
    -e "RS_SNAPSHOT_INTERVAL=10s" -e "RS_INPUTSTREAM=rtmp://127.0.0.1/live/raspicam.stream" \
    -p 8080:8080 \
    -v /mnt/restreamer/db:/restreamer/db \
    -v /opt/vc:/opt/vc \
    --tmpfs /var/run/hls \
    --privileged \
    datarhei/restreamer-armv7l:latest

open browser to http://ip:8080/ and login with username password specified in docker run command above.

add your rtsp stream url in restreamer, set options accordingly and start. for a locally connected USB or picam enter rtmp://127.0.0.1/live/usbcam.stream with the option copy for video codec.

image

in octoprint's webcam & timelapse settings set the stream url to http://ip:8080/hls/live.stream.m3u8 and snapshot url to http://ip:8080/images/live.jpg

Example rtsp test stream of BigBuckBunny... image

@jneilliii
Copy link
Author

jneilliii commented Jun 2, 2022

/dev/video0 looks like a raspicam style camera on the CSI connection and in most cases will be the correct device if there is only one camera.

@jneilliii
Copy link
Author

The above commands are valid for a raspberry pi but runs the older restreamer versions. If you want to use the newer restreamer version with a connected camera to the pi use the following command:

docker run -d --restart=unless-stopped --name restreamer \
--tmpfs /var/run/hls \
--privileged \
-v /opt/restreamer/config:/core/config \
-v /opt/restreamer/data:/core/data \
-p 8080:8080 -p 8181:8181 \
-p 1935:1935 -p 1936:1936 \
-p 6000:6000/udp \
datarhei/restreamer:rpi-2.2.0

If you are using restreamer with an IP Camera use this command:

docker run -d --restart=unless-stopped --name restreamer \
--tmpfs /var/run/hls \
-v /opt/restreamer/config:/core/config \
-v /opt/restreamer/data:/core/data \
-p 8080:8080 -p 8181:8181 \
-p 1935:1935 -p 1936:1936 \
-p 6000:6000/udp \
datarhei/restreamer:rpi-2.2.0

@Z1mDMan
Copy link

Z1mDMan commented Apr 25, 2023

I tried following this but wasn't able to get docker running. I kept getting an error asking if docker was running...

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

@jneilliii
Copy link
Author

I'm in no way a docker expert, so I would suggest searching for why docker isn't installing properly, and possibly reference online resources for how to properly install docker, my instructions may be outdated.

@Rahulsharma0810
Copy link

Rahulsharma0810 commented Jan 3, 2024

@jneilliii Thanks for the Setup

When I test the snapshot, it works, but it shows a black frame on the control screen.

image

image

image

@jneilliii
Copy link
Author

What URL did you use for stream, snapshot had nothing to do with control tab.

@Rahulsharma0810
Copy link

I mean to say in video its just shows, Blank page in overprint and accessible through direct URL.

@jneilliii
Copy link
Author

That's why I need to see the full URL that you are using for both steam and snapshot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment