一、硬件材料
1、树莓派3或3B+
2、电脑
3、USB摄像头
二、检查树莓派是否已加载USB摄像头
输入命令行
also usb
或者输入
ls /dev
三、安装NJPG-Streamer
依次输入命令行
pi@raspberrypi:~ $ sudo apt-get install cmake libjpeg8-dev
pi@raspberrypi:~ $ wget https://github.com/jacksonliam/mjpg-streamer/archive/master.zip
pi@raspberrypi:~ $ unzip master.zip
pi@raspberrypi:~ $ cd mjpg-
pi@raspberrypi:~/mjpg-streamer-master $ cd mjpg-*
pi@raspberrypi:~/mjpg-streamer-master/mjpg-streamer-experimental $ make
pi@raspberrypi:~/mjpg-streamer-master/mjpg-streamer-experimentalsudo make install
pi@raspberrypi:~/mjpg-streamer-master/mjpg-streamer-experimental cd $home
pi@raspberrypi:~ $
四、启动MJPG-Streamer
输入命令,启动mjpg-Streamer
pi@raspberrypi: ~ $ /usr/local/bin/mjpg_streamer -i “/usr/local/lib/mjpg-streamer/input_uvc.so -n -f 30 -r 1280x720” -o “/usr/local/lib/mjpg-streamer/output_http.so -p 8080 -w /usr/local/share/mjpg-streamer/www”
五、参数说明
-i “/usr/local/lib/mjpg-streamer/input_uvc.so -n -f 30 -r 1280x720”
-i 输入
input_uvc.so:UVC输入组件
-f 30 :表示30帧-r 1280*720 :分辨率-y :YUV格式输入(有卡顿),不加表示MJPG输入(需要摄像头支持)
-o “/usr/local/lib/mjpg-streamer/output_http.so -p 8080 -w /usr/local/share/mjpg-streamer/www”
-o 输出output_http.so :网页输出组件-w www : 网页输出-p 8080 :端口 8080-d 1000 : 时间1S
可以直接打开网址 http://<树莓派ip>:8080