#!/bin/bash ### BEGIN INIT INFO # Provides: omxplayer # Required-Start: # Required-Stop: # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Displays camera feeds for monitoring # Description: ### END INIT INFO sudo killall omxplayer.bin #if other omxplayer instances are running, kill them before startin a new instance #top_left="screen -dmS top_left sh -c 'omxplayer --avdict 'rtsp_transport:tcp' --win \"0 0 960 540\" rtsp://xxxuserxxx:@xxxpassxxx@192.168.0.xx:xx/h264/ch1/sub/ --live'"; #top_right="screen -dmS top_right sh -c 'omxplayer --vol -6000 --avdict 'rtsp_transport:tcp' --win \"960 0 1920 540\" rtsp://xxxuserxxx:@xxxpassxxx@192.168.0.xx:xx/3 --live'"; #bottom_left="screen -dmS bottom_left sh -c 'omxplayer --avdict 'rtsp_transport:tcp' --win \"0 540 960 1080\" rtsp://xxxuserxxx:@xxxpassxxx@192.168.0.xx/h264/ch1/sub/ --live'" #bottom_right="screen -dmS bottom__right sh -c 'omxplayer --avdict 'rtsp_transport:tcp' --win \"960 540 1920 1080\" rtsp://xxxuserxxx:@xxxpassxxx@192.168.0.xx:xx/h264/ch1/sub/ --live'"; top_left="screen -dmS top_left sh -c 'omxplayer --avdict 'rtsp_transport:tcp' --win \"0 0 960 540\" rtsp://xxxuserxxx:@xxxpassxxx@192.168.0.xx:xx/h264/ch1/sub/ --live'"; top_right="screen -dmS top_right sh -c 'omxplayer --vol -6000 --avdict 'rtsp_transport:tcp' --win \"960 0 1920 540\" rtsp://xxxuserxxx:@xxxpassxxx@192.168.0.xx:xx/av0_1/ --live'"; bottom_left="screen -dmS bottom_left sh -c 'omxplayer --avdict 'rtsp_transport:tcp' --win \"0 540 960 1080\" rtsp://xxxuserxxx:@xxxpassxxx@192.168.0.xx:xx/av0_1/ --live'"; bottom_right="screen -dmS bottom__right sh -c 'omxplayer --avdict 'rtsp_transport:tcp' --win \"960 540 1920 1080\" rtsp://xxxuserxxx:@xxxpassxxx@192.168.0.xx:xx/h264/ch1/sub/ --live'"; camera_feeds=(top_left top_right bottom_left bottom_right) # --video_queue x use if extra buffering is needed; 1 is usually sufficient #---- There should be no need to edit anything below this line ---- # Start displaying camera feeds case "$1" in start) for i in "${camera_feeds[@]}" do eval eval '$'$i done echo "Camera Display Started" ;; # Stop displaying camera feeds stop) sudo killall omxplayer.bin echo "Camera Display Ended" ;; # Restart any camera feeds that have died repair) for i in "${camera_feeds[@]}" do if !(screen -list | grep -q $i) then eval eval '$'$i echo "$i is now running" fi done ;; *) echo "Usage: /etc/init.d/displaycameras {start|stop|repair}" exit 1 ;; esac