-
Notifications
You must be signed in to change notification settings - Fork 1
/
bento4.sh
executable file
·48 lines (40 loc) · 1.58 KB
/
bento4.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
46
47
48
#! /bin/bash
set -e
EXEC_PREFIX=/opt/bento4/bin
MOUNTPOINT=/mnt
#ls -r /opt/bento4
#sed -i -e '680s@.*@ buffer_size = (buffer_time*bandwidth)/10.0@' /opt/bento4/utils/mp4utils.py
#sed -i -e '684s@.*@ max_avail = buffer_size+accu_duration*bandwidth/10.0@' /opt/bento4/utils/mp4utils.py
#sed -i -e '686s@.*@ bandwidth = 10.0*(accu_size-buffer_size)/accu_duration@' /opt/bento4/utils/mp4utils.py
#cat /opt/bento4/utils/mp4utils.py
if [ $# -lt 1 -o "$1" = "ls" ]; then
cat << EOF
Bento4 in Docker $BENTO4_VERSION
Usage: bento4 tool [args ...]
bento4 ls
Bento4 in Docker is a containerized version of Bento4,
with support of HTTP(S) URL.
if URL ends with @[0-9]+-[0-9]*, the part of the URL string from the '@'
(without quotes) until the end of the string will be removed and the
ending paramter with be converted into a HTTP range header
(https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35).
Available tools:
`ls $EXEC_PREFIX/* | sed -e '/.so$/d' -e 's/.*\/\([^/]\+\)$/ \1/'`
See https://www.bento4.com/documentation/ for details on the command.
Running the tool without any argument will print out a summary of the tool’s command line options and parameters.
EOF
else
args="$1"
tmpd=`mktemp -d`
cd $MOUNTPOINT
for arg in ${@:2}; do
if echo $arg | grep -q '^http'; then
tmp=`mktemp -p $tmpd`
echo $arg | sed -e 's/^\(.*\)@\([0-9]\+-[0-9]*\)$/-H "Range:bytes=\2" \1/' | xargs curl -s -o $tmp
arg=$tmp
fi
args="${args} ${arg}"
done
$EXEC_PREFIX/$args
rm -rf $tmpd
fi