下面介绍在ESPRESSObin开发板上使用USB摄像头使用mjpeg-streamer打造家庭网络监控,使用官方Ubuntu固件的需要编译内核源码,在内核里面打开UVC,具体如下
cd /kernel/4.4.8make menuconfig选择开启如下模块Device Drivers ---><*> Multimedia Support --->
Cameras/video grabbers support
Media USB Adapters ---> <*> USB Video Class (UVC)然后运行下面命令编译生成内核make -j4然后将系统固件TF卡插入电脑USB口,加载TF卡分区sudo mount /dev/sdb1 /mnt/sdcard然后拷贝生成的内核到TF里面
cd /mnt/sdcardsudo cp /home/espressobin/kernel/4.4.8/arch/arm64/boot/Image boot/sudo cp /home/espressobin/kernel/4.4.8/arch/arm64/boot/dts/marvell/armada-3720-community.dtb boot/然后给开发板上电,插入USB摄像头,登陆终端后输入如下命令安装配置mjpeg-streamersudo apt-get updatesudo apt-get install build-essential libjpeg-dev imagemagick subversion libv4l-dev cmake gitmkdir webcam && cd webcamgit clone <a href="https://github.com/jacksonliam/mjpg-streamer">https://github.com/jacksonliam/mjpg-streamer</a> cd mjpg-streamer/mjpg-streamer-experimentalmakesudo make install
接着输入下面命令创建一个mjpeg-streamer运行脚本
vi stream.sh加入如下代码
#!/bin/bashset -x#start Video Camera Streamercd webcam/mjpg-streamer/mjpg-streamer-experimental./start.sh &然后运行sudo ifconfig -a查看开发板局域网IP并记下,输入下面命令运行mjpeg-streamer脚本
chmod +x stream.sh./stream.sh在电脑或者手机浏览器输入开发板IP:8080,打开如下图
点左侧Stream显示实时网络视频