Update apt packages
sudo apt update
Install omxplayer
sudo apt install omxplayer
Test Video Stream*
/usr/bin/omxplayer --win "961,541,1920,1080" "rtsp://username:password@ip_address:554/cam/realmonitor?channel=1&subtype=0"
* This is for an Amcrest IP camera. Look up the URL for your specific camera. You can remove ‘–win “961,541,1920,1080”‘ to make the video full screen. “subtype=0” is high bitrate stream. “subtype=1” is low bitrate stream.
Close Video Stream
Control-c to stop
Create Video Script
nano video.sh
#!/bin/bash /usr/bin/omxplayer --win "961,541,1920,1080" "rtsp://username:password@ip_address:554/cam/realmonitor?channel=1&subtype=0"
Control-o to save, Control-x to exit
Make the script executable
chmod +x video.sh
Run Script
./video.sh
Control-c to stop
Move into Systemd Service Directory
cd /etc/systemd/system
Create Video Service
sudo nano video.service
[Unit] Description=Video Service After=network.target [Service] Type=simple User=pi Group=pi Environment=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin ExecStart=/home/pi/video.sh Restart=always RestartSec=3 [Install] WantedBy=multi-user.target
Control-o to save, Control-x to exit
Enable Service
sudo systemctl enable video
Start Service
sudo systemctl start video
Temporarily Stop Video
sudo killall omxplayer
Adafruit Read Only Instructions*
https://learn.adafruit.com/read-only-raspberry-pi
* You can now enable OverlayFS as an alternative to these read only instructions. Go to raspi-config > Advanced Options > Overlay FS and enable it. This will make the system read only. You can undo and redo this if you need to make changes to the system.