gstreamer系列之ubuntu18上安装使用(代码片段)

狂奔的CD 狂奔的CD     2022-12-12     282

关键词:

文章目录

前言

网上教程看的我一脸懵逼,可能因为有新旧版本的问题,总之,经过一番了解,现在整理一版自己能看懂的gstreamer的资料。我的使用的是ubuntu18 阿里云镜像直接apt安装的,版本为gstreamer1.14

正文

参考文档

照目前看来,gstreamer是由一个个插件,中间使用管道连接起来使用的。用好gstreamer的关键就是了解它各个插件的用法,当然最好还是详细看下gstreamer的底层机制。参考https://www.cnblogs.com/xleng/p/10948838.html

ubuntu18上安装

安装前置

sudo apt update
sudo apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-doc gstreamer1.0-tools gstreamer1.0-x gstreamer1.0-alsa gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-qt5 gstreamer1.0-pulseaudio

【问题1】Err:2 http://cn.archive.ubuntu.com/ubuntu bionic/universe amd64 libfaad2 amd64 2.8.8-1
【解决方案】连接失败,把apt更换国内源,比如ali

$ sudo su -     # 切换到 root 目录 
# cd /etc/apt/
# mv sources.list  sources.list.bak
# vi  /etc/apt/sources.list    # 将下面的源复制到文件中, 保存退出
# apt update    # 更新本地 apt 源

deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

查看安装情况

dpkg -l | grep gstreamer

验证

参考官方文档

$ gst-inspect-1.0 fakesrc
$ gst-launch-1.0 -v fakesrc silent=false num-buffers=3 ! fakesink silent=false
$ gst-launch-1.0 videotestsrc ! videoconvert ! autovideosink

ps: If autovideosink doesn’t work, try an element that’s specific for your operating system and windowing system, such as ximagesink or glimagesink or (on windows) d3dvideosink.

gstreamer的使用

1 查看当前插件

