【树莓派5 测评】 + 13.视频推流功能测试(zmj)
树莓派5 的USB摄像头(UVC)借助mjpg-streamer实现网页监控推流十分便捷(电脑、手机均可以正常访问)。 ---------------------------以下为正文--------------------------- 1. mjpg-streamer下载及编译下载编译流程如下: - //------mjpg-streamer
- //---下载
- git clone https://github.com/jacksonliam/mjpg-streamer.git
- cd mjpg-streamer
- cd mjpg-streamer-experimental
- gcc -v
- //---依赖项/依赖库的安装
- sudo apt install cmake
- sudo apt-get install -y cmake libjpeg62-turbo-dev
- //---编译安装mjpg-streamer(需要sudo权限才能安装)
- sudo apt install cmake
- make all
- sudo make install
- //---测试指令
- sudo /usr/local/bin/mjpg_streamer -i "input_uvc.so -d /dev/video0 -r 1280x720 -y" -o "output_http.so"
- 部分测试配置(自动)如下所示:
- 设备:/dev/video0
- 分辨率:1280*720(720P)
- 帧率:1帧/秒(此种情况下节省网络带宽,降低CPU占用率)
- 格式:YUYV
- 端口:8080
- //---访问方式(PC端和手机端均OK,IP地址是:192.168.5.177):
- http://192.168.5.177:8080/?action=stream
复制代码 2. 测试结果最终呈现效果是网页端实时刷新(1帧/秒)摄像头结果,同一局域网内在PC端和手机端均能正常查看推流效果。 - //---测试指令
- sudo /usr/local/bin/mjpg_streamer -i "input_uvc.so -d /dev/video0 -r 1280x720 -y" -o "output_http.so"
- 部分测试配置(自动)如下所示:
- 设备:/dev/video0
- 分辨率:1280*720(720P)
- 帧率:1帧/秒(此种情况下节省网络带宽,降低CPU占用率)
- 格式:YUYV
- 端口:8080
- //---访问方式(PC端和手机端均OK):
- A.家中IP地址是:192.168.1.103
- http://192.168.1.103:8080/?action=stream
- B.单位IP地址是:192.168.7.25
- http://192.168.1.103:8080/?action=stream
- //------测试Log
- zhaomeijing@raspberrypi5:~/workspace/09_uvc/mjpg-streamer/mjpg-streamer-experimental$ \
- > ./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"
- -----------------------------------------------------------------------
- zhaomeijing@raspberrypi5:~/workspace/09_uvc/mjpg-streamer/mjpg-streamer-experimental$ \
- > sudo /usr/local/bin/mjpg_streamer -i "input_uvc.so -d /dev/video0 -r 1280x720 -y" -o "output_http.so"
- MJPG Streamer Version: git rev: 310b29f4a94c46652b20c4b7b6e5cf24e532af39
- i: Using V4L2 device.: /dev/video0
- i: Desired Resolution: 1280 x 720
- i: Frames Per Second.: -1
- i: Format............: YUYV
- i: JPEG Quality......: 80
- i: TV-Norm...........: DEFAULT
- UVCIOC_CTRL_ADD - Error at Pan (relative): Inappropriate ioctl for device (25)
- UVCIOC_CTRL_ADD - Error at Tilt (relative): Inappropriate ioctl for device (25)
- UVCIOC_CTRL_ADD - Error at Pan Reset: Inappropriate ioctl for device (25)
- UVCIOC_CTRL_ADD - Error at Tilt Reset: Inappropriate ioctl for device (25)
- UVCIOC_CTRL_ADD - Error at Pan/tilt Reset: Inappropriate ioctl for device (25)
- UVCIOC_CTRL_ADD - Error at Focus (absolute): Inappropriate ioctl for device (25)
- UVCIOC_CTRL_MAP - Error at Pan (relative): Inappropriate ioctl for device (25)
- UVCIOC_CTRL_MAP - Error at Tilt (relative): Inappropriate ioctl for device (25)
- UVCIOC_CTRL_MAP - Error at Pan Reset: Inappropriate ioctl for device (25)
- UVCIOC_CTRL_MAP - Error at Tilt Reset: Inappropriate ioctl for device (25)
- UVCIOC_CTRL_MAP - Error at Pan/tilt Reset: Inappropriate ioctl for device (25)
- UVCIOC_CTRL_MAP - Error at Focus (absolute): Inappropriate ioctl for device (25)
- UVCIOC_CTRL_MAP - Error at LED1 Mode: Inappropriate ioctl for device (25)
- UVCIOC_CTRL_MAP - Error at LED1 Frequency: Inappropriate ioctl for device (25)
- UVCIOC_CTRL_MAP - Error at Disable video processing: Inappropriate ioctl for device (25)
- UVCIOC_CTRL_MAP - Error at Raw bits per pixel: Inappropriate ioctl for device (25)
- o: www-folder-path......: disabled
- o: HTTP TCP port........: 8080
- o: HTTP Listen Address..: (null)
- o: username:password....: disabled
- o: commands.............: enabled
- ^[^Csetting signal to stop //手动Ctrl+C退出//
- i: cleaning up resources allocated by input thread
- o: cleaning up resources allocated by server thread #00
- force cancellation of threads and cleanup resources
- done
- zhaomeijing@raspberrypi5:~/workspace/09_uvc/mjpg-streamer/mjpg-streamer-experimental$
复制代码//------测试结果:网页和手机均可以正常访问视频推流 //------end
|