安装依赖库
sudo apt-get install libv4l-dev libjpeg-dev
下载Mjpg-Streamer源代码
wget https://sourceforge.net/code-snapshots/svn/m/mj/mjpg-streamer/code/mjpg-streamer-code-182.zip
解压源码压缩包
unzip ./mjpg-streamer-code-182.zip
进入源码目录
cd ./mjpg-streamer-code-182/mjpg-streamer
普通编译
make all
使用libv4l2库编译
make USE_LIBV4L2=true all
查找可用的摄像头
ls /dev/video*
提示 No such file or directory 代表没有可用摄像头,检查下是否插入了摄像头,供电是否足够,驱动是否正常运行
运行
./mjpg_streamer -i "./input_uvc.so -d /dev/video0 -f 60" -o "./output_http.so -w ./www"
更多运行参数例子在./start.sh中,建议用文本编辑器阅读
遇到编译错误linux/videodev.h: No such file or directory 解决办法
sudo ln -s /usr/include/libv4l1-videodev.h /usr/include/linux/videodev.h