LoginSignup
8
9

More than 5 years have passed since last update.

motionでwebカメラを活用する

Last updated at Posted at 2015-05-12

参考: linux-motion-webcamでライブ監視カメラを設置する

install

  • webカメラが認識されていること。
    • /dev/video0 ができていれば良い。
pacman -Sy motion

設定

/etc/motion/motion.conf
- target_dir /usr/local/apache2/htdocs/cam1
+ target_dir /srv/motion
sudo mkdir /srv/motion
sudo chmod 777 /srv/motion

起動

systemctl start motion

確認

ls -l /srv/motion

jpgとaviができている。

cd /srv/motion
python -m http.server
  • http://ipaddr:8000 にアクセス
  • aviファイルはvlcで再生できる。
    • jpgを連結したもの。

その他

ストリーミングで見たい場合

/etc/motion/motion.conf
- webcam_localhost on
+ webcam_localhost off

vlc で http://ipaddr:8081 を指定すると見れる。

もしくはraspberry pi に webカメラを繋いでみるを参考に

<html>
<body>
<img src="http://192.168.0.8:8081">
</body>
</html>

設定をwebから変更

/etc/motion/motion.conf
- control_localhost off
+ control_localhost on

webブラウザで http://ipaddr:8080 にアクセスするとmotionの設定が変更できる。

解像度変更

/etc/motion/motion.conf
- width 320
- height 240
+ width 640
+ height 480

画像を保存しない

output_normal off

画像をメール送信

大量のメールが来るようになるので、別方法をとったほうが良い。

uuencode,uudecodeをインストール
pacman -Sy sharutils
on_picture_save uuencode %f %f | mail -s "from:motion" hoge@hoge.com
8
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
9