当前位置:网站首页>Gst-launch-1.0 usage notes
Gst-launch-1.0 usage notes
2022-04-23 18:04:00 【Xu Yeping】
Due to the use of DeepStream This framework , I can't get around it gstreamer-1.0, So I learned the usage of this framework during this time . Not able to read the source code .gstreamer In the frame ,gst-inspect-1.0 and gst-launch-1.0 These two tools must be familiar with , Now gst-launcher-1.0 Take notes of the usage of , So as not to forget . Reference resources https://blog.csdn.net/u010168781/article/details/102805210
One 、 Command format
gst-launch-1.0 [OPTIONS] PIPELINE-DESCRIPTION
1. Parameter options
- -help
- -v, --verbose
- -q, --quiet Don't print information
- -m, --messages Output messages on the pipeline bus
- -t, --tags Output flag tag( Also known as metadata )
- -o FILE, --output=FILE Save pipe to XML In file , And exit
- -f, --no_fault Do not install fault handlers
- -T, --trace Print memory allocation tracking . This feature must be enabled at compile time to work .
2. Pipe description string
- Components : ELEMENTTYPE [PROPERTY1 …]
- Component properties :PROPERTY=VALUE …, Use spaces between multiple values
- The box Bin: [BINTYPE.] ([PROPERTY1 …] PIPELINE-DESCRIPTION), Usually in gst_parse_launch() Use in a function , Build part of the pipeline , Not a complete top-level pipeline
- link Link:[[SRCELEMENT].[PAD1,…]] ! [[SINKELEMENT].[PAD1,…]], take SRCELEMENT adopt “!” link to SINKELEMENT
[[SRCELEMENT].[PAD1,…]] ! CAPS ! [[SINKELEMENT].[PAD1,…]],CAPS Indicates filter , Links match CAPS Of PAD
Ability CAP:MIMETYPE [, PROPERTY[, PROPERTY …]]] [; CAPS[; CAPS …]], Using the given mimetype And optional given attribute creation function .
Ability attributes :NAME=[(TYPE)] VALUE in lists and ranges: [(TYPE)] VALUE
Two 、 Use cases
1. Play MP4 Audio and video
MP4 Documents usually have 2 A flow : Audio and video streams , Some files will have subtitle streams . Usually we only deal with 2 One stream is enough . The general video stream adopts h264 code , The audio stream adopts aac code . At first, because I was not familiar with gst-inspect Usage of , As a result, the audio and video decoder cannot find , A lot of time was wasted .
gst-inspect-1.0 | grep h264 find h264 decoder avdec_h264
gst-inspect-1.0 | grep aac find aac decoder avdec_aac. It can also be used. faad decode ,faad Output is 16 Bit audio ,avdec_aac Output is 32 Bit audio
gst-launch-1.0 About China demux I've been groping for a long time ,mp4 Documents need to use qtdemux(quick time demux), use names Property separation pipeline , The correct usage is as follows
Play the video
gst-launch-1.0 filesrc location=gongye.mp4 ! qtdemux name=demuxer demuxer. ! avdec_h264 ! xvimagesink
Play the audio (audioresample Optional )
gst-launch-1.0 filesrc location=gongye.mp4 ! qtdemux name=demuxer demuxer. ! avdec_aac ! audioconvert ! audioresample ! alsasink
Play audio and video
gst-launch-1.0 filesrc location=gongye.mp4 ! qtdemux name=demuxer demuxer. ! queue ! avdec_aac ! audioconvert ! alsasink demuxer. ! queue ! avdec_h264 ! xvimagesink
demuxer. The stream name can be specified later , Such as demuxer.video_0,demuxer.audio_0, The stream name must correspond to the stream name in the file .
Other file formats , Such as flv,ogg,mpeg And other documents can be used in a similar way , First use gst-inspect-1.0 Find the corresponding demux And audio and video decoder , Then build the pipeline and play immediately .
For... In components request pad,gst-launch-1.0 You can also specify request pad The connection of , Typical as tee,nvstreammux And other components need request pad, The connection is as follows :
gst-launch-1.0 filesrc location=sample_720.h264 ! h264parse ! nvv4l2decoder ! smuxer.sink_0 nvstreammux name=smuxer width=1920 height=1080 batch-size=1 batched-push-timeout=4000000 ! nvinfer config-file-path=dstest1_pgie_path.txt ! nvvideoconvert ! nvdsosd ! nvvideoconvert ! nvv4l2h264enc ! h264parse ! qtmux ! filesink location=test.mp4
The above command is right deepstream-test1 Command line simulation , But there is a lack of osd Probe function , So it's not complete , But it can also run , Mainly used to show nvstreammux request pad(sink_%u) Usage of . among nvv4l2decoder yes nvidia Hard decoding element ,nvstreammux yes deepstream Queue element , In the use of nvinfer This queue element must be used to add before reasoning nvinfer Data needed .nvinfer It's a reasoning element , The configuration file is dstest1_pgie_path.txt. of deepstream Information , Please check separately .
2. code
gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw,format=YUY2,width=640,height=480,framerate=30/1 ! videoconvert ! x264enc ! h264parse ! qtmux ! filesink location=1.mp4 -e
Be careful , At the end of the -e Can't save , Press down ctrl-c Key will be sent to the video stream EOS identification , Video stream can be fully encoded .
3. rtp Push flow
The sender :
gst-launch-1.0 v4l2src ! video/x-raw,format=YUY2,width=1280,height=720,framerate=10/1 ! videoconvert ! x264enc ! rtph264pay ! udpsink host=127.0.0.1 port=5600
The receiver :
gst-launch-1.0 udpsrc port=5600 caps='application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264' ! rtph264depay ! avdec_h264 ! videoconvert ! xvimagesink
————————————————
Copyright notice : This paper is about CSDN Blogger 「ywxuan」 The original article of , follow CC 4.0 BY-SA Copyright agreement , For reprint, please attach the original source link and this statement .
Link to the original text :https://blog.csdn.net/ywxuan/article/details/117629563
版权声明
本文为[Xu Yeping]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230544498000.html
边栏推荐
- C [file operation] read TXT text by line
- Docker 安装 MySQL
- Flash operates on multiple databases
- .104History
- C medium? This form of
- Box pointer of rust
- Random number generation of C #
- Arcpy adds fields and loop assignments to vector data
- Welcome to the markdown editor
- Laser slam theory and practice of dark blue College Chapter 3 laser radar distortion removal exercise
猜你喜欢

