Skip to content

Commit

Permalink
add stable-ffplay script
Browse files Browse the repository at this point in the history
  • Loading branch information
iSchluff committed Nov 14, 2020
1 parent d15f44b commit 2f25141
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions scripts/stable-ffplay.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/sh
# srt-live-transmit wrapper which actually manages to reconnect a failed srt stream
url=$1
pid=$$
fifo="/tmp/srt.${pid}"

trap 'rm "${fifo}"' EXIT

while true; do
srt-live-transmit -a no "${url}" file://con > ${fifo} &
p1=$!
ffplay -v warning -hide_banner -nostats ${fifo} &
p2=$!

# check whether we still have 2 running jobs
num_jobs="$(jobs -p | wc -l)"
while [ $num_jobs -ge 2 ]; do
sleep 1
num_jobs="$(jobs -p | wc -l)"
done

kill ${p1} ${p2}
sleep 1
done

0 comments on commit 2f25141

Please sign in to comment.