gstreamer 编译实例
Posted grandblogs
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了gstreamer 编译实例相关的知识,希望对你有一定的参考价值。
1.首先搭建 Gstreamer 所需环境
(1).先安装Gstreamer所需的程序包:
1 sudo apt-get update
// 安装之前最好检查下面的tools是否已经安装,例如输入:autoconf -v;如果提示未发现该命令请安装。
2 sudo apt-get install automake autoconf libtool autopoint
3 sudo apt-get install -y bison flex libffi-dev libmount-dev libpcre3 libpcre3-dev zlib1g-dev libssl-dev gtk-doc-tools
(2).安装 ORC 支持库,编译 gst-plugins-base 将会依赖这个库
下载安装包地址:
运行以下命令进行解压缩和编译安装:
1 $tar xvJf orc-0.4.27.tar.xz
2 $cd orc-0.4.27
3 $./autogen.sh --prefix=/usr/lib
4 $make -j6
5 $sudo make install
(3).安装 GLIB 支持库
下载安装包地址:
运行以下命令进行解压缩和编译安装:
1 $tar xvJf glib-2.52.3.tar.xz
2 $cd glib-2.52.3
3 $./autogen.sh
4 $make -j6
5 $sudo make install
2.安装 Gstreamer 1.16.2 基础软件包(适用于其他版本)
(1).下载以下几个软件源码包:(地址:https://gstreamer.freedesktop.org/src/)
1 gstreamer-1.16.2
2 gst-plugins-base-1.16.2
3 gst-plugins-good-1.16.2
4 gst-plugins-bad-1.16.2
5 gst-plugins-ugly-1.16.2
6 gst-rtsp-server-1.16.2
(2).编译安装gstreamer-1.16.2
说明:下面的 ... 是自己真实路径(建议最好使用绝对路径)
1 $tar xvJf gstreamer-1.16.2.tar.xz
2 $cd gstreamer-1.16.2
3 $ ./configure --prefix=.../gst-out/gstreamer-1.16.2
4 $make -j6
5 $sudo make install
说明因为后面的gst-plugins-*都会依赖这个gstreamer-1.16.2因此必须加到PKG_CONFIG_PATH中。
export PKG_CONFIG_PATH=.../gst-out/gstreamer-1.16.2/lib/pkgconfig
(3).编译安装gst-plugins-base-1.16.2
1 $tar xvJf gst-plugins-base-1.16.2.tar.xz
2 $cd gst-plugins-base-1.16.2
3 $ ./configure --prefix=.../gst-out/gst-plugins-base-1.16.2
4 $make -j6
5 $sudo make install
(4).编译安装gst-plugins-good-1.16.2
说明:gst-plugins-good-1.16.2是依赖于gst-plugins-base-1.16.2和gstreamer-1.16.2的,因此需要设置PKG_CONFIG_PATH(之前已经包含gstreamer-1.16.2)为如下值:
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:.../gst-out/gst-plugins-base-1.16.2/lib/pkgconfig
1 $tar xvJf gst-plugins-good-1.16.2.tar.xz
2 $cd gst-plugins-good-1.16.2
3 $ ./configure --prefix=.../gst-out/gst-plugins-good-1.16.2
4 $make -j6
5 $sudo make install
(5).编译安装gst-plugins-bad-1.16.2
1 $tar xvJf gst-plugins-bad-1.16.2.tar.xz
2 $cd gst-plugins-bad-1.16.2
3 $ ./configure --prefix=.../gst-out/gst-plugins-bad-1.16.2
4 $make -j6
5 $sudo make install
(6).编译安装gst-plugins-ugly-1.16.2
1 $sudo apt-get install libx264-dev //支持x264软编码插件
2 $tar xvJf gst-plugins-ugly-1.12.6.tar.xz
3 $cd gst-plugins-ugly-1.16.2
4 $ ./configure --prefix=.../gst-out/gst-plugins-ugly-1.16.2
5 $make -j6
6 $sudo make install
(7).配置Gstreamer环境
1 $cd ~ 2 $sudo vim .bashrc(在文件最后新增以下内容保存退出) 3 export LD_LIBRARY_PATH=/usr/local/lib 4 export GST_PLUGIN_PATH=/usr/local/lib:/usr/lib/aarch64-linux-gnu/gstreamer-1.0 //此处需要根据实际的环境,不一定为aarch64-linux-gnu
5 $source .bashrc
(8).编译安装gst-rtsp-server-1.16.2(如果需要进行流媒体推流才进行安装)
1 $tar xvJf gst-rtsp-server-1.16.2.tar.xz
2 $cd gst-rtsp-server-1.16.2
3 $ ./configure --prefix=.../gst-out/gst-rtsp-server-1.16.2
4 $make -j6
5 $sudo make install
测试指令:软编码加推流
gst-launch-1.0 videotestsrc! videoconvert ! ‘video/x-raw,width=320,height=240,framerate=(fraction)15‘ ! autovideoconvert ! x264enc ! rtph264pay ! udpsink host=192.168.1.94 port=8006
引用风中旅客的博客(做部分补充):https://www.cnblogs.com/sxgloverr1314/p/10541491.html
以上是关于gstreamer 编译实例的主要内容,如果未能解决你的问题,请参考以下文章
gstreamer移植qnx:交叉编译gstreamer之 libgstreamer