用到了开源项目:MJPG-streamer
开源项目的下载地址:
http://sourceforge.net/p/mjpg-streamer/code/HEAD/tree/mjpg-streamer/
参考了文章:
http://www.eeboard.com/bbs/forum.php?mod=viewthread&tid=12533
好了,开始我们的工作:
ls /dev/vid*
发现video0设备,说明识别我的USB摄像头。(罗技的c270)
安装必要的软件集:
sudo apt-get
install subversion
sudo apt-get install libv4l-dev
sudo apt-get install
libjpeg8-dev
下载mipg-steamer软件,编译并安装
下载地址http://pan.baidu.com/s/1eQiP2x0
make USE_LIBV4L2=true clean all
make DESTDIR=/usr install
运行stream.sh(自己新建)
内容如下:
#!/bin/sh STREAMER=mjpg_streamer DEVICE=/dev/video0 RESOLUTION=320x240 FRAMERATE=25 HTTP_PORT=8001 PLUGINPATH=/usr/lib #$STREAMER -i "$PLUGINPATH/input_uvc.so -n -d $DEVICE -r $RESOLUTION -f $FRAMERATE" -o "$PLUGINPATH/output_http.so -n -p $HTTP_PORT " & $STREAMER -i "$PLUGINPATH/input_uvc.so -n -d $DEVICE -r $RESOLUTION -f $FRAMERATE -y YUYV" -o "$PLUGINPATH/output_http.so -n -p $HTTP_PORT " &
chmod 777 stream.sh
./stream.sh
打开浏览器(pi的IP地址是192.168.1.100)
http://192.168.1.100:8001/?action=stream