【VisionFive 2:集成3D GPU RISC-V单板计算机】+10.视频推流测试(zmj)
赛昉科技“昉·星光 2”开发板的USB摄像头(UVC)借助mjpg-streamer实现网页监控推流十分便捷。
1. 下载编译
下载编译流程如下:
//------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 apt install cmake
make all
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):
http://192.168.100.200: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):
http://192.168.100.200:8080/?action=stream
//------测试Log
user@starfive:~/zmj_ws/gst/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"
-----------------------------------------------------------------------
user@starfive:~/zmj_ws/gst/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
user@starfive:~/zmj_ws/gst/mjpg-streamer/mjpg-streamer-experimental$
//------测试场景:
//------测试结果:
VisionFive2-mjpg_streamer
//------END