树莓派mjpg-stream摄像头监控
Q:463431476
第一步: 1、安装依赖
sudo apt-get install libv4l-dev libjpeg8-dev imagemagick
第二步: 下载SVN sudo apt-get install subversion
第3步:下载源码: svn co https://svn.code.sf.net/p/mjpg-streamer/code/mjpg-streamer
第4步编译安装:

http://192.168.***.*:8090/javascript_simple.html
进入目录并编译:
cd mjpg-streamer
make USE_LIBV4L2=true clean all
对于树莓派4最新的系统:make出错!
``
In file included from /usr/include/arm-linux-gnueabihf/sys/stat.h:446,
from utils.c: 33:
/usr/include/arm-linux-gnueabihf/bits/statx.h:25:8: error: redefinition of ‘struct statx_timestamp’
struct statx_timestamp
^ ~~~~~~~~~~~~~~
In file included from utils.c: 32:
/usr/include/linux/stat.h:56:8: note: originally defined here
struct statx_timestamp {
^ ~~~~~~~~~~~~~~
In file included from /usr/include/arm-linux-gnueabihf/sys/stat.h:446,
from utils.c: 33:
/usr/include/arm-linux-gnueabihf/bits/statx.h:36:8: error: redefinition of ‘struct statx’
struct statx
^ ~
``
解决:
sudo vim utils.c
注释掉
#include <linux/stat.h>
#include <sys/stat.h>
第5步测试:
打开mjpg-streamer提供的测试页面:
在mjpg-streamer文件夹下执行:
./mjpg_streamer -i "./input_uvc.so -d /dev/video0 -r 320*240 -f 12" -o "./output_http.so -p 8090 -w ./www"
uvc摄像头 -y
./mjpg_streamer -i "./input_uvc.so -y -d /dev/video0 -r 320*240 -f 12" -o "./output_http.so -p 8090 -w ./www"
(-r后是分辨率参数,-f后面是帧率,根据摄像头参数进行调整)
打开浏览器, IP地址:IP:8090(根据自己的IP修改) 打开mjpg-streamer提供的测试页面:
对于PI 4 最新的系统 ( 今天2020/2/25号)
raspbian.img
安装方法:
sudo apt-get install build-essential libjpeg8-dev imagemagick libv4l-dev cmake -y
git clone https://github.com/jacksonliam/mjpg-streamer.git
cd mjpg-streamer/mjpg-streamer-experimental
make
sudo apt-get install cmake -y
sudo make install
你可以cat stat.sh
我是用的USB UVC免驱摄像头:
./mjpg_streamer -i "./input_uvc.so -n -f 30 -r 640x480 -d /dev/video0" -o "./output_http.so -w ./www"

【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 地球OL攻略 —— 某应届生求职总结
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· 提示词工程——AI应用必不可少的技术
· .NET周刊【3月第1期 2025-03-02】