“Mjpg-streamer”的版本间的差异

来自百问网嵌入式Linux wiki
(创建页面,内容为“mjpg-streamer”)
 
第1行: 第1行:
mjpg-streamer
+
=查看摄像头数据=
 +
==列出所有摄像头设备==
 +
<syntaxhighlight lang="bash">
 +
[root@imx6ull:~]# v4l2-ctl --list-devices
 +
pxp (pxp_v4l2):
 +
        /dev/video0
 +
 
 +
USB 2.0 Camera (usb-ci_hdrc.1-1.3):
 +
        /dev/video1
 +
</syntaxhighlight>
 +
==查看摄像头详细信息==
 +
<syntaxhighlight lang="bash">
 +
[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
 +
</syntaxhighlight>
 +
 
 +
==查看摄像头支持的像素格式和分辨率==
 +
<syntaxhighlight lang="bash">
 +
[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)
 +
 
 +
</syntaxhighlight>
 +
=使用mjpg_streamer预览摄像头数据=
 +
==查看开发板IP地址==
 +
<syntaxhighlight lang="bash">
 +
[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)
 +
</syntaxhighlight>
 +
==执行mjpg_streamer获取摄像头数据==
 +
mjpg_streamer -i "/usr/lib/input_uvc.so -d /dev/video0 -r 640x480 -f 30 -q 90 -n" -o "/usr/lib/output_http.so -w /usr/camera/web"
 +
==浏览器打开并查看摄像头数据==

2020年6月4日 (四) 15:57的版本

查看摄像头数据

列出所有摄像头设备

[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 -i "/usr/lib/input_uvc.so -d /dev/video0 -r 640x480 -f 30 -q 90 -n" -o "/usr/lib/output_http.so -w /usr/camera/web"

浏览器打开并查看摄像头数据