前言
记录树莓派的一次简单的视频服务器搭建
一、所用到的设备
树莓派4B、USB摄像头、一个可用的wifi
二、搭建步骤
1.查看自己的USB摄像头设备
摄像头插入到树莓派,查看USB设备:
lsusb
在设备节点中看到自己的节点是/dev/video0
2.安装motion软件
代码如下(示例):
sudo apt-get install motion
期间可能出现源的问题,我在/etc/apt/sources.list 增加的源是
deb http://mirrors.aliyun.com/raspbian/raspbian/ buster main contrib non-free rpi
deb-src http://mirrors.aliyun.com/raspbian/raspbian/ buster main contrib non-free rpi
然后更新源
sudo apt-get update
3.修改motion配置
1,打开配置文件/etc/motion/motion.conf
#将daemon off 改成
daemon on
#将stream_localhost = on 改成
stream_localhost = off
2,打开配置文件/etc/default/motion
#将start_motion_daemon = no 改成
start_motion_daemon = yes
3重启服务
sudo service motion restart
可以查看服务状态
service motion status
最后结果可以在web上看这个摄像头的界面,URL为 http://10.116.174.116:8081
总结
下一步考虑用端口映射,或者推流,实现在外网的观看。功能还需探索