$ gst-inspect-1.0
coretracers:  latency (GstTracerFactory)
coretracers:  log (GstTracerFactory)
coretracers:  rusage (GstTracerFactory)
coretracers:  stats (GstTracerFactory)
coretracers:  leaks (GstTracerFactory)
videorate:  videorate: Video rate adjuster
videotestsrc:  videotestsrc: Video test source
adder:  adder: Adder
tcp:  socketsrc: socket source
tcp:  tcpclientsink: TCP client sink
tcp:  tcpclientsrc: TCP client source
tcp:  tcpserversink: TCP server sink
tcp:  tcpserversrc: TCP server source
tcp:  multifdsink: Multi filedescriptor sink
tcp:  multisocketsink: Multi socket sink
audiomixer:  audiomixer: AudioMixer
audiomixer:  liveadder: AudioMixer
audiomixer:  audiointerleave: AudioInterleave
audiotestsrc:  audiotestsrc: Audio test source
videoscale:  videoscale: Video scaler
ximagesink:  ximagesink: Video sink
gio:  giosink: GIO sink
gio:  giosrc: GIO source
gio:  giostreamsink: GIO stream sink
gio:  giostreamsrc: GIO stream source
volume:  volume: Volume
audioresample:  audioresample: Audio resampler
videoconvert:  videoconvert: Colorspace converter
typefindfunctions: video/x-ms-asf: asf, wm, wma, wmv
typefindfunctions: audio/x-musepack: mpc, mpp, mp+
typefindfunctions: audio/x-au: au, snd
typefindfunctions: video/x-msvideo: avi
typefindfunctions: audio/qcelp: qcp
typefindfunctions: video/x-cdxa: dat
typefindfunctions: video/x-vcd: dat
typefindfunctions: audio/x-imelody: imy, ime, imelody
typefindfunctions: audio/midi: mid, midi
typefindfunctions: audio/riff-midi: mid, midi
typefindfunctions: audio/mobile-xmf: mxmf
typefindfunctions: video/x-fli: flc, fli
typefindfunctions: application/x-id3v2: mp3, mp2, mp1, mpga, ogg, flac, tta
typefindfunctions: application/x-id3v1: mp3, mp2, mp1, mpga, ogg, flac, tta
typefindfunctions: application/x-apetag: mp3, ape, mpc, wv
typefindfunctions: audio/x-ttafile: tta
typefindfunctions: audio/x-mod: 669, amf, ams, dbm, digi, dmf, dsm, gdm, far, imf, it, j2b, mdl, med, mod, mt2, mtm, okt, psm, ptm, sam, s3m, stm, stx, ult, umx, xm
typefindfunctions: audio/mpeg: mp3, mp2, mp1, mpga
typefindfunctions: audio/x-ac3: ac3, eac3
typefindfunctions: audio/x-dts: dts
typefindfunctions: audio/x-gsm: gsm
typefindfunctions: video/mpeg-sys: mpe, mpeg, mpg
typefindfunctions: video/mpegts: ts, mts
typefindfunctions: application/ogg: ogg, oga, ogv, ogm, ogx, spx, anx, axa, axv
typefindfunctions: video/mpeg-elementary: mpv, mpeg, mpg
typefindfunctions: video/mpeg4: m4v
typefindfunctions: video/x-h263: h263, 263
typefindfunctions: video/x-h264: h264, x264, 264
typefindfunctions: video/x-h265: h265, x265, 265
typefindfunctions: video/x-nuv: nuv
typefindfunctions: audio/x-m4a: m4a
typefindfunctions: application/x-3gp: 3gp
typefindfunctions: video/quicktime: mov, mp4
typefindfunctions: image/x-quicktime: qif, qtif, qti
typefindfunctions: image/jp2: jp2
typefindfunctions: image/x-jpc: jpc, j2k
typefindfunctions: video/mj2: mj2
typefindfunctions: text/html: htm, html
typefindfunctions: application/vnd.rn-realmedia: ra, ram, rm, rmvb
typefindfunctions: application/x-pn-realaudio: ra, ram, rm, rmvb
typefindfunctions: application/x-shockwave-flash: swf, swfl
typefindfunctions: application/dash+xml: mpd, MPD
typefindfunctions: application/vnd.ms-sstr+xml: no extensions
typefindfunctions: video/x-flv: flv
typefindfunctions: text/plain: txt
typefindfunctions: text/utf-16: txt
typefindfunctions: text/utf-32: txt
typefindfunctions: text/uri-list: ram
typefindfunctions: application/itc: itc
typefindfunctions: application/x-hls: m3u8
typefindfunctions: application/sdp: sdp
typefindfunctions: application/smil: smil
typefindfunctions: application/ttml+xml: ttml+xml
typefindfunctions: application/xml: xml
typefindfunctions: audio/x-wav: wav
typefindfunctions: audio/x-aiff: aiff, aif, aifc
typefindfunctions: audio/x-svx: iff, svx
typefindfunctions: audio/x-paris: paf
typefindfunctions: audio/x-nist: nist
typefindfunctions: audio/x-voc: voc
typefindfunctions: audio/x-sds: sds
typefindfunctions: audio/x-ircam: sf
typefindfunctions: audio/x-w64: w64
typefindfunctions: audio/x-rf64: rf64
typefindfunctions: audio/x-shorten: shn
typefindfunctions: application/x-ape: ape
typefindfunctions: image/jpeg: jpg, jpe, jpeg
typefindfunctions: image/gif: gif
typefindfunctions: image/png: png
typefindfunctions: image/bmp: bmp
typefindfunctions: image/tiff: tif, tiff
typefindfunctions: image/webp: webp
typefindfunctions: image/x-exr: exr
typefindfunctions: image/x-portable-pixmap: pnm, ppm, pgm, pbm
typefindfunctions: video/x-matroska: mkv, mka, mk3d, webm
typefindfunctions: application/mxf: mxf
typefindfunctions: video/x-mve: mve
typefindfunctions: video/x-dv: dv, dif
typefindfunctions: audio/x-amr-nb-sh: amr
typefindfunctions: audio/x-amr-wb-sh: amr
typefindfunctions: audio/iLBC-sh: ilbc
typefindfunctions: audio/x-sbc: sbc
typefindfunctions: audio/x-sid: sid
typefindfunctions: image/x-xcf: xcf
typefindfunctions: video/x-mng: mng
typefindfunctions: image/x-jng: jng
typefindfunctions: image/x-xpixmap: xpm
typefindfunctions: image/x-sun-raster: ras
typefindfunctions: application/x-bzip: bz2
typefindfunctions: application/x-gzip: gz
typefindfunctions: application/zip: zip
typefindfunctions: application/x-compress: Z
typefindfunctions: subtitle/x-kate: no extensions
typefindfunctions: application/x-subtitle-vtt: vtt
typefindfunctions: audio/x-flac: flac
typefindfunctions: audio/x-vorbis: no extensions
typefindfunctions: video/x-theora: no extensions
typefindfunctions: application/x-ogm-video: no extensions
typefindfunctions: application/x-ogm-audio: no extensions
typefindfunctions: application/x-ogm-text: no extensions
typefindfunctions: audio/x-speex: no extensions
typefindfunctions: audio/x-celt: no extensions
typefindfunctions: application/x-ogg-skeleton: no extensions
typefindfunctions: text/x-cmml: no extensions
typefindfunctions: application/x-executable: no extensions
typefindfunctions: audio/aac: aac, adts, adif, loas
typefindfunctions: audio/x-spc: spc
typefindfunctions: audio/x-wavpack: wv, wvp
typefindfunctions: audio/x-wavpack-correction: wvc
typefindfunctions: audio/x-caf: caf
typefindfunctions: application/postscript: ps
typefindfunctions: image/svg+xml: svg
typefindfunctions: application/x-rar: rar
typefindfunctions: application/x-tar: tar
typefindfunctions: application/x-ar: a
typefindfunctions: application/x-ms-dos-executable: dll, exe, ocx, sys, scr, msstyles, cpl
typefindfunctions: video/x-dirac: no extensions
typefindfunctions: multipart/x-mixed-replace: no extensions
typefindfunctions: application/x-mmsh: no extensions
typefindfunctions: video/vivo: viv
typefindfunctions: audio/x-nsf: nsf
typefindfunctions: audio/x-gym: gym
typefindfunctions: audio/x-ay: ay
typefindfunctions: audio/x-gbs: gbs
typefindfunctions: audio/x-vgm: vgm
typefindfunctions: audio/x-sap: sap
typefindfunctions: video/x-ivf: ivf
typefindfunctions: audio/x-kss: kss
typefindfunctions: application/pdf: pdf
typefindfunctions: application/msword: doc
typefindfunctions: image/vnd.adobe.photoshop: psd
typefindfunctions: image/vnd.wap.wbmp: no extensions
typefindfunctions: application/x-yuv4mpeg: no extensions
typefindfunctions: image/x-icon: no extensions
typefindfunctions: image/x-degas: no extensions
typefindfunctions: application/octet-stream: no extensions
typefindfunctions: application/x-ssa: ssa, ass
typefindfunctions: video/x-pva: pva
typefindfunctions: audio/x-xi: xi
typefindfunctions: audio/audible: aa, aax
audioconvert:  audioconvert: Audio converter
subparse: subparse_typefind: srt, sub, mpsub, mdvd, smi, txt, dks, vtt
subparse:  subparse: Subtitle parser
subparse:  ssaparse: SSA Subtitle Parser
playback:  playbin: Player Bin 2
playback:  playbin3: Player Bin 3
playback:  playsink: Player Sink
playback:  subtitleoverlay: Subtitle Overlay
playback:  streamsynchronizer: Stream Synchronizer
playback:  decodebin: Decoder Bin
playback:  decodebin3: Decoder Bin 3
playback:  uridecodebin: URI Decoder
playback:  uridecodebin3: URI Decoder
playback:  urisourcebin: URI reader
playback:  parsebin: Parse Bin
pbtypes:  GstVideoMultiviewFlagsSet (GstDynamicTypeFactory)
rawparse:  unalignedaudioparse: unalignedaudioparse
rawparse:  unalignedvideoparse: unalignedvideoparse
rawparse:  rawaudioparse: rawaudioparse
rawparse:  rawvideoparse: rawvideoparse
encoding:  encodebin: Encoder Bin
app:  appsrc: AppSrc
app:  appsink: AppSink
audiorate:  audiorate: Audio rate adjuster
coreelements:  streamiddemux: Streamid Demux
coreelements:  valve: Valve element
coreelements:  multiqueue: MultiQueue
coreelements:  typefind: TypeFind
coreelements:  tee: Tee pipe fitting
coreelements:  filesink: File Sink
coreelements:  queue2: Queue 2
coreelements:  queue: Queue
coreelements:  output-selector: Output selector
coreelements:  input-selector: Input selector
coreelements:  identity: Identity
coreelements:  funnel: Funnel pipe fitting
coreelements:  filesrc: File Source
coreelements:  fdsink: Filedescriptor Sink
coreelements:  fdsrc: Filedescriptor Source
coreelements:  fakesink: Fake Sink
coreelements:  fakesrc: Fake Source
coreelements:  downloadbuffer: DownloadBuffer
coreelements:  dataurisrc: data: URI source element
coreelements:  concat: Concat
coreelements:  capsfilter: CapsFilter
opengl:  glfilterglass: OpenGL glass filter
opengl:  gldeinterlace: OpenGL deinterlacing filter
opengl:  gltestsrc: Video test source
opengl:  glstereosplit: GLStereoSplit
opengl:  glviewconvert: OpenGL Multiview/3D conversion filter
opengl:  glfilterapp: OpenGL application filter
opengl:  glshader: OpenGL fragment shader filter
opengl:  glcolorscale: OpenGL color scale
opengl:  gleffects_laplacian: Laplacian Convolution Demo Effect
opengl:  gleffects_blur: Blur with 9x9 separable convolution Effect
opengl:  gleffects_sobel: Sobel edge detection Effect
opengl:  gleffects_glow: Glow Lighting Effect
opengl:  gleffects_sin: All Grey but Red Effect
opengl:  gleffects_xray: Glowing negative effect
opengl:  gleffects_lumaxpro: Luma Cross Processing Effect
opengl:  gleffects_xpro: Cross Processing Effect
opengl:  gleffects_sepia: Sepia Toning Effect
opengl:  gleffects_heat: Heat Signature Effect
opengl:  gleffects_square: Square Effect
opengl:  gleffects_bulge: Bulge Effect
opengl:  gleffects_twirl: Twirl Effect
opengl:  gleffects_fisheye: FishEye Effect
opengl:  gleffects_tunnel: Light Tunnel Effect
opengl:  gleffects_stretch: Stretch Effect
opengl:  gleffects_squeeze: Squeeze Effect
opengl:  gleffects_mirror: Mirror Effect
opengl:  gleffects_identity: Do nothing Effect
opengl:  gleffects: Gstreamer OpenGL Effects
opengl:  glfiltercube: OpenGL cube filter
opengl:  glsrcbin: GL Src Bin
opengl:  glsinkbin: GL Sink Bin
opengl:  glfilterbin: GL Filter Bin
opengl:  glcolorbalance: Video balance
opengl:  glcolorconvert: OpenGL color converter
opengl:  gldownload: OpenGL downloader
opengl:  glupload: OpenGL uploader
opengl:  glimagesinkelement: OpenGL video sink
opengl:  glimagesink: GL Sink Bin
staticelements:  bin: Generic bin
staticelements:  pipeline: Pipeline object

