“Mjpg-streamer”的版本间的差异
来自百问网嵌入式Linux wiki
第199行: | 第199行: | ||
:其中括号部分,我这个Buildroot的mjpg_streamer版本没有提供。 | :其中括号部分,我这个Buildroot的mjpg_streamer版本没有提供。 | ||
+ | === 输入插件1:input_uvc.so=== | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | # mjpg_streamer -i "/usr/lib/input_uvc.so --help" | ||
+ | MJPG Streamer Version: git rev: fd184d0 | ||
+ | --------------------------------------------------------------- | ||
+ | Help for input plugin..: UVC webcam grabber | ||
+ | --------------------------------------------------------------- | ||
+ | The following parameters can be passed to this plugin: | ||
+ | [-d | --device ].......: video device to open (your camera) | ||
+ | [-r | --resolution ]...: the resolution of the video device, | ||
+ | can be one of the following strings: | ||
+ | QQVGA QCIF CGA QVGA CIF PAL | ||
+ | VGA SVGA XGA HD SXGA UXGA | ||
+ | FHD | ||
+ | or a custom value like the following | ||
+ | example: 640x480 | ||
+ | [-f | --fps ]..........: frames per second | ||
+ | (activates YUYV format, disables MJPEG) | ||
+ | [-q | --quality ] .....: set quality of JPEG encoding | ||
+ | [-m | --minimum_size ].: drop frames smaller then this limit, useful | ||
+ | if the webcam produces small-sized garbage frames | ||
+ | may happen under low light conditions | ||
+ | [-e | --every_frame ]..: drop all frames except numbered | ||
+ | [-n | --no_dynctrl ]...: do not initalize dynctrls of Linux-UVC driver | ||
+ | [-l | --led ]..........: switch the LED "on", "off", let it "blink" or leave | ||
+ | it up to the driver using the value "auto" | ||
+ | [-t | --tvnorm ] ......: set TV-Norm pal, ntsc or secam | ||
+ | [-u | --uyvy ] ........: Use UYVY format, default: MJPEG (uses more cpu power) | ||
+ | [-y | --yuv ] ........: Use YUV format, default: MJPEG (uses more cpu power) | ||
+ | [-fourcc ] ............: Use FOURCC codec 'argopt', | ||
+ | currently supported codecs are: RGBP | ||
+ | --------------------------------------------------------------- | ||
+ | Optional parameters (may not be supported by all cameras): | ||
+ | [-br ].................: Set image brightness (auto or integer) | ||
+ | [-co ].................: Set image contrast (integer) | ||
+ | [-sh ].................: Set image sharpness (integer) | ||
+ | [-sa ].................: Set image saturation (integer) | ||
+ | [-cb ].................: Set color balance (auto or integer) | ||
+ | [-wb ].................: Set white balance (auto or integer) | ||
+ | [-ex ].................: Set exposure (auto, shutter-priority, aperature-priority, or integer) | ||
+ | [-bk ].................: Set backlight compensation (integer) | ||
+ | [-rot ]................: Set image rotation (0-359) | ||
+ | [-hf ].................: Set horizontal flip (true/false) | ||
+ | [-vf ].................: Set vertical flip (true/false) | ||
+ | [-pl ].................: Set power line filter (disabled, 50hz, 60hz, auto) | ||
+ | [-gain ]...............: Set gain (auto or integer) | ||
+ | [-cagc ]...............: Set chroma gain control (auto or integer) | ||
+ | --------------------------------------------------------------- | ||
+ | input_init() return value signals to exit | ||
+ | </syntaxhighlight> | ||
+ | *基本参数: | ||
+ | :* -d:指定video设备节点 | ||
+ | :* -r:指定分辨率,VGA或640x480类似值 | ||
+ | :* -f:指定每秒帧数 | ||
+ | :* -q:指定JPEG编码质量 | ||
+ | :* -m:指定丢弃小于该值的帧 | ||
+ | :* -e:删除除编号以外的所有帧 | ||
+ | :* -n:不要初始化Linux-UVC驱动程序的dynctrls | ||
+ | :* -l:设置LED on/off/blink,设置auto将取决于驱动程序 | ||
+ | :* -t:设置TV-Norm pal,ntsc或secam | ||
+ | :* -u:指定输入为UYVY格式,通过CPU将UYVC转为MJPEG,这样会消耗更多CPU | ||
+ | :* -y:指定输入为YUV格式,通过CPU将YUV转为MJPEG,这样会消耗更多CPU | ||
+ | :* -fourcc:使用FOURCC编解码器argopt,目前支持的编解码器是:RGBP | ||
+ | :* 新版新增: | ||
+ | :* -timestamp:使用系统时间填充帧时间戳 | ||
+ | :* -softfps:丢帧以尝试实现此FPS | ||
+ | *图像参数: | ||
+ | :*-br:设置图像亮度 | ||
+ | :*-co:设置图像对比度 | ||
+ | :*-sh:设置图像清晰度 | ||
+ | :*-sa:设置图像饱和度 | ||
+ | :*-cb:设置图像颜色平衡 | ||
+ | :*-wb:设置图像白平衡 | ||
+ | :*-ex:设置图像曝光 | ||
+ | :*-bk:设置图像曝光补偿 | ||
+ | :*-rot:设置图像旋转0-359 | ||
+ | :*-hf:设置图像水平翻转 | ||
+ | :*-vf:设置图像垂直翻转 | ||
+ | :*-pl:设置图像避免闪烁频率 | ||
+ | :*-gain:设置图像增益 | ||
+ | :*-cagc:设置图像色度增益控制 | ||
+ | |||
+ | |||
+ | ===输入插件2:input_testpicture.so=== | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | # mjpg_streamer -i "/usr/lib/input_testpicture.so --help" | ||
+ | MJPG Streamer Version: git rev: fd184d0 | ||
+ | --------------------------------------------------------------- | ||
+ | Help for input plugin..: TESTPICTURE input plugin | ||
+ | --------------------------------------------------------------- | ||
+ | The following parameters can be passed to this plugin: | ||
+ | [-d | --delay ]........: delay to pause between frames | ||
+ | [-r | --resolution]....: can be 960x720, 640x480, 320x240, 160x120 | ||
+ | --------------------------------------------------------------- | ||
+ | input_init() return value signals to exit | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | *基本参数: | ||
+ | :*-d:指定在两帧之间的延时 | ||
+ | :*-r:指定在分辨率 | ||
+ | |||
+ | ===输入插件3:input_file.so=== | ||
+ | |||
+ | |||
+ | |||
+ | <syntaxhighlight lang="bash"> | ||
+ | # mjpg-streamer -i "/snap/mjpg-streamer/42/lib/mjpg-streamer/input_file.so --help" | ||
+ | MJPG Streamer Version: git rev: f387bb44e6c087271b763b27da998bf2e06c4f5d | ||
+ | --------------------------------------------------------------- | ||
+ | Help for input plugin..: FILE input plugin | ||
+ | --------------------------------------------------------------- | ||
+ | The following parameters can be passed to this plugin: | ||
+ | [-d | --delay ]........: delay (in seconds) to pause between frames | ||
+ | [-f | --folder ].......: folder to watch for new JPEG files | ||
+ | [-r | --remove ].......: remove/delete JPEG file after reading | ||
+ | [-n | --name ].........: ignore changes unless filename matches | ||
+ | [-e | --existing ].....: serve the existing *.jpg files from the specified directory | ||
+ | --------------------------------------------------------------- | ||
+ | input_init() return value signals to exit | ||
+ | </syntaxhighlight> | ||
+ | *基本参数: | ||
+ | :*-d:指定在两帧之间的延时(单位:s) | ||
+ | :*-f:指定查看新JEPG文件的目录 | ||
+ | :*-r:指定读取后要删除的JEPG文件 | ||
+ | :*-n:指定除非文件名匹配忽略更改 | ||
+ | :*-e:指定目录读取现有JPG文件 | ||
+ | |||
+ | ===输入插件4:input_ptp2.so=== | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | # mjpg-streamer -i "/snap/mjpg-streamer/42/lib/mjpg-streamer/input_ptp2.so --help" | ||
+ | MJPG Streamer Version: git rev: f387bb44e6c087271b763b27da998bf2e06c4f5d | ||
+ | PTP2 input plugin: invalid option -- '-' | ||
+ | --------------------------------------------------------------- | ||
+ | Help for input plugin..: PTP2 input plugin | ||
+ | --------------------------------------------------------------- | ||
+ | The following parameters can be passed to this plugin: | ||
+ | [-h ]..........: print this help | ||
+ | [-u X ]........: delay between frames in us (default 0) | ||
+ | [-d X ]........: camera address in [usb:xxx,yyy] form; use | ||
+ | gphoto2 --auto-detect to get a list of | ||
+ | available cameras | ||
+ | --------------------------------------------------------------- | ||
+ | input_init() return value signals to exit | ||
+ | </syntaxhighlight> | ||
+ | *基本参数: | ||
+ | :*-h:打印帮助 | ||
+ | :*-u:指定在两帧之间的延时(单位:us) | ||
+ | :*-d:指定可用相机 | ||
+ | |||
+ | ===输入插件5:input_http.so=== | ||
+ | |||
+ | <syntaxhighlight lang="bash"> | ||
+ | # mjpg-streamer -i "/snap/mjpg-streamer/42/lib/mjpg-streamer/input_http.so --help"" | ||
+ | MJPG Streamer Version: git rev: f387bb44e6c087271b763b27da998bf2e06c4f5d | ||
+ | --------------------------------------------------------------- | ||
+ | Help for input plugin..: HTTP Input plugin | ||
+ | --------------------------------------------------------------- | ||
+ | The following parameters can be passed to this plugin: | ||
+ | [-v | --version ]........: current SVN Revision | ||
+ | [-h | --help]............: show this message | ||
+ | [-H | --host]............: select host to data from, localhost is default | ||
+ | [-p | --port]............: port, defaults to 8080 | ||
+ | --------------------------------------------------------------- | ||
+ | input_init() return value signals to exit | ||
+ | </syntaxhighlight> | ||
+ | *基本参数: | ||
+ | :*-v:打印版本信息 | ||
+ | :*-h:打印帮助信息 | ||
+ | :*-H:指定主机地址 | ||
+ | :*-p:指定端口 | ||
+ | |||
+ | ===输出插件1:output_http.so=== | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | # mjpg_streamer -o "/usr/lib/output_http.so --help" | ||
+ | MJPG Streamer Version: git rev: fd184d0 | ||
+ | --------------------------------------------------------------- | ||
+ | Help for output plugin..: HTTP output plugin | ||
+ | --------------------------------------------------------------- | ||
+ | The following parameters can be passed to this plugin: | ||
+ | [-w | --www ]...........: folder that contains webpages in | ||
+ | flat hierarchy (no subfolders) | ||
+ | [-p | --port ]..........: TCP port for this HTTP server | ||
+ | [-l ] --listen ]........: Listen on Hostname / IP | ||
+ | [-c | --credentials ]...: ask for "username:password" on connect | ||
+ | [-n | --nocommands ]....: disable execution of commands | ||
+ | --------------------------------------------------------------- | ||
+ | output_init() return value signals to exit | ||
+ | </syntaxhighlight> | ||
+ | *基本参数: | ||
+ | :*-w:指定网页根目录(不支持子文件夹) | ||
+ | :*-p:指定HTTP服务器的TCP端口 | ||
+ | :*-l:指定监听主机IP | ||
+ | :*-c:指定在连接时询问的账户名、密码 | ||
+ | :*-n:指定禁用命令执行 | ||
+ | |||
+ | ===输出插件2:output_file.so=== | ||
+ | |||
+ | <syntaxhighlight lang="bash"> | ||
+ | # mjpg-streamer -o "/snap/mjpg-streamer/42/lib/mjpg-streamer/output_file.so --help" | ||
+ | MJPG Streamer Version: git rev: f387bb44e6c087271b763b27da998bf2e06c4f5d | ||
+ | --------------------------------------------------------------- | ||
+ | Help for output plugin..: FILE output plugin | ||
+ | --------------------------------------------------------------- | ||
+ | The following parameters can be passed to this plugin: | ||
+ | [-f | --folder ]........: folder to save pictures | ||
+ | [-m | --mjpeg ].........: save the frames to an mjpg file | ||
+ | [-l | --link ]..........: link the last picture in ringbuffer as this fixed named file | ||
+ | [-d | --delay ].........: delay after saving pictures in ms | ||
+ | [-i | --input ].........: read frames from the specified input plugin | ||
+ | The following arguments are takes effect only if the current mode is not MJPG | ||
+ | [-s | --size ]..........: size of ring buffer (max number of pictures to hold) | ||
+ | [-e | --exceed ]........: allow ringbuffer to exceed limit by this amount | ||
+ | [-c | --command ].......: execute command after saving picture | ||
+ | --------------------------------------------------------------- | ||
+ | output_init() return value signals to exit | ||
+ | </syntaxhighlight> | ||
+ | *基本参数: | ||
+ | :*-f:指定保存图片文件夹 | ||
+ | :*-m:将帧保存的mjpg文件夹 | ||
+ | :*-l:将ringbuffer中的最后一张图片链接为此固定命名文件 | ||
+ | :*-d:保存图片后延时(单位:ms) | ||
+ | :*-i:从指定的输入插件中读取帧 | ||
+ | *仅当当前模式不是MJPG时,以下参数才会生效 | ||
+ | :*-s:环形缓冲区的大小(要保留的最大图片数) | ||
+ | :*-e:允许ringbuffer超过此数量的限制 | ||
+ | :*-c:保存图片后执行命令 | ||
+ | |||
+ | ===输出插件3:output_udp.so=== | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | # mjpg-streamer -o "/snap/mjpg-streamer/42/lib/mjpg-streamer/output_udp.so --help" | ||
+ | MJPG Streamer Version: git rev: f387bb44e6c087271b763b27da998bf2e06c4f5d | ||
+ | --------------------------------------------------------------- | ||
+ | Help for output plugin..: UDP output plugin | ||
+ | --------------------------------------------------------------- | ||
+ | The following parameters can be passed to this plugin: | ||
+ | [-f | --folder ]........: folder to save pictures | ||
+ | [-d | --delay ].........: delay after saving pictures in ms | ||
+ | [-c | --command ].......: execute command after saveing picture | ||
+ | [-p | --port ]..........: UDP port to listen for picture requests. UDP message is the filename to save | ||
+ | [-i | --input ].......: read frames from the specified input plugin (first input plugin between the arguments is the 0th) | ||
+ | --------------------------------------------------------------- | ||
+ | output_init() return value signals to exit | ||
+ | </syntaxhighlight> | ||
+ | *基本参数: | ||
+ | :*-f:指定保存图片的文件夹 | ||
+ | :*-d:保存图片后延时(单位:ms) | ||
+ | :*-c:保存图片后执行命令 | ||
+ | :*-p:指定UDP端口监听图片请求 | ||
+ | :*-i:从指定的输入插件读取帧 | ||
+ | |||
+ | ===输出插件4:output_rtsp.so=== | ||
+ | |||
+ | <syntaxhighlight lang="bash"> | ||
+ | # mjpg-streamer -o "/snap/mjpg-streamer/42/lib/mjpg-streamer/output_rtsp.so --help" | ||
+ | MJPG Streamer Version: git rev: f387bb44e6c087271b763b27da998bf2e06c4f5d | ||
+ | --------------------------------------------------------------- | ||
+ | Help for output plugin..: RTSP output plugin | ||
+ | --------------------------------------------------------------- | ||
+ | The following parameters can be passed to this plugin: | ||
+ | [-p | --port ]..........: UDP port to listen for picture requests. UDP message is the filename to save | ||
+ | [-i | --input ].......: read frames from the specified input plugin (first input plugin between the arguments is the 0th) | ||
+ | --------------------------------------------------------------- | ||
+ | output_init() return value signals to exit | ||
+ | </syntaxhighlight> | ||
+ | *基本参数: | ||
+ | :*-p:指定UDP端口监听图片请求 | ||
+ | :*-i:从指定的输入插件读取帧 | ||
+ | |||
+ | ===输出插件5:output_viewer.so=== | ||
+ | |||
+ | <syntaxhighlight lang="bash"> | ||
+ | # mjpg-streamer -o "/snap/mjpg-streamer/42/lib/mjpg-streamer/output_viewer.so --help" | ||
+ | MJPG Streamer Version: git rev: f387bb44e6c087271b763b27da998bf2e06c4f5d | ||
+ | --------------------------------------------------------------- | ||
+ | Help for output plugin..: VIEWER output plugin | ||
+ | --------------------------------------------------------------- | ||
+ | output_init() return value signals to exit | ||
+ | </syntaxhighlight> | ||
+ | *基本参数: | ||
+ | :*无 | ||
*参考页面 https://hceng.cn/2019/06/23/AM335X%E2%80%94%E2%80%94USB%E6%91%84%E5%83%8F%E5%A4%B4/#3-Web%E6%98%BE%E7%A4%BA | *参考页面 https://hceng.cn/2019/06/23/AM335X%E2%80%94%E2%80%94USB%E6%91%84%E5%83%8F%E5%A4%B4/#3-Web%E6%98%BE%E7%A4%BA | ||
+ | |||
==执行mjpg_streamer获取摄像头数据== | ==执行mjpg_streamer获取摄像头数据== | ||
:如下所示我们使用-i参数指定输入so插件类型为uvc类型,-d参数指定使用的摄像头设备为/dev/video1 ,-r参数指定输入分辨率为640x480 ,-q参数指定uvc数据质量为90,-n参数说明不要初始化Linux-UVC驱动程序的dynctrls,-o参数指定输出类型为http方式,-w指定网站目录为/usr/camera/web | :如下所示我们使用-i参数指定输入so插件类型为uvc类型,-d参数指定使用的摄像头设备为/dev/video1 ,-r参数指定输入分辨率为640x480 ,-q参数指定uvc数据质量为90,-n参数说明不要初始化Linux-UVC驱动程序的dynctrls,-o参数指定输出类型为http方式,-w指定网站目录为/usr/camera/web |
2020年6月4日 (四) 18:04的版本
目录
查看摄像头数据
列出所有摄像头设备
[root@imx6ull:~]# v4l2-ctl --list-devices
pxp (pxp_v4l2):
/dev/video0
USB 2.0 Camera (usb-ci_hdrc.1-1.3):
/dev/video1
查看摄像头详细信息
[root@imx6ull:~]# v4l2-ctl -L -d /dev/video1
brightness 0x00980900 (int) : min=-255 max=255 step=1 default=0 value=0
contrast 0x00980901 (int) : min=0 max=30 step=1 default=15 value=15
saturation 0x00980902 (int) : min=0 max=127 step=1 default=30 value=30
hue 0x00980903 (int) : min=-16000 max=16000 step=100 default=0 value=0
white_balance_temperature_auto 0x0098090c (bool) : default=1 value=1
gamma 0x00980910 (int) : min=20 max=250 step=1 default=98 value=98
power_line_frequency 0x00980918 (menu) : min=0 max=2 default=1 value=1
0: Disabled
1: 50 Hz
2: 60 Hz
white_balance_temperature 0x0098091a (int) : min=2500 max=7000 step=1 default=5000 value=5000 flags=inactive
sharpness 0x0098091b (int) : min=0 max=15 step=1 default=2 value=2
backlight_compensation 0x0098091c (int) : min=0 max=2 step=1 default=1 value=1
查看摄像头支持的像素格式和分辨率
[root@imx6ull:~]# v4l2-ctl --list-formats-ext -d /dev/video1
ioctl: VIDIOC_ENUM_FMT
Type: Video Capture
[0]: 'YUYV' (YUYV 4:2:2)
Size: Discrete 640x480
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.040s (25.000 fps)
Interval: Discrete 0.050s (20.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Interval: Discrete 0.100s (10.000 fps)
Interval: Discrete 0.200s (5.000 fps)
Size: Discrete 160x120
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.040s (25.000 fps)
Interval: Discrete 0.050s (20.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Interval: Discrete 0.100s (10.000 fps)
Interval: Discrete 0.200s (5.000 fps)
Size: Discrete 320x240
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.040s (25.000 fps)
Interval: Discrete 0.050s (20.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Interval: Discrete 0.100s (10.000 fps)
Interval: Discrete 0.200s (5.000 fps)
Size: Discrete 352x288
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.040s (25.000 fps)
Interval: Discrete 0.050s (20.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Interval: Discrete 0.100s (10.000 fps)
Interval: Discrete 0.200s (5.000 fps)
Size: Discrete 800x600
Interval: Discrete 0.067s (15.000 fps)
Interval: Discrete 0.100s (10.000 fps)
Interval: Discrete 0.200s (5.000 fps)
Size: Discrete 1280x720
Interval: Discrete 0.067s (15.000 fps)
Interval: Discrete 0.100s (10.000 fps)
Interval: Discrete 0.200s (5.000 fps)
Size: Discrete 1280x1024
Interval: Discrete 0.083s (12.000 fps)
Interval: Discrete 0.100s (10.000 fps)
Interval: Discrete 0.200s (5.000 fps)
Size: Discrete 1600x1200
Interval: Discrete 0.111s (9.000 fps)
Interval: Discrete 0.200s (5.000 fps)
[1]: 'MJPG' (Motion-JPEG, compressed)
Size: Discrete 640x480
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.040s (25.000 fps)
Interval: Discrete 0.050s (20.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Interval: Discrete 0.100s (10.000 fps)
Interval: Discrete 0.200s (5.000 fps)
Size: Discrete 160x120
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.040s (25.000 fps)
Interval: Discrete 0.050s (20.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Interval: Discrete 0.100s (10.000 fps)
Interval: Discrete 0.200s (5.000 fps)
Size: Discrete 320x240
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.040s (25.000 fps)
Interval: Discrete 0.050s (20.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Interval: Discrete 0.100s (10.000 fps)
Interval: Discrete 0.200s (5.000 fps)
Size: Discrete 352x288
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.040s (25.000 fps)
Interval: Discrete 0.050s (20.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Interval: Discrete 0.100s (10.000 fps)
Interval: Discrete 0.200s (5.000 fps)
Size: Discrete 800x600
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.040s (25.000 fps)
Interval: Discrete 0.050s (20.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Interval: Discrete 0.100s (10.000 fps)
Interval: Discrete 0.200s (5.000 fps)
Size: Discrete 1280x720
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.040s (25.000 fps)
Interval: Discrete 0.050s (20.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Interval: Discrete 0.100s (10.000 fps)
Interval: Discrete 0.200s (5.000 fps)
Size: Discrete 1280x1024
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.040s (25.000 fps)
Interval: Discrete 0.050s (20.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Interval: Discrete 0.100s (10.000 fps)
Interval: Discrete 0.200s (5.000 fps)
使用mjpg_streamer预览摄像头数据
查看开发板IP地址
[root@imx6ull:~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:01:3F:2D:3E:4D
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
eth1 Link encap:Ethernet HWaddr 00:01:1F:2D:3E:4D
inet addr:192.168.1.21 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fdfd:3597:aa7a:0:201:1fff:fe2d:3e4d/64 Scope:Global
inet6 addr: fe80::201:1fff:fe2d:3e4d/64 Scope:Link
inet6 addr: fdfd:3597:aa7a::914/64 Scope:Global
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:558 errors:0 dropped:0 overruns:0 frame:0
TX packets:291 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:221870 (216.6 KiB) TX bytes:29419 (28.7 KiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:7756 errors:0 dropped:0 overruns:0 frame:0
TX packets:7756 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:468263 (457.2 KiB) TX bytes:468263 (457.2 KiB)
mjpg_streamer参数讲解
- 使用mjpg_streamer -h 查看帮助信息。
[root@imx6ull:~]# mjpg_streamer -h
-----------------------------------------------------------------------
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后需要接-i和-o两个参数,再分别看这两个参数提供的不同so插件文件支持哪些选项。
- 可选的-h查询帮助信息、-v查询版本信息、-b后台执行就不多介绍了。
- 输入so插件包含:input_uvc.so、input_testpicture.so、(input_file.so、input_ptp2.so、input_http.so)
- 输出so插件包含:output_http.so、(output_file.so、output_udp.so、output_rtsp.so、output_viewer.so)
- 其中括号部分,我这个Buildroot的mjpg_streamer版本没有提供。
输入插件1:input_uvc.so
# mjpg_streamer -i "/usr/lib/input_uvc.so --help"
MJPG Streamer Version: git rev: fd184d0
---------------------------------------------------------------
Help for input plugin..: UVC webcam grabber
---------------------------------------------------------------
The following parameters can be passed to this plugin:
[-d | --device ].......: video device to open (your camera)
[-r | --resolution ]...: the resolution of the video device,
can be one of the following strings:
QQVGA QCIF CGA QVGA CIF PAL
VGA SVGA XGA HD SXGA UXGA
FHD
or a custom value like the following
example: 640x480
[-f | --fps ]..........: frames per second
(activates YUYV format, disables MJPEG)
[-q | --quality ] .....: set quality of JPEG encoding
[-m | --minimum_size ].: drop frames smaller then this limit, useful
if the webcam produces small-sized garbage frames
may happen under low light conditions
[-e | --every_frame ]..: drop all frames except numbered
[-n | --no_dynctrl ]...: do not initalize dynctrls of Linux-UVC driver
[-l | --led ]..........: switch the LED "on", "off", let it "blink" or leave
it up to the driver using the value "auto"
[-t | --tvnorm ] ......: set TV-Norm pal, ntsc or secam
[-u | --uyvy ] ........: Use UYVY format, default: MJPEG (uses more cpu power)
[-y | --yuv ] ........: Use YUV format, default: MJPEG (uses more cpu power)
[-fourcc ] ............: Use FOURCC codec 'argopt',
currently supported codecs are: RGBP
---------------------------------------------------------------
Optional parameters (may not be supported by all cameras):
[-br ].................: Set image brightness (auto or integer)
[-co ].................: Set image contrast (integer)
[-sh ].................: Set image sharpness (integer)
[-sa ].................: Set image saturation (integer)
[-cb ].................: Set color balance (auto or integer)
[-wb ].................: Set white balance (auto or integer)
[-ex ].................: Set exposure (auto, shutter-priority, aperature-priority, or integer)
[-bk ].................: Set backlight compensation (integer)
[-rot ]................: Set image rotation (0-359)
[-hf ].................: Set horizontal flip (true/false)
[-vf ].................: Set vertical flip (true/false)
[-pl ].................: Set power line filter (disabled, 50hz, 60hz, auto)
[-gain ]...............: Set gain (auto or integer)
[-cagc ]...............: Set chroma gain control (auto or integer)
---------------------------------------------------------------
input_init() return value signals to exit
- 基本参数:
- -d:指定video设备节点
- -r:指定分辨率,VGA或640x480类似值
- -f:指定每秒帧数
- -q:指定JPEG编码质量
- -m:指定丢弃小于该值的帧
- -e:删除除编号以外的所有帧
- -n:不要初始化Linux-UVC驱动程序的dynctrls
- -l:设置LED on/off/blink,设置auto将取决于驱动程序
- -t:设置TV-Norm pal,ntsc或secam
- -u:指定输入为UYVY格式,通过CPU将UYVC转为MJPEG,这样会消耗更多CPU
- -y:指定输入为YUV格式,通过CPU将YUV转为MJPEG,这样会消耗更多CPU
- -fourcc:使用FOURCC编解码器argopt,目前支持的编解码器是:RGBP
- 新版新增:
- -timestamp:使用系统时间填充帧时间戳
- -softfps:丢帧以尝试实现此FPS
- 图像参数:
- -br:设置图像亮度
- -co:设置图像对比度
- -sh:设置图像清晰度
- -sa:设置图像饱和度
- -cb:设置图像颜色平衡
- -wb:设置图像白平衡
- -ex:设置图像曝光
- -bk:设置图像曝光补偿
- -rot:设置图像旋转0-359
- -hf:设置图像水平翻转
- -vf:设置图像垂直翻转
- -pl:设置图像避免闪烁频率
- -gain:设置图像增益
- -cagc:设置图像色度增益控制
输入插件2:input_testpicture.so
# mjpg_streamer -i "/usr/lib/input_testpicture.so --help"
MJPG Streamer Version: git rev: fd184d0
---------------------------------------------------------------
Help for input plugin..: TESTPICTURE input plugin
---------------------------------------------------------------
The following parameters can be passed to this plugin:
[-d | --delay ]........: delay to pause between frames
[-r | --resolution]....: can be 960x720, 640x480, 320x240, 160x120
---------------------------------------------------------------
input_init() return value signals to exit
- 基本参数:
- -d:指定在两帧之间的延时
- -r:指定在分辨率
输入插件3:input_file.so
# mjpg-streamer -i "/snap/mjpg-streamer/42/lib/mjpg-streamer/input_file.so --help"
MJPG Streamer Version: git rev: f387bb44e6c087271b763b27da998bf2e06c4f5d
---------------------------------------------------------------
Help for input plugin..: FILE input plugin
---------------------------------------------------------------
The following parameters can be passed to this plugin:
[-d | --delay ]........: delay (in seconds) to pause between frames
[-f | --folder ].......: folder to watch for new JPEG files
[-r | --remove ].......: remove/delete JPEG file after reading
[-n | --name ].........: ignore changes unless filename matches
[-e | --existing ].....: serve the existing *.jpg files from the specified directory
---------------------------------------------------------------
input_init() return value signals to exit
- 基本参数:
- -d:指定在两帧之间的延时(单位:s)
- -f:指定查看新JEPG文件的目录
- -r:指定读取后要删除的JEPG文件
- -n:指定除非文件名匹配忽略更改
- -e:指定目录读取现有JPG文件
输入插件4:input_ptp2.so
# mjpg-streamer -i "/snap/mjpg-streamer/42/lib/mjpg-streamer/input_ptp2.so --help"
MJPG Streamer Version: git rev: f387bb44e6c087271b763b27da998bf2e06c4f5d
PTP2 input plugin: invalid option -- '-'
---------------------------------------------------------------
Help for input plugin..: PTP2 input plugin
---------------------------------------------------------------
The following parameters can be passed to this plugin:
[-h ]..........: print this help
[-u X ]........: delay between frames in us (default 0)
[-d X ]........: camera address in [usb:xxx,yyy] form; use
gphoto2 --auto-detect to get a list of
available cameras
---------------------------------------------------------------
input_init() return value signals to exit
- 基本参数:
- -h:打印帮助
- -u:指定在两帧之间的延时(单位:us)
- -d:指定可用相机
输入插件5:input_http.so
# mjpg-streamer -i "/snap/mjpg-streamer/42/lib/mjpg-streamer/input_http.so --help""
MJPG Streamer Version: git rev: f387bb44e6c087271b763b27da998bf2e06c4f5d
---------------------------------------------------------------
Help for input plugin..: HTTP Input plugin
---------------------------------------------------------------
The following parameters can be passed to this plugin:
[-v | --version ]........: current SVN Revision
[-h | --help]............: show this message
[-H | --host]............: select host to data from, localhost is default
[-p | --port]............: port, defaults to 8080
---------------------------------------------------------------
input_init() return value signals to exit
- 基本参数:
- -v:打印版本信息
- -h:打印帮助信息
- -H:指定主机地址
- -p:指定端口
输出插件1:output_http.so
# mjpg_streamer -o "/usr/lib/output_http.so --help"
MJPG Streamer Version: git rev: fd184d0
---------------------------------------------------------------
Help for output plugin..: HTTP output plugin
---------------------------------------------------------------
The following parameters can be passed to this plugin:
[-w | --www ]...........: folder that contains webpages in
flat hierarchy (no subfolders)
[-p | --port ]..........: TCP port for this HTTP server
[-l ] --listen ]........: Listen on Hostname / IP
[-c | --credentials ]...: ask for "username:password" on connect
[-n | --nocommands ]....: disable execution of commands
---------------------------------------------------------------
output_init() return value signals to exit
- 基本参数:
- -w:指定网页根目录(不支持子文件夹)
- -p:指定HTTP服务器的TCP端口
- -l:指定监听主机IP
- -c:指定在连接时询问的账户名、密码
- -n:指定禁用命令执行
输出插件2:output_file.so
# mjpg-streamer -o "/snap/mjpg-streamer/42/lib/mjpg-streamer/output_file.so --help"
MJPG Streamer Version: git rev: f387bb44e6c087271b763b27da998bf2e06c4f5d
---------------------------------------------------------------
Help for output plugin..: FILE output plugin
---------------------------------------------------------------
The following parameters can be passed to this plugin:
[-f | --folder ]........: folder to save pictures
[-m | --mjpeg ].........: save the frames to an mjpg file
[-l | --link ]..........: link the last picture in ringbuffer as this fixed named file
[-d | --delay ].........: delay after saving pictures in ms
[-i | --input ].........: read frames from the specified input plugin
The following arguments are takes effect only if the current mode is not MJPG
[-s | --size ]..........: size of ring buffer (max number of pictures to hold)
[-e | --exceed ]........: allow ringbuffer to exceed limit by this amount
[-c | --command ].......: execute command after saving picture
---------------------------------------------------------------
output_init() return value signals to exit
- 基本参数:
- -f:指定保存图片文件夹
- -m:将帧保存的mjpg文件夹
- -l:将ringbuffer中的最后一张图片链接为此固定命名文件
- -d:保存图片后延时(单位:ms)
- -i:从指定的输入插件中读取帧
- 仅当当前模式不是MJPG时,以下参数才会生效
- -s:环形缓冲区的大小(要保留的最大图片数)
- -e:允许ringbuffer超过此数量的限制
- -c:保存图片后执行命令
输出插件3:output_udp.so
# mjpg-streamer -o "/snap/mjpg-streamer/42/lib/mjpg-streamer/output_udp.so --help"
MJPG Streamer Version: git rev: f387bb44e6c087271b763b27da998bf2e06c4f5d
---------------------------------------------------------------
Help for output plugin..: UDP output plugin
---------------------------------------------------------------
The following parameters can be passed to this plugin:
[-f | --folder ]........: folder to save pictures
[-d | --delay ].........: delay after saving pictures in ms
[-c | --command ].......: execute command after saveing picture
[-p | --port ]..........: UDP port to listen for picture requests. UDP message is the filename to save
[-i | --input ].......: read frames from the specified input plugin (first input plugin between the arguments is the 0th)
---------------------------------------------------------------
output_init() return value signals to exit
- 基本参数:
- -f:指定保存图片的文件夹
- -d:保存图片后延时(单位:ms)
- -c:保存图片后执行命令
- -p:指定UDP端口监听图片请求
- -i:从指定的输入插件读取帧
输出插件4:output_rtsp.so
# mjpg-streamer -o "/snap/mjpg-streamer/42/lib/mjpg-streamer/output_rtsp.so --help"
MJPG Streamer Version: git rev: f387bb44e6c087271b763b27da998bf2e06c4f5d
---------------------------------------------------------------
Help for output plugin..: RTSP output plugin
---------------------------------------------------------------
The following parameters can be passed to this plugin:
[-p | --port ]..........: UDP port to listen for picture requests. UDP message is the filename to save
[-i | --input ].......: read frames from the specified input plugin (first input plugin between the arguments is the 0th)
---------------------------------------------------------------
output_init() return value signals to exit
- 基本参数:
- -p:指定UDP端口监听图片请求
- -i:从指定的输入插件读取帧
输出插件5:output_viewer.so
# mjpg-streamer -o "/snap/mjpg-streamer/42/lib/mjpg-streamer/output_viewer.so --help"
MJPG Streamer Version: git rev: f387bb44e6c087271b763b27da998bf2e06c4f5d
---------------------------------------------------------------
Help for output plugin..: VIEWER output plugin
---------------------------------------------------------------
output_init() return value signals to exit
- 基本参数:
- 无
执行mjpg_streamer获取摄像头数据
- 如下所示我们使用-i参数指定输入so插件类型为uvc类型,-d参数指定使用的摄像头设备为/dev/video1 ,-r参数指定输入分辨率为640x480 ,-q参数指定uvc数据质量为90,-n参数说明不要初始化Linux-UVC驱动程序的dynctrls,-o参数指定输出类型为http方式,-w指定网站目录为/usr/camera/web
mjpg_streamer -i "/usr/lib/mjpg-streamer/input_uvc.so -d /dev/video1 -r 640x480 -f 30 -q 90 -n" -o "/usr/lib/mjpg-streamer/output_http.so -w /usr/share/mjpg-streamer/www/"
浏览器打开并查看摄像头数据
- 如上所示我们的开发板IP地址为
192.168.1.21
,让后我们使用电脑浏览器打开如下地址即可预览摄像头数据。
192.168.1.21:8080