Changes

Jump to navigation Jump to search
Line 87: Line 87:  
<code>export DISPLAY=:0</code>
 
<code>export DISPLAY=:0</code>
   −
* 安装gstreamer
+
==== 安装gstreamer ====
 
   
<code>sudo apt-get install gstreamer1.0-tools</code>
 
<code>sudo apt-get install gstreamer1.0-tools</code>
   Line 107: Line 106:  
<code>     gstreamer1.0-gtk3</code>
 
<code>     gstreamer1.0-gtk3</code>
   −
* 运行 gstreamer videotest 命令
+
==== 运行 gstreamer videotest 命令 ====
 
   
<code>gst-launch-1.0 videotestsrc ! videoconvert ! autovideosink</code>
 
<code>gst-launch-1.0 videotestsrc ! videoconvert ! autovideosink</code>
   −
* 列出摄像头模组支持的数据格式
+
==== 抓拍一张图片(VEYE-MIPI-327,CS-MIPI-IMX307 @1080p mode) ====
 
  −
<code>v4l2-ctl -d /dev/video0 --list-formats-ext -D</code>
  −
 
  −
* 抓拍一张图片(VEYE-MIPI-327,CS-MIPI-IMX307 @1080p mode)
  −
 
   
<code>gst-launch-1.0 v4l2src num-buffers=1 device=/dev/video0 ! 'video/x-raw, format=(string)UYVY, width=1920,height=1080' ! jpegenc ! filesink location=test_image.jpg</code>
 
<code>gst-launch-1.0 v4l2src num-buffers=1 device=/dev/video0 ! 'video/x-raw, format=(string)UYVY, width=1920,height=1080' ! jpegenc ! filesink location=test_image.jpg</code>
   −
*帧率测试(VEYE-MIPI-327,CS-MIPI-IMX307 @1080p mode)
+
==== 帧率测试(VEYE-MIPI-327,CS-MIPI-IMX307 @1080p mode) ====
 
   
<code>gst-launch-1.0 v4l2src device=/dev/video0 ! "video/x-raw,format=(string)UYVY, width=(int)1920, height=(int)1080,framerate=(fraction)30/1" ! videoconvert ! fpsdisplaysink video-sink=fakesink -v</code>
 
<code>gst-launch-1.0 v4l2src device=/dev/video0 ! "video/x-raw,format=(string)UYVY, width=(int)1920, height=(int)1080,framerate=(fraction)30/1" ! videoconvert ! fpsdisplaysink video-sink=fakesink -v</code>
   −
* 视频预览(VEYE-MIPI-327,CS-MIPI-IMX307 @1080p mode)
+
==== 视频预览(VEYE-MIPI-327,CS-MIPI-IMX307 @1080p mode) ====
 
   
<code>gst-launch-1.0 v4l2src device=/dev/video0 ! "video/x-raw,format=(string)UYVY, width=(int)1920, height=(int)1080,framerate=(fraction)30/1" ! videoconvert ! autovideosink sync=false -v</code>
 
<code>gst-launch-1.0 v4l2src device=/dev/video0 ! "video/x-raw,format=(string)UYVY, width=(int)1920, height=(int)1080,framerate=(fraction)30/1" ! videoconvert ! autovideosink sync=false -v</code>
   −
* 视频预览并加时间戳显示(VEYE-MIPI-327,CS-MIPI-IMX307 @1080p mode)
+
==== 视频预览并加时间戳显示(VEYE-MIPI-327,CS-MIPI-IMX307 @1080p mode) ====
 
   
<code>gst-launch-1.0 v4l2src device=/dev/video0 ! "video/x-raw,format=(string)UYVY, width=(int)1920, height=(int)1080,framerate=(fraction)30/1"  ! videoconvert ! videoscale ! clockoverlay time-format="%D %H:%M:%S" ! video/x-raw, width=640, height=360 ! autovideosink</code>
 
<code>gst-launch-1.0 v4l2src device=/dev/video0 ! "video/x-raw,format=(string)UYVY, width=(int)1920, height=(int)1080,framerate=(fraction)30/1"  ! videoconvert ! videoscale ! clockoverlay time-format="%D %H:%M:%S" ! video/x-raw, width=640, height=360 ! autovideosink</code>
   −
*视频预览(CS-MIPI-IMX307,CS-MIPI-SC132 @720p mode)
+
==== 视频预览(CS-MIPI-IMX307,CS-MIPI-SC132 @720p mode) ====
 +
<code>gst-launch-1.0 v4l2src device=/dev/video0 ! "video/x-raw,format=(string)UYVY, width=(int)1280, height=(int)720,framerate=(fraction)60/1" ! videoconvert ! autovideosink sync=false -v</code>
   −
<code>gst-launch-1.0 v4l2src device=/dev/video0 ! "video/x-raw,format=(string)UYVY, width=(int)1280, height=(int)720,framerate=(fraction)60/1" ! videoconvert ! autovideosink sync=false -v</code>
+
==== 视频预览(CS-MIPI-IMX307,CS-MIPI-SC132 @vga mode) ====
 +