Total count: 25 plugins, 253 features

ps: 25个插件指的是 coretracers, videorate,videotestsrc, adder,tcp,audiomixer,audiotestsrc,videoscale,ximagesink,gio,volume,audioresample,videoconvert,typefindfunctions,audioconvert,subparse,playback,pbtypes,rawparse,encoding,app,audiorate,coreelements,opengl,staticelements

各插件用法参考官方文档 https://gstreamer.freedesktop.org/documentation/plugins_doc.html?gi-language=c
同时可以看到还有很多插件这里并未安装

当然也可以直接查看某个插件是否存在

# 查看nvidia硬件解码器是否存在
$ gst-inspect-1.0 nvdec
No such element or plugin 'nvdec'

2 了解如何使用

官方提供了比较丰富的tutorials,有耐心的可以一个个试试

这里是中文教程

这里介绍了tools的用法,包含了gst-launch-1.0, gst-inspect-1.0 and gst-discoverer-1.0 Basic tutorial 10: GStreamer tools

这里介绍了好用的元素,比如bin Basic tutorial 14: Handy elements

3 编译安装

由于apt获取安装的gstreamer少了许多想要的功能,这里采用编译安装
源代码 git仓库

linux系列之ubuntu篇:vmvare安装ubuntu

第一步:安装VmvareVmvare官网:https://www.vmware.com/cn/products/workstation-pro.htmlVmvare本身作为一款付费软件,可以自行寻找破解版,进行安装。 第二步:Ubuntu镜像下载(以Ubuntu18.04为例)1.下载地址Ubuntu官网地址:ht 查看详情

