Lu Blog

Segment fault!

香蕉派M1 编译/运行 Mjpg-Streamer 网络摄像头

编译安装步骤记录,仅供参考

  • 使用板卡:Banana Pi M1
  • 操作系统:ubuntu

安装依赖库

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

编译错误2

mjpg_streamer.o: In function `signal_handler':
mjpg_streamer.c:(.text+0x107): undefined reference to `dlclose'
mjpg_streamer.c:(.text+0x12c): undefined reference to `dlclose'
mjpg_streamer.o: In function `main':
mjpg_streamer.c:(.text.startup+0x27c): undefined reference to `dlopen'
mjpg_streamer.c:(.text.startup+0x29c): undefined reference to `dlsym'
mjpg_streamer.c:(.text.startup+0x2bd): undefined reference to `dlsym'
mjpg_streamer.c:(.text.startup+0x2de): undefined reference to `dlsym'
mjpg_streamer.c:(.text.startup+0x2ff): undefined reference to `dlsym'
mjpg_streamer.c:(.text.startup+0x378): undefined reference to `dlopen'
mjpg_streamer.c:(.text.startup+0x395): undefined reference to `dlsym'
mjpg_streamer.c:(.text.startup+0x3b0): undefined reference to `dlsym'
mjpg_streamer.c:(.text.startup+0x3cb): undefined reference to `dlsym'
mjpg_streamer.c:(.text.startup+0x3e6): undefined reference to `dlsym'
mjpg_streamer.c:(.text.startup+0x532): undefined reference to `dlerror'
mjpg_streamer.c:(.text.startup+0x6f1): undefined reference to `dlerror'
mjpg_streamer.c:(.text.startup+0x839): undefined reference to `dlerror'
collect2: ld returned 1 exit status
make: *** [mjpg_streamer] Error 1

这个错误是因为源码版本过于古老,建议下载新版本编译安装! sourceforge mjpg-streamer

遇到一些问题:

  • 摄像头帧数过低,延迟很高(2-5秒左右)

运行截图

run.png

obj.jpg

评论卡