Scipt Auto Start Live Video RTMP Omxplayer [Raspberry]

0 Shares

Insert this script into the file /rc.local or /.bashrc

tvservice -c "PAL 4:3"
omxplayer rtmp://ip_address:1935/app_name/stream_name
Script=/home/pi/script.sh

PID=$(ps ax | grep omxplayer.bi[n] | cut -d' ' -f2)

echo "PID = $PID"

##Loop to test if connection is present every 60 seconds
while [ $PID ];
    do
      sleep 60
      PID=$(ps ax | grep omxplayer.bi[n] | cut -d' ' -f2)
    done

#If connection is not found to be present execute this command to retry every 15 seconds

sleep 15

exec $Script

You May Also Like

Leave a Reply

Your email address will not be published. Required fields are marked *