查看: 2012|回复: 0

pcDuino8 Uno入门系列:如何用motion工具实现视频监控

[复制链接]

该用户从未签到

发表于 2016-5-13 12:56:41 | 显示全部楼层 |阅读模式
分享到:
pcDuino8 Uno+摄像头+开源工具,几分钟搞定远程视频监控!
硬件准备
  • USB Webcam
  • pcDuino8 Uno
1. 安装软件
[color=white !important]
[color=white !important]?

1

2

sudo apt-get update
sudo apt-get install motion



2.  修改配置文件
[color=white !important]
[color=white !important]?

1

sudo vi /etc/motion/motion.conf



[color=white !important]
[color=white !important]?

1

2

3

4

5

6

7

8

9

10

11

12

13

14

需要确认下面这些参数:
daemon on #default off (This allows the motion to run in the background)
framerate 10 #default 2 (increased framerate)
width 640 #default 320 (changed width to match that of the webcam)
height 480 #default 240 (same as above but for height)
threshold 2000 #default 1500 (*explained in detail below)
pre_capture 2 #default 0 (captures 2 frames before motion was detected and adds that to the videos to make them smoother)
post_capture 5 #default 0 (same as above but captures frames after)
output_normal off #default on (this disables storing images, since we only require video)
ffmpeg_video_codec msmpeg4 #default swf (msmpeg4 is accepted by windows media player, hence easier to play on Windows)
target_dir /mnt/motionvideos #default /tmp/motion (changed the directory where videos will be stored)
webcam_maxrate 5 #default 1 (increase the max framerate on lie stream)
webcam_localhost off #default on (allows you to set up a live stream of the webcam)
注意:上面的部分参数需要根据你的摄像头实际参数进行设置



3. 创建目录
我们需要根据上面的target_dir创建一个目录:
[color=white !important]
[color=white !important]?

1

2

sudo mkdir /mnt/motionvideos
sudo chown motion /mnt/motionvideos



4. 修改默认的配置文件,允许后台启动
[color=white !important]
[color=white !important]?

1

sudo vi /etc/default/motion



将其中的start_motion_daemon=no 修改成 yes.
5. 插入USB摄像头,确认系统可以识别
[color=white !important]
[color=white !important]?

1

ls /dev/video0



6. 启动服务
[color=white !important]
[color=white !important]?

1

2

3

ubuntu@RPI:~$ sudo service motion start
* Starting motion detection daemon motion       [ OK ]
如果要关闭服务,可运行:



[color=white !important]
[color=white !important]?

1

sudo service motion stop



7.  测试
pcDuino8 Uno接入局域网,获得IP地址。在同一局域网中的一台电脑或手机上,浏览器访问:
<pcDuino8 Uno IP Address>:8081
可看到摄像头播放的视频:



camera1.png
回复

使用道具 举报

您需要登录后才可以回帖 注册/登录

本版积分规则

手机版|小黑屋|与非网

GMT+8, 2024-4-24 06:33 , Processed in 0.112573 second(s), 16 queries , MemCache On.

ICP经营许可证 苏B2-20140176  苏ICP备14012660号-2   苏州灵动帧格网络科技有限公司 版权所有.

苏公网安备 32059002001037号

Powered by Discuz! X3.4

Copyright © 2001-2024, Tencent Cloud.