forked from livepeer/go-livepeer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
transcode_demo.sh
executable file
·45 lines (40 loc) · 1.03 KB
/
transcode_demo.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env bash
url='localhost:8935'
manifestID='current'
print_usage() {
printf "Usage: use -u to specify the url (default localhost:8935), use -m to specify manifestID (default current.m3u8)"
}
while getopts ":u:m:h" opt; do
case ${opt} in
u )
url=$OPTARG
echo "url: $url"
;;
m )
manifestID=$OPTARG
echo "manifestID: $manifestID"
;;
h )
print_usage
;;
\? )
echo "Invalid option: $OPTARG" 1>&2
;;
: )
echo "Invalid option: $OPTARG requires an argument" 1>&2
;;
esac
done
sURI="$url/stream/$manifestID.m3u8"
manifest=$(curl -s $sURI 2> /dev/null)
if [ -z "$manifest" ]
then
echo "Empty response from $url/stream/$manifestID.m3u8. Make sure the -currentManifest flag is on, or use -h to get usage options."
exit
fi
sid1=$(echo $manifest| cut -d' ' -f 4)
sid2=$(echo $manifest| cut -d' ' -f 6)
sid3=$(echo $manifest| cut -d' ' -f 8)
ffplay "http://$url/stream/$sid1" &
ffplay "http://$url/stream/$sid2" &
ffplay "http://$url/stream/$sid3" &