当前位置:网站首页>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
边栏推荐
- idea中安装YapiUpload 插件将api接口上传到yapi文档上
- Format problems encountered in word typesetting
- Climbing watermelon video URL
- Gobang game based on pyGame Library
- Notes on common basic usage of eigen Library
- C language loop structure program
- Classification of cifar100 data set based on convolutional neural network
- Qt读写XML文件(含源码+注释)
- The difference between deep copy and shallow copy
- 纳米技术+AI赋能蛋白质组学|珞米生命科技完成近千万美元融资
猜你喜欢
随机推荐
MySQL_ 01_ Simple data retrieval
Encapsulate a timestamp to date method on string prototype
An example of linear regression based on tensorflow
Queue solving Joseph problem
Build openstack platform
Realsense selection comparison d455 d435i d415 t265 3D hardware comparison
ArcGIS table to excel exceeds the upper limit, conversion failed
What are the relationships and differences between threads and processes
A few lines of code teach you to crawl lol skin pictures
2022江西光伏展,中國分布式光伏展會,南昌太陽能利用展
Theory and practice of laser slam in dark blue College - Chapter 2 (odometer calibration)
Re regular expression
.105Location
ES6
Random number generation of C #
Nodejs安装
mysql自动启动设置用Systemctl start mysqld启动
Reptile efficiency improvement method
Installation du docker redis
C1 notes [task training chapter I]