- 起動コマンドが長いので,起動用シェルスクリプトをつくる:
$ cd /home/ubuntu/mjpg-streamer
$ vi mjpg.sh
#!/bin/sh
PORT="8080"
WIDTH=$1
HEIGHT=$2
FRAMERATE=$3
QUALITY=$4
OUT="/home/ubuntu/mjpg-streamer/www"
if [ $WIDTH = "?" ]; then
echo "mjpg width height framerate quality"
echo "quality : 0-100"
exit
else
export LD_LIBRARY_PATH=/usr/local/lib/mjpg-streamer
mjpg_streamer \
-i "input_uvc.so -r ${WIDTH}x${HEIGHT} -f $FRAMERATE -q $QUALITY -d /dev/video0 -y -n" \
-o "output_http.so -p $PORT -w $OUT"
fi
|
$ chmod 755 mjpg.sh
- コマンドの書式照会
~ $ ./mjpg.sh ?
mjpg width height quality framerate
quality : 0-100
- 起動
~ $ ./mjpg.sh 320 240 2 10 &
[1] 2412
MJPG Streamer Version: git rev: 310b29f4a94c46652b20c4b7b6e5cf24e532af39
i: Using V4L2 device.: /dev/video0
i: Desired Resolution: 320 x 240
i: Frames Per Second.: 2
i: Format............: YUYV
i: JPEG Quality......: 10
i: TV-Norm...........: DEFAULT
o: www-folder-path......: /home/ubuntu/mjpg-streamer/www/
o: HTTP TCP port........: 8080
o: HTTP Listen Address..: (null)
o: username:password....: disabled
o: commands.............: enabled
コマンドの最後の「&」は,「デーモンで起動」
(起動メッセージに対しリターンキーで,コマンドプロンプトを得る)
- ps で起動を確認
$ ps -ef | grep mjpg
ubuntu 2459 2003 0 11:31 pts/0 00:00:00 /bin/sh ./mjpg.sh 320 240 2 10
ubuntu 2461 2459 1 11:31 pts/0 00:00:01 mjpg_streamer
-i input_uvc.so -r 320x240 -f 2 -q 10 -d /dev/video0 -y -n
-o output_http.so -p 8080 -w /home/ubuntu/mjpg-streamer/www
- PCからアクセス
http://[IPアドレス]:8080/stream_simple.html
|