<code>gst-launch-1.0 v4l2src device=/dev/video0 ! "video/x-raw,format=(string)UYVY, width=(int)640, height=(int)480" ! videoconvert ! autovideosink sync=false -v</code>
   −
*视频预览(CS-MIPI-IMX307,CS-MIPI-SC132 @vga mode)
+
==== 视频预览(CS-MIPI-SC132 @1280*1080@45 mode) ====
 +
<code>gst-launch-1.0 v4l2src device=/dev/video0 ! "video/x-raw,format=(string)UYVY, width=(int)1280, height=(int)1080,framerate=(fraction)45/1" ! videoconvert ! autovideosink sync=false -v</code>
   −
<code>gst-launch-1.0 v4l2src device=/dev/video0 ! "video/x-raw,format=(string)UYVY, width=(int)640, height=(int)480" ! videoconvert ! autovideosink sync=false -v</code>
+
==== h.264编码并保存为mkv文件(VEYE-MIPI-X,CS-MIPI-IMX307 @1080p mode) ====
 +
<code>gst-launch-1.0 -e v4l2src device=/dev/video0  num-buffers=300  ! "video/x-raw,format=(string)UYVY, width=(int)1920, height=(int)1080,framerate=(fraction)30/1" ! v4l2h264enc extra-controls="controls, h264_profile=4, video_bitrate=6200000" ! 'video/x-h264, profile=high, level=(string)4' ! h264parse ! matroskamux ! filesink location=output.mkv</code>
 +
 
 +
==== h.264编码并保存为mp4文件(VEYE-MIPI-X,CS-MIPI-IMX307 @1080p mode) ====
 +
<code>gst-launch-1.0 -e v4l2src device=/dev/video0  num-buffers=300  ! "video/x-raw,format=(string)UYVY, width=(int)1920, height=(int)1080,framerate=(fraction)30/1" ! v4l2h264enc extra-controls="controls, h264_profile=4, video_bitrate=6200000" ! 'video/x-h264, profile=high, level=(string)4' ! h264parse ! mp4mux ! filesink location=video.mp4</code>
 +
==== 网络传输 TCP streaming====
 +
'''''树莓派(Server)一侧执行'''''
   −
*视频预览(CS-MIPI-SC132 @1280*1080@45 mode)
+
<code>gst-launch-1.0 -v v4l2src device=/dev/video0 num-buffers=-1 ! "video/x-raw,format=(string)UYVY, width=(int)1920, height=(int)1080,framerate=(fraction)30/1" ! v4l2h264enc extra-controls="controls, h264_profile=4, video_bitrate=4000000" ! 'video/x-h264, profile=high, level=(string)4' ! h264parse ! rtph264pay config-interval=1 pt=96 ! gdppay ! tcpserversink  host=x.x.x.x port=5000</code>
   −
<code>gst-launch-1.0 v4l2src device=/dev/video0 ! "video/x-raw,format=(string)UYVY, width=(int)1280, height=(int)1080,framerate=(fraction)45/1" ! videoconvert ! autovideosink sync=false -v</code>
+
码流带宽为4Mbps,持续传输,监听端口为5000。
   −
* h.264编码并保存为mkv文件(VEYE-MIPI-X,CS-MIPI-IMX307 @1080p mode)
+
'''''Client一侧执行'''''
   −
<code>gst-launch-1.0 -e v4l2src device=/dev/video0  num-buffers=300  ! "video/x-raw,format=(string)UYVY, width=(int)1920, height=(int)1080,framerate=(fraction)30/1" ! v4l2h264enc extra-controls="controls, h264_profile=4, video_bitrate=6200000" ! 'video/x-h264, profile=high, level=(string)4' ! h264parse ! matroskamux ! filesink location=output.mkv</code>
+
<code>gst-launch-1.0 -v tcpclientsrc host=x.x.x.x port=5000 ! gdpdepay ! rtph264depay ! avdec_h264 ! autovideosink sync=false</code>
   −
* h.264编码并保存为mp4文件(VEYE-MIPI-X,CS-MIPI-IMX307 @1080p mode)
+
其中x.x.x.x为树莓派(Server)的IP地址。
   −
<code>gst-launch-1.0 -e v4l2src device=/dev/video0  num-buffers=300  ! "video/x-raw,format=(string)UYVY, width=(int)1920, height=(int)1080,framerate=(fraction)30/1" ! v4l2h264enc extra-controls="controls, h264_profile=4, video_bitrate=6200000" ! 'video/x-h264, profile=high, level=(string)4' ! h264parse ! mp4mux ! filesink location=video.mp4</code>
+
Client一侧,如为windows系统,建议使用powershell。[https://gstreamer.freedesktop.org/ gstreamer]的windows版本[https://gstreamer.freedesktop.org/documentation/installing/on-windows.html?gi-language=c 下载地址]。只安装runtime files即可。
 
=== 参数控制软件包使用 ===
 
=== 参数控制软件包使用 ===
 
由于我们的摄像头参数自由度比较高,并没有采用V4L2参数进行控制,而是使用脚本进行参数配置。
 
由于我们的摄像头参数自由度比较高,并没有采用V4L2参数进行控制,而是使用脚本进行参数配置。

Navigation menu