deepstream系列之6.1版本安装及测试

点击查看系列文章目录0背景截止到今天(2022.8.12),deepstream更新到了6.1版本,本文对新版本进行一个安装测试,并对升级内容进行一个分析。在Jetson端因为只支持jetpack5.0.1DP,只能在NX\\AGX\\Orin设备上测试,手头暂时没有,因此... 查看详情

原创笔记cicd系列之三:goharbor安装

CICD系列之三:goharbor安装准备主机:10.0.0.14将Harbor安装在linux上。在安装Harbor之前,必须确保机器上已经安装了docker17.06.0-ce+和docker-compose1.18.0+。1.升级docker(按需)wgethttps://download.docker.com/l...yum-yinstalldocker-ce-17.06.2.ce-1.e 查看详情

在ubuntu18.04上使用静态可执行文件安装dockerce及后续设置(代码片段)

在Ubuntu18.04上使用静态可执行文件安装DockerCE及后续设置前几天安装了最新的Ubuntu18.04LTS,想在上面安装一个docker,结果发现docker官方的软件源里没有Ubuntu18.04的安装包版本,可能是系统太新了,官方还没来得及制... 查看详情

经验分享ubuntu安装deepstream6.0(代码片段)

...u上安装deepstream6.0的方法。 一些版本要求:Ubuntu18.04GStreamer1.14.5NVIDIAdriver470.63.01CUDA11.4TensorRT8.0.1文章目录1、安装依赖2、安装TensorRT8.0.13、安装librdkafka4、安装deepstreamsdk4.1方法一:使用Debian安装4.2方法二:使用源码安... 查看详情

在 ubuntu 18.04 上使用 libnvinfer7 库(Cuda 10.2)安装 TensorRT 面临的问题

】在ubuntu18.04上使用libnvinfer7库(Cuda10.2)安装TensorRT面临的问题【英文标题】:InstallingTensorRT-facingissuewithlibnvinfer7library(Cuda10.2)onubuntu18.04【发布时间】:2020-09-1512:44:46【问题描述】:我试图在ubuntu18.4(nv-tensorrt-repo-ubuntu1804-cuda10.2-t 查看详情

ubuntu18.04上使用xrdp远程桌面连接

  参考:https://blog.csdn.net/qq_25556149/article/details/82216190  1,环境查看    2,安装 xrdp、tightvncserverapt-getinstalltightvncserverxrdp  这里要注意的是,如果你的系统中支持Xorg的话,要先安装tightvncserver再安装xrdp,因为这会... 查看详情

在 Ubuntu 18.04 LTS 上安装 wordpress

】在Ubuntu18.04LTS上安装wordpress【英文标题】:InstallwordpressonUbuntu18.04LTS【发布时间】:2019-05-0907:45:56【问题描述】:我正在尝试,但遇到了问题。我正在一步一步做每一件事。我安装了这些东西,我也检查了状态:Apache(状态为... 查看详情

openstack安装部署指南翻译系列之启动一个实例

本节创建必要的虚拟网络以支持启动实例。网络选项1包括一个提供者provider(external)网络,一个实例使用它。网络选项2包括一个提供商provider网络,一个实例使用它,一个自助服务(private)网络与一个使用它的实例。本节中的... 查看详情

如何在虚拟机Ubuntu 18.04上安装catkin

】如何在虚拟机Ubuntu18.04上安装catkin【英文标题】:HowtoinstallcatkinonavirtualmachineUbuntu18.04【发布时间】:2019-09-2317:11:48【问题描述】:我觉得我有靛蓝...我按照说明操作:https://wiki.ros.org/catkin#Installing_catkin有人可以帮我解决这个问... 查看详情

经验分享ubuntu安装deepstream5.1(代码片段)

...的,可能更通用一些。 一些版本要求:Ubuntu18.04GStreamer1.14.1NVIDIAdriver460.32CUDA11.1TensorRT7.2.3文章目录1、安装Gstreamer2、安装TensorRT7.2.33、安装librdkafka4、安装deepstreamsdk5、验证是否安装成功1、安装Gstreamersudoapt-getinstalllibgstrea... 查看详情

gstreamer应用开发手册学习笔记之二

第3章.基础概念介绍本章将介绍GStreamer的基本概念。理解这些概念对于你后续的学习非常重要,因为后续深入的讲解我们都假定你已经完全理解了这些概念。3.1.元件(Elements)元件(element)是GStreamer中最重要的概念。你可以通过创建一... 查看详情

hadoop系列之spark安装和使用

spark简介Spark的主要抽象是分布式的元素集合(distributedcollectionofitems),称为RDD(ResilientDistributedDataset,弹性分布式数据集),它可被分发到集群各个节点上,进行并行操作。RDDs可以通过HadoopInputFor 查看详情

无法通过 asdf (Ubuntu 18.04.1) 使用 openssl 安装 Erlang

】无法通过asdf(Ubuntu18.04.1)使用openssl安装Erlang【英文标题】:CannotInstallErlangwithopensslviaasdf(Ubuntu18.04.1)【发布时间】:2019-03-2517:29:27【问题描述】:我在Ubuntu18.04.1上。每当我尝试通过asdf安装任何版本的erlang时,都会收到以下消息... 查看详情

pip

如何在Ubuntu18.04上安装Pip[日期:2018-05-15] 来源:Linux公社作者:醉落红尘 [字体:大中小]Pip是一个软件包管理系统,它简化了用Python编写的软件包(如Python包索引(PyPI)中的软件包)的安装和管理。在Ubuntu18.04上缺省没有安装Pip... 查看详情

pip

如何在Ubuntu18.04上安装Pip[日期:2018-05-15] 来源:Linux公社作者:醉落红尘 [字体:大中小]Pip是一个软件包管理系统,它简化了用Python编写的软件包(如Python包索引(PyPI)中的软件包)的安装和管理。在Ubuntu18.04上缺省没有安装Pip... 查看详情

在 ubuntu 18 上删除 Docker

】在ubuntu18上删除Docker【英文标题】:RemoveDockeronubuntu18【发布时间】:2018-12-1419:22:04【问题描述】:我在ubuntu18中安装了docker,现在想删除所有内容以进行全新安装。曾使用:sudoapt-getinstalldocker.io这个***线程(虽然不适合我的确... 查看详情

尝试在 Xampp (ubuntu 18.04) 上安装备份时无法登录到 wordpress 管理区域

】尝试在Xampp(ubuntu18.04)上安装备份时无法登录到wordpress管理区域【英文标题】:Unabeltologintowordpress\'sadminareawhentriedtoinstallthebackuponXampp(ubuntu18.04)【发布时间】:2020-02-1606:33:06【问题描述】:我最近在使用WordPress构建的网站时遇到... 查看详情