gstreamer 源码编译安装
1.首先搭建 Gstreamer 所需环境
(1).先安装Gstreamer所需的程序包:
1 sudo apt-get update
2 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.12.2 基础软件包(适用于其他版本)
(1).下载以下几个软件源码包:(地址:https://gstreamer.freedesktop.org/src/)
1 gstreamer-1.12.2
2 gst-plugins-base-1.12.2
3 gst-plugins-good-1.12.2
4 gst-plugins-bad-1.12.2
5 gst-plugins-ugly-1.12.2
6 gst-rtsp-server-1.12.2
(2).编译安装gstreamer-1.12.2
1 $tar xvJf gstreamer-1.12.2.tar.xz
2 $cd gstreamer-1.12.2
3 $ ./configure
4 $make -j6
5 $sudo make install
(3).编译安装gst-plugins-base-1.12.2
1 $tar xvJf gst-plugins-base-1.12.2.tar.xz
2 $cd gst-plugins-base-1.12.2
3 $ ./configure
4 $make -j6
5 $sudo make install
备注:安装1.14.4版本遇到的问题和解决方案
1 修改 gst-plugins-base/tests/icles/Makefile 中
2 GST_LIBS = -L/usr/local/lib -lgstreamer-1.0 -lgobject-2.0 -lglib-2.0 $(GCOV_LIBS) INCORRECT 为:
3 GST_LIBS = -L/usr/local/lib -lgstreamer-1.0 -lgobject-2.0 -lglib-2.0 -lgstbase-1.0 $(GCOV_LIBS) CORRECT
(4).编译安装gst-plugins-good-1.12.2
1 $tar xvJf gst-plugins-good-1.12.2.tar.xz
2 $cd gst-plugins-good-1.12.2
3 $ ./configure
4 $make -j6
5 $sudo make install
(5).编译安装gst-plugins-bad-1.12.2
1 $tar xvJf gst-plugins-bad-1.12.2.tar.xz
2 $cd gst-plugins-bad-1.12.2
3 $ ./configure
4 $make -j6
5 $sudo make install
(6).编译安装gst-plugins-ugly-1.12.2
1 $sudo apt-get install libx264-dev //支持x264软编码插件
2 $tar xvJf gst-plugins-ugly-1.12.2.tar.xz
3 $cd gst-plugins-ugly-1.12.2
4 $ ./configure
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.12.2(如果需要进行流媒体推流才进行安装)
1 $tar xvJf gst-rtsp-server-1.12.2.tar.xz
2 $cd gst-rtsp-server-1.12.2
3 $ ./configure
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