树莓派+motion的网络摄像头

学习记录

将树莓派USB摄像头拍摄的画面通过USB摄像头显示出来

设备环境

  1. List item

搭建环境

首先安装motion。motion是Linux下一款开源的摄像头监控软件。

sudo apt-get install motion

接下来对motion进行配置

sudo vim /etc/default/motion

将no改为yes,保存退出


打开配置文件

sudo vim /etc/motion/motion.conf

开启后台运行模式(line 11)

daemon on	

视频显示(line 89)

# Image width (pixels). Valid range: Camera dependent, default: 352 
width 320

# Image height (pixels). Valid range: Camera dependent, default: 288
height 240

# Maximum number of frames to be captured per second.
# Valid range: 2-100. Default: 100 (almost no limit).
framerate 2

设置摄像头端口,建议将8081修改为其它数字,否则有可能出错(line 464)

stream_port 8085 

关闭仅本地连接(line 477)

stream_localhost off 

webcontrol设置(line 499)

# TCP/IP port for the http server to listen on (default: 0 = disabled)
webcontrol_port 8080                                                       

# Restrict control connections to localhost only (default: on)
webcontrol_localhost off

# Output for http server, select off to choose raw text plain (default: on)
webcontrol_html_output on

保存并退出

摄像头操作

开启摄像头

sudo motion

关闭摄像头

service motion stop

实测上面一句话没用。改用下面的命令关闭

sudo killall -TERM motion

最终结果

地址栏输入树莓派ip和端口号,在浏览器中观看视频。

例如:192.168.0.105:8085

各自输各自对应ip和端口号,不要按我的来。
焦距没调
焦距没有调,所以画面比较模糊。

帧率感人,卡成PPT。因为本身我的网不好,不知道是网的原因,还是摄像头的原因,还是树莓派的原因。

修改帧率

再次测试了一下,帧率低是自己的设置有问题
打开配置文件

sudo vim /etc/motion/motion.conf

修改最大帧数(line 95)

# Maximum number of frames to be captured per second.
# Valid range: 2-100. Default: 100 (almost no limit).
framerate 30                                          

修改字节流的最大帧数

# Maximum framerate for stream streams (default: 1)       
stream_maxrate 30

保存退出,重启。
画面跟我一起摇摆。

关闭自动拍照

关闭自动拍照(line 244)

# Output 'normal' pictures when motion is detected (default: on)
# Valid values: on, off, first, best, center
# When set to 'first', only the first picture of an event is saved.
# Picture with most motion of an event is saved when set to 'best'.
# Picture with motion nearest center of picture is saved when set to 'center'.
# Can be used as preview shot for the corresponding movie.
output_pictures off

参考

  1. 官方配置文档:树莓派+motion 搭建摄像头监控系统
  2. 野生翻译: 树莓派+motion 搭建摄像头监控系统.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值