使用Cerbero编译gstreamer

使用Cerbero编译gstreamer

Cerbero是一个跨平台的开源项目构建聚合工具,可以为不同的平台、架构和发行版构建和创建本地包。它支持本地编译和交叉编译,可以在MacOS、Linux和Windows上运行。

build link

下载cerbero

git clone https://gitlab.freedesktop.org/gstreamer/cerbero

配置env

执行cerbero-uninstalled可能碰到的错误

$ ./cerbero-uninstalled 
Python >= 3.8 detected and the 'distro' python package was not found.

$ pip3 install distro

运行cerbero-uninstalled,可能需要手动安装libssl-dev依赖

sudo aptitude install libssl-dev

bootstrap命令使用软件包管理器安装构建系统的缺失部分,并且在为Windows/MinGW或Android构建时下载必要的工具链。

cd cerbero
./cerbero-uninstalled bootstrap

编译gstreamer

checkout比较新的tag编译,cerbero需要python>=3.6

git checkout 1.19.3
./cerbero-uninstalled package gstreamer-1.0

Build tools install prefix will be /home/hui/disk4t/codes/gstplayer/gstreamer/gstreamer-cerbero/build/build-tools
Install prefix will be /home/hui/disk4t/codes/gstplayer/gstreamer/gstreamer-cerbero/build/dist/linux_x86_64

Building the following recipes: libffi zlib glib bash-completion libunwind gobject-introspection gstreamer-1.0 libogg libpng pixman expat bzip2 freetype fontconfig cairo fribidi harfbuzz pango libvorbis libtheora orc opus graphene libjpeg-turbo cdparanoia gst-plugins-base-1.0 gst-shell speex tiff gdk-pixbuf libxml2 glib-networking libpsl sqlite3 libsoup mpg123 lame wavpack flac taglib libvpx libdv gst-plugins-good-1.0 libass libkate openh264 librtmp libsrtp libdca libdvdread libdvdnav libnice soundtouch vo-aacenc libcroco librsvg openjpeg spandsp webrtc-audio-processing sbc ladspa srt zbar gst-plugins-bad-1.0 a52dec opencore-amr x264 gst-plugins-ugly-1.0 json-glib gst-rtsp-server-1.0 ffmpeg gst-libav-1.0 gst-devtools-1.0 gst-editing-services-1.0

交叉编译an

# Bootstrap for Android Universal on Linux
$ ./cerbero-uninstalled -c config/cross-android-universal.cbc bootstrap

# Build everything and package for Android Universal
$ ./cerbero-uninstalled -c config/cross-android-universal.cbc package gstreamer-1.0

编译完成后生成gstreamer-1.0-android-universal-1.19.3.tar.xz,和上面下载的一样。

启用可选功能

list-variants可以列出支持的选项

$ ./cerbero-uninstalled --list-variants 

Available boolean variants are: alsa, cdparanoia, debug, gi, intelmsdk, optimization, pulse, python, qt5, rpi, testspackage, unwind, uwp, v4l2, vaapi, visualstudio, werror, x11
Available mapping variants are: vscrt

指定variantname

/cerbero-uninstalled -v variantname [-c ...] package gstreamer-1.0

使用编译后的环境

配置环境变量

$ export GST_PLUGIN_PATH=/home/hui/data/gstreamer-cerbero/build/dist/linux_x86_64/lib
$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/hui/data/gstreamer-cerbero/build/dist/linux_x86_64/lib
$ export GST_PLUGIN_SCANNER=/home/hui/data/gstreamer-cerbero/build/dist/linux_x86_64/libexec/gstreamer-1.0

配置环境变量后,执行gst-launch或者gst-inspect就可以注册GST_PLUGIN_PATH目录下的插件

$ cd build/dist/linux_x86_64/bin
$ GST_DEBUG=GST_REGISTRY:5 ./gst-inspect-1.0 avdec_h264

从log中可以方便的找到registry文件

GST_REGISTRY gstregistry.c:1755:ensure_current_registry: reading registry cache: /home/hui/.cache/gstreamer-1.0/registry.x86_64.bin

播放文件

./gst-launch-1.0 playbin uri=file:///home/hui/media/
  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值