I am setting up multiple rtsp streams on rpi2. The rpi will act like surveillance station. After some research I've managed to do that, here is my script below:
#!/bin/bash
screen -dmS camera1 sh -c 'omxplayer --win "0 37 960 577" "http://www.spruto.tv/get_file/1/38577f19393369cb2c5d785beb3c3ffc/80000/80730/80730.mp4?start=0"; exec bash'
screen -dmS camera2 sh -c 'omxplayer --win "960 37 1920 577" "http://www.spruto.tv/get_file/5/717a259eabde324b660eaf07d3b56c7f/110000/110197/110197.mp4?start=0"; exec bash'
screen -dmS camera3 sh -c 'omxplayer --win "0 577 960 1080" "http://www.spruto.tv/get_file/5/717a259eabde324b660eaf07d3b56c7f/110000/110197/110197.mp4?start=0"; exec bash'
screen -dmS camera4 sh -c 'omxplayer --win "960 577 1920 1080" "http://www.spruto.tv/get_file/1/38577f19393369cb2c5d785beb3c3ffc/80000/80730/80730.mp4?start=0"; exec bash'
The thing is when a stream got stuck due to latency or any other reasons, omxplayer quits.
I would like to add a loop to every line, which would basically check if the screen session exists, if not it would then start it.
Could anyone help me do that?