Up MJPG-streamer 起動スクリプト 作成: 2021-01-27
更新: 2021-02-13


  • 起動コマンドが長いので,起動用シェルスクリプトをつくる:
      $ vi /home/pi/mjpg.sh
      #!/bin/sh PORT="8080" WIDTH=$1 HEIGHT=$2 FRAMERATE=$3 QUALITY=$4 OUT="/home/pi/mjpg-streamer/www" if [ $WIDTH = "?" ]; then echo "mjpg width height framerate quality" echo "quality : 0-100" exit else mjpg_streamer \ -i "input_raspicam.so -x $WIDTH -y $HEIGHT -fps $FRAMERATE -q $QUALITY" \ -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 &
        MJPG Streamer Version: git rev: 5554f42c352ecfa7edaec6fc51e507afce605a34 i: fps.............: 10 i: resolution........: 320 x 240 i: camera parameters..............: Sharpness 0, Contrast 0, Brightness 50 Saturation 0, ISO 0, Video Stabilisation No, Exposure compensation 0 Exposure Mode 'auto', AWB Mode 'auto', Image Effect 'none' Metering Mode 'average', Colour Effect Enabled No with U = 128, V = 128 Rotation 0, hflip No, vflip No ROI x 0.000000, y 0.000000, w 1.000000 h 1.000000 o: www-folder-path......: /home/pi/mjpg-streamer/www/ o: HTTP TCP port........: 8080 o: HTTP Listen Address..: (null) o: username:password....: disabled o: commands.............: enabled i: Starting Camera Encoder Buffer Size 81920
      コマンドの最後の「&」は,「デーモンで起動」
      起動メッセージに対しリターンキーで,コマンドプロンプトを得る


  • ps で起動を確認
      $ ps -ef | grep mjpg pi 7685 7684 1 01:12 pts/1 00:00:01 mjpg_streamer -i input_raspicam.so -x 320 -y 240 -fps 10 -q 80 -o output_http.so -p 8080 -w /home/pi/mjpg-streamer/www

  • PCからアクセス
      http://[IPアドレス]:8080/stream_simple.html