-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgenerate_http_content.sh.in
40 lines (32 loc) · 1.12 KB
/
generate_http_content.sh.in
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
#!/bin/sh
# generate 'video content' with various on/off periods and various bitrates
# on/off period length in seconds
PERIODS="@PERIODS@"
# bitrates in kpbs
BRATES="@BRATES@"
# video duration in seconds
DURATION="@DURATION@"
for P in $PERIODS; do
for R in $BRATES; do
mkdir -p video_files-${P}-${R}
if [ ! -e video_files-${P}-${R}/0 ] ; then
# generate file for prefetch (assume max of 60 seconds)
PREFETCH_SIZE=`echo "60 ${R}" | awk '{ printf("%.0f", $1 * $2 * 1000 / 8) }'`
dd if=/dev/zero of=video_files-${P}-${R}/0 bs=${PREFETCH_SIZE} count=1 2> /dev/null;
fi
if [ -e video_files-${P}-${R}/1 ] ; then
SIZE=`ls -l video_files-${P}-${R}/1 | awk '{ print $5 }'`
else
SIZE=-1
fi
# chunk size in bytes
CHUNK_SIZE=`echo "${P} ${R}" | awk '{ printf("%.0f", $1 * $2 * 1000 / 8) }'`
if [ ${CHUNK_SIZE} -ne ${SIZE} ] ; then
# number of chunks
CHUNK_CNT=`echo "${P} ${DURATION}" | awk '{ printf("%.0f", $2 / $1 ) }'`
for J in `seq 1 $CHUNK_CNT`; do
dd if=/dev/zero of=video_files-${P}-${R}/${J} bs=${CHUNK_SIZE} count=1 2> /dev/null;
done;
fi;
done;
done;