Classification of cifar100 data set based on convolutional neural network

.105Location

C# 网络相关操作

MySQL auto start settings start with systemctl start mysqld

Examination question bank and online simulation examination of the third batch (main person in charge) of special operation certificate of safety officer a certificate in Guangdong Province in 2022

解决允许在postman中写入注释请求接口方法

JS high frequency interview questions
Scikit learn sklearn 0.18 official document Chinese version

Random number generation of C #

C language loop structure program
随机推荐
2022 judgment questions and answers for operation of refrigeration and air conditioning equipment
Visualization of residential house prices
I/O多路复用及其相关详解
Crawl the product data of Xiaomi Youpin app
C language implements memcpy, memset, strcpy, strncpy, StrCmp, strncmp and strlen
Gobang game based on pyGame Library
2022 Jiangxi Photovoltaic Exhibition, China Distributed Photovoltaic Exhibition, Nanchang Solar Energy Utilization Exhibition
Timestamp to formatted date
Realsense selection comparison d455 d435i d415 t265 3D hardware comparison
Remember using Ali Font Icon Library for the first time
QTableWidget使用讲解
ArcGIS table to excel exceeds the upper limit, conversion failed
Selenium + phantom JS crack sliding verification 2
Nat Commun|在生物科学领域应用深度学习的当前进展和开放挑战
Re expression régulière
Climbing watermelon video URL
Auto.js 自定义对话框
纳米技术+AI赋能蛋白质组学|珞米生命科技完成近千万美元融资
解决报错max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
7-21 wrong questions involve knowledge points.