Skip to content

Instantly share code, notes, and snippets.

@kndt84
Created June 22, 2020 12:15
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kndt84/7a6984a0ee0b85db1a7c5c5de495283e to your computer and use it in GitHub Desktop.
Save kndt84/7a6984a0ee0b85db1a7c5c5de495283e to your computer and use it in GitHub Desktop.
VLC Player RTMP auto play with Raspberry Pi
#/bin/bash
PROG="VLC_STARTER"
IP=""
ID=""
PASS=""
export DISPLAY=:0
if [ "$1" = "" ]; then
echo "Usage: $0 [RGB|THERMO] boot"
exit 1
fi
[ "$2" = "boot" ] && STARTUP_SLEEP=60
MUTEX="/tmp/$PROG.running"
exec 9>"$MUTEX"
flock --exclusive --nonblock 9
[ $? -eq 0 ] || exit # Somebody has stolen the lock!
# Sleep some time till the network and the system clock are stabilized
[ -n "$STARTUP_SLEEP" ] && {
echo "Waiting the system becomes stable" >&9
echo "Waiting the system becomes stable "
sleep $STARTUP_SLEEP
STARTUP_SLEEP=
}
if [ "$1" = "RGB" ]; then
vlc -f rtsp://${ID}:${PASS}@${IP}
else
vlc -f rtsp://${ID}:${PASS}@${IP}/Streaming/channels/201
fi
@kndt84
Copy link
Author

kndt84 commented Jun 22, 2020

Setting for crontab

SHELL=/bin/bash
MAILTO=""
@reboot $HOME/monitor RGB boot >> "$HOME/log/monitor.log" 2>&1
*/1 * * * * $HOME/monitor RGB >> "$HOME/log/monitor.log" 2>&1

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