树莓派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步编译安装:
进入目录并编译:
cd mjpg-streamer
make USE_LIBV4L2=true clean all
 
对于树莓派4最新的系统:make出错!
``
  1. In file included from /usr/include/arm-linux-gnueabihf/sys/stat.h:446,
  2.                  from utils.c: 33:
  3. /usr/include/arm-linux-gnueabihf/bits/statx.h:25:8: error: redefinition of struct statx_timestamp
  4.  struct statx_timestamp
  5.         ^ ~~~~~~~~~~~~~~
  6. In file included from utils.c: 32:
  7. /usr/include/linux/stat.h:56:8: note: originally defined here
  8.  struct statx_timestamp {
  9.         ^ ~~~~~~~~~~~~~~
  10. In file included from /usr/include/arm-linux-gnueabihf/sys/stat.h:446,
  11.                  from utils.c: 33:
  12. /usr/include/arm-linux-gnueabihf/bits/statx.h:36:8: error: redefinition of struct statx
  13.  struct statx
  14.         ^ ~``
 
解决:

sudo vim utils.c

注释掉 

#include <linux/stat.h>
#include <sys/stat.h>

 
 
第5步测试:
在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提供的测试页面:
  图片

 
 http://192.168.***.*:8090/javascript_simple.html


图片



对于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"

原文地址:https://www.cnblogs.com/zhaocundang/p/4820614.html