Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 55 lines (50 sloc) 0.971 kb
49790f8 @thayama Added Motion JPEG streaming support.
thayama authored
1 #!/bin/bash
2 #
3 # Motion JPEG test
4 #
32044bc @thayama Fixed minor typo in the comment of mjpeg_test.sh.
thayama authored
5 # After running this shell script, open http://localhost:3000/mjpeg/ with
620bc3d @kfish mention sighttpd-stdin-mjpeg.conf in mjpeg_test.sh
authored
6 # Firefox. You will need the following in /etc/sighttpd/sighttpd.conf
7 # (or use the sighttpd-stdin-mjpeg.conf file, which will be installed
8 # in $prefix/share/sighttpd)
49790f8 @thayama Added Motion JPEG streaming support.
thayama authored
9 #
70d8a89 @kfish fix documentation for /mjpeg streaming
authored
10 # -----
11 # Listen 3000
12 #
13 # <Stdin>
14 # Path "/mjpeg/"
15 # Type "multipart/x-mixed-replace; boundary=++++++++"
16 # </Stdin>
17 # -----
49790f8 @thayama Added Motion JPEG streaming support.
thayama authored
18
19 if [ $# -lt 1 ]; then
20 echo "Usage: $0 jpeg_file [...]"
21 exit 1;
22 fi
23
24 count=0
25 while [ $# -gt 0 ];
26 do
27 if [ ! -f $1 ]; then
28 echo "File '$1' not fonund."
29 else
30 FILE[$count]=$1
31 SIZE[$count]=`ls -l $1 | awk '{ print $5 }'`
32 ((count++))
33 fi
34 shift;
35 done
36
37 PORT=3000
b3a0abc @kfish move mjpeg_test.sh to examples/, add to dist
authored
38 SIGHTTPD=sighttpd
49790f8 @thayama Added Motion JPEG streaming support.
thayama authored
39 BOUNDARY=++++++++
40
41 (
42 while true;
43 do
44 n=0
45 while [ $n -lt $count ];
46 do
47 printf "\r\n\r\n--%s\r\n" ${BOUNDARY}
48 printf "Content-type: image/jpeg\r\n"
49 printf "Content-length: %d\r\n\r\n" ${SIZE[$n]}
50 cat ${FILE[$n]}
51 ((n++))
52 done;
53 done
54 ) | ${SIGHTTPD} ${PORT}
Something went wrong with that request. Please try again.