< >
Home » 树莓派入门教程 » 树莓派3-摄像头-视频软件mjpg-streamer的安装使用

树莓派3-摄像头-视频软件mjpg-streamer的安装使用

概要

  • "MJPG-streamer",是用于从webcam摄像头采集图像,把他们以流的形式通过基于ip的网络传输到浏览器如Firehox,Cambozola,VLC播放器,Windows的移动设备或者其他拥有浏览器的移动设备。她可以利用某些webcams的硬件压缩功能来降低服务器CPU的开销。她为嵌入式设备和一些常规服务器提供了一个轻量且更少CPU消耗的方案,因为她无需为视频帧压缩浪费大量的计算效率(这件事交给硬件了)。例子是:在一个主频200MHz的路由器上(一个例子是cisco经典无线的linkfs
    WRT54G路由,其可以运行openWRT(迷你linux系统),主频200MHz,4MRAM,16Flash),流编码一个960x720像素的视频,她可以减少10%的cpu使用。
  • 官网,https://sourceforge.net/projects/mjpg-streamer/
  • 官网,https://github.com/jacksonliam/mjpg-streamer

依赖软件

  • libjpeg8
  • cmake

安装

  1. 安装依赖库

安装libjpeg的dev版本(注:下面所有安装过程中出现是否继续时,统一选择继续:Yes)

sudo apt-get install libjpeg8-dev
  1. 下载mjpg-streamer
wget https://github.com/jacksonliam/mjpg-streamer/archive/master.zip
unzip master.zip
  1. 编译mjpg-streamer
  • 安装cmake
sudo apt-get install cmake
  • 切换到mjpg的路径下
cd mjpg-streamer-master/mjpg-streamer-experimental
make
sudo make install 

用法介绍

pi@raspberrypi:~ $ mjpg_streamer --help
-----------------------------------------------------------------------
Usage: mjpg_streamer
  -i | --input "<input-plugin.so> [parameters]"
  -o | --output "<output-plugin.so> [parameters]"
 [-h | --help ]........: display this help
 [-v | --version ].....: display version information
 [-b | --background]...: fork to the background, daemon mode
-----------------------------------------------------------------------
Example #1:
 To open an UVC webcam "/dev/video1" and stream it via HTTP:
  mjpg_streamer -i "input_uvc.so -d /dev/video1" -o "output_http.so"
-----------------------------------------------------------------------
Example #2:
 To open an UVC webcam and stream via HTTP port 8090:
  mjpg_streamer -i "input_uvc.so" -o "output_http.so -p 8090"
-----------------------------------------------------------------------
Example #3:
 To get help for a certain input plugin:
  mjpg_streamer -i "input_uvc.so --help"


-----------------------------------------------------------------------
In case the modules (=plugins) can not be found:
 * Set the default search path for the modules with:
   export LD_LIBRARY_PATH=/path/to/plugins,
 * or put the plugins into the "/lib/" or "/usr/lib" folder,
 * or instead of just providing the plugin file name, use a complete
   path and filename:
   mjpg_streamer -i "/path/to/modules/input_uvc.so"
-----------------------------------------------------------------------

启动mjpg_streamer

  • 执行命令:
/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"
  • 显示如下:
$ /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"
MJPG Streamer Version.: 2.0
 i: Using V4L2 device.: /dev/video0
 i: Desired Resolution: 1280 x 720
 i: Frames Per Second.: 30
 i: Format............: JPEG
 i: TV-Norm...........: DEFAULT
 i: The specified resolution is unavailable, using: width 640 height 480 instead 
 i: Could not obtain the requested pixelformat: MJPG , driver gave us: YUYV
    ... will try to handle this by checking against supported formats. 
    ... Falling back to YUV mode (consider using -yuv option). Note that this requires much more CPU power
 o: www-folder-path......: /usr/local/share/mjpg-streamer/www/
 o: HTTP TCP port........: 8080
 o: HTTP Listen Address..: (null)
 o: username:password....: disabled
 o: commands.............: enabled

查看

  • 在浏览器http://localhost:8080 打开监控界面

纠错,疑问,交流: 请进入讨论区点击加入Q群

获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号


标签: 树莓派3视频软件, 树莓派3视频软件mjpg-streamer, 树莓派3mjpg-streamer