上一篇文章写了如何把树莓派打形成能够远程访问的服务器,有了这台服务器,咱们的树莓派终极玩法能够正式开始了。web
此次,咱们来给树莓派装个 USB 摄像头,而后远程访问摄像头拍摄的即时画面。chrome
很是简单只须要一个软件:motion。vim
假设你的树莓派已经装好了 Raspbian 的系统,你只须要:浏览器
$ sudo apt-get install motion
而后打开 motion daemon 守护进程,让他能够一直在后台运行:服务器
sudo nano /etc/default/motion #no修改为yes: start_motion_daemon=yes
修改motion的配置文件:网络
sudo vim /etc/motion/motion.conf #deamon off 改为 on deamon on #设置分辨率 width 800 height 600 #关闭 localhost 的限制 webcam_localhost off
而后运行 motion:dom
$ sudo motion
如今咱们的摄像头已经变成了一台网络摄像头。在非chrome浏览器(chrome 不支持 mjpg streaming)下访问 http://[your.domain]:8081 便可看到摄像头当前拍摄的画面。code