Ubuntu中使用motion制作监控

您所在的位置:网站首页 linux监控摄像头 Ubuntu中使用motion制作监控

Ubuntu中使用motion制作监控

2023-09-30 12:52| 来源: 网络整理| 查看: 265

原文连接:原文连接,欢迎访问

安装摄像头

制作监控,首先要在ubuntu系统中安装usb摄像头,安装好之后,使用ls /dev/video*查看摄像头设备的名称。且不要随意插拔设备,否则会造成设备名称的改变,影响motion的配置文件。 如果成功安装就会有如下显示: file 记住设备的名称。

安装motion

如果是在ubuntu下,只需要执行apt-get install motion即可。安装完成后,执行motion会输出好的东西。

[14909824] [NTC] [ALL] conf_load: Processing thread 0 - config file /root/.motion/motion.conf//执行的配置文件,一开始不是这个 [14909824] [NTC] [ALL] motion_startup: Motion 3.2.12+git20140228 Started with SDL support [14909824] [NTC] [ALL] motion_startup: Logging to file (/var/log/motion/motion.log)//日志

大概是这些东西。如果进入日志,你应该会看到[1] Failed to open video device /dev/video0: No such file or directory [1] Video signal lost - Adding grey image.这说明motion没有找到摄像头video0。这时候你访问8081端口应该会看到灰色图像。使用sudo /etc/init.d/motion stop或者ps -ef | grep motion 然后一个个杀死或者是ctrl+c停止motion。 还是一个一个杀死好用。

配置motion

在你的主目录创建一个.motion目录,并将默认配置文件考进目录,然后把归属权改为你自己。

mkdir ~/.motion cp /etc/motion/motion.conf ~/.motion/ chown 你自己 ~/.motion/motion.conf

创建一个目录来存储图像和视频。mkdir ~/motion-images. 当你启动Motion后,它会寻找配置文件,先在当前目录下寻找,然后在/.motion下寻找,最后在/etc/motion下寻找。现在,编辑你的/.motion/motion.conf文件

# Start in daemon (background) mode and release terminal (default: off) daemon on//是否以守护进程在后台运行。测试时选off,最后当监控时当然要一直运行。 # Use a file to save logs messages, if not defined stderr and syslog is used. (default: not defined) logfile /var/log/motion/motion.log//日志 # Videodevice to be used for capturing (default /dev/video0) # for FreeBSD default is /dev/bktr0 videodevice /dev/video2 //使用的相机名称,一定要和前面的一致。 # Restrict stream connections to localhost only (default: on) stream_localhost off//是否远程访问 # The mini-http server listens to this port for requests (default: 0 = disabled) stream_port 8080//访问那个端口看到视频 8081就可以 target_dir /home/carla/motion-images //图像存储的地方

再创建应该sudo mkdir /var/run/motion存储pid 配置好这些,再使用motion启动应该就没问题了吧。然后通过localhost:8081或者ip:8081访问。 motion -c ~/.motion/motion.conf或者拿这个启动.



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3