基于ubuntu18.04.6的gstreamer-plugin开发环境搭建

156 篇文章 16 订阅
98 篇文章 7 订阅

前序参考:

在Ubuntu18.04上从源码构建Gstreamer_papaofdoudou的博客-CSDN博客_ubuntu 18.04 gstreamer

开发环境

下载压缩包,我们使用1.21.1版本的插件和gstearmer核心软件包。

 安装依赖

$ sudo apt-get install build-essential dpkg-dev flex bison autotools-dev automake liborc-dev autopoint libtool gtk-doc-tools python3-pip bison flex ninja-build
$ sudo pip3 install meson
$ sudo snap install valgrind  --classic
$ sudo apt install valgrind
$ sudo apt-get install libgirepository1.0-dev libcap-dev libgtk-3-dev libunwind-dev clzip gobject-introspection libdw-dev

GSL和GMP库需要从源码开始编译安装,按照./configure && make && make install 三部操作即可安装。

编译gstreamer核心包

解压gstreamer-1.21.1.tar.xz,执行menson build命令编译安装gstreamer-1.21.1核心包,出现如下错误,原因是meson版本低于要求的版本,我们升级meson版本满足要求:

方法是升级python到3.8

$ sudo add-apt-repository ppa:deadsnakes/ppa
$ sudo apt install python3.8
$ python3.8 -m pip install --upgrade pip
$ /home/czl/.local/bin/pip3 install meson==0.63

为了避免和环境冲突,我们输入新安装的meson全路径调用

/home/czl/.local/bin/meson build

遇到错误,需要升级glib.

https://gitlab.gnome.org/GNOME/glib/-/tags

如下命令序列安装glib.

$ meson build
$ ninja -C build
$ ninja -C build install

之后再次执行/home/czl/.local/bin/meson build,成功

 之后执行如下命令编译完成gstreamer核心包

$ ninja -C build install
$ sudo ninja -C build install

 其他几个包或多或少都需要安装新的依赖,索性一起安装了:

$ sudo apt-get install libxv-dev libasound2-dev libtheora-dev libogg-dev libvorbis-dev
$ sudo apt-get install libbz2-dev libv4l-dev libvpx-dev libjack-jackd2-dev libsoup2.4-dev libpulse-dev
$ sudo apt-get install faad libfaad-dev libfaac-dev
$ sudo apt-get install libx264-dev libmad0-dev
$ sudo apt-get install yasm cmake

之后安装的几个PLUGIN,包括gst-plugins-base-1.21.1,gst-plugins-good-1.21.1,gst-plugins-bad-1.21.1,gst-plugins-ugly-1.21.1,连同gstreamer核心包一起,一共安装了5个,配置和编译方法都是一样的:

$ /home/czl/.local/bin/meson build
$ ninja -C build
$ sudo ninja -C build install

还剩下三个包没有安装,包括gst-libav-1.21.1.tar.xz,gst-omx-1.21.1.tar.xz,gstreamer-vaapi-1.21.1.tar.xz:

`不过并不影响我们搭建一个简单的从事管道进行测试,输出显示管道搭建成功,而GST版本确实也是我们编译安装的版本。

gst-launch-1.0 -v fakesrc num_buffers=5 ! fakesink

接下来安装其余的部分。

configure gst-libav-1.21.1.tar.xz

配置失败,是因为gst-libav之是一个符合GST插件标准的壳,真正完成编码,解码的是ffmpeg,上图的警告很明显,告诉我们需要libavfilter找不到,libavfilter是ffmpeg专门用来进行容器解封装的组件,所以下一步,我们首先安装ffmpeg.

ubuntu18.04编译FFMPEG_papaofdoudou的博客-CSDN博客_ubuntu18.04编译ffmpeg

下载ffmpeg解压&configuration:

$ /configure --target-os=linux --arch=x86_64 --disable-doc --enable-libx264 --enable-libmp3lame --enable-libopus --enable-debug=3 --extra-cflags="" --extra-ldflags="" --enable-gpl
$ make && sudo make install

test ffplay:

success of installing gst-libav plugin.

Test gstreamer with pipeline:

gst-play-1.0 webwxgetvideo.mp4

Test Fine.

install gstreamer-vaapi-1.21.1

lack of libva, so should install libva first.

主流浏览器上HTML5多媒体播放器的实现以及加速方式_papaofdoudou的博客-CSDN博客

$ git clone https://github.com/intel/libva.git
$ git reset --hard 2.16.0

after this, reconfig the vaapi plugin compile process:

/home/czl/.local/bin/meson build

VAAPI plugin info:

gst-inspect-1.0 ./build/gst/vaapi/libgstvaapi.so

how to create your own plugin?

1.get the gst-template project

git clone git://anongit.freedesktop.org/gstreamer/gst-template.git

 2.step into gst-template/gst-plugin/src, execute

./../tools/make_element zlcao

 zlcao is the name of the plugin.

3.back to top dir gst-template,execute

$ meson build
$ ninja -C build

 the zlcao plugin was generated:

 gst inspect:

 gst-inspect-1.0 ./build/gst-plugin/libgstzlcao.so

gst inspect zlcao plugin:

copy the new generated libgstzlcao.so to gst recongnized directory  

/home/czl/.local/share/gstreamer-1.0/plugins/

cp ./build/gst-plugin/libgstzlcao.so /home/czl/.local/share/gstreamer-1.0/plugins/

then inspect the plugin "zlcao" with gst-inspect tools:

gst-inspect-1.0 zlcao


结束

  • 2
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

papaofdoudou

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值