1.View the Pixel format
v4l2-ctl --list-formats-ext
2.Preview
If you want to use ssh connection, please export DISPLAY=:0
gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw, format=GAY8, width=2560, height=800 ! videoconvert ! xvimagesink
format
: Select the Pixel format (v4l2-ctl --list-formats-ext
— Pixel format).
width
,height:
Select the resolution (v4l2-ctl --list-formats-ext
— Size).
ximagesink
: Preview. If does not work, please try ximagesink (xvimagesink), glimagesink, d3dvideosink (Windows).
3.Capture video
gst-launch-1.0 v4l2src device=/dev/video0 ! 'video/x-raw,format=(string)GRAY8,width=(int)2560,height=(int)800' ! nvvidconv ! 'video/x-raw(memory:NVMM), format=(string)I420' ! omxh264enc ! 'video/x-h264, stream-format=(string)byte-stream' ! h264parse ! qtmux ! filesink location=test.mp4 -e
format
: Select the Pixel format (v4l2-ctl --list-formats-ext
— Pixel format).
width
,height:
Select the resolution (v4l2-ctl --list-formats-ext
— Size).
4.Streaming
4.1 Streaming Sever
gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw,format=GRAY8,width=2560,height=800 ! nvvidconv ! 'video/x-raw(memory:NVMM), format=(string)I420' ! omxh264enc profile=high cabac-entropy-coding=true insert-sps-pps=true iframeinterval=60 ! 'video/x-h264, level=(string)4.2, stream-format=(string)byte-stream' ! tcpserversink host=0.0.0.0 port=5001 -v
4.2 Streaming Client
Please exit the virtual machine created with anacondac, or you can install conda install gst-libav -c conda-forge
gst-launch-1.0 -v tcpclientsrc host=0.0.0.0 port=5001 ! decodebin ! fpsdisplaysink sync=false text-overlay=false
or
gst-launch-1.0 -ve tcpclientsrc host=0.0.0.0 port=5001 ! decodebin ! autovideosink
autovideosink
: Preview. If does not work, please tryximagesink
(xvimagesink
),glimagesink
,d3dvideosink
(Windows).