gstreamer compiled examples

1. First, set up the required environment Gstreamer

. (1) to install the required packages Gstreamer:

1     sudo apt-get update
      Before installing the best // Check the following tools has been installed, for example, enter: autoconf -v; if the command prompt is not found Please install. 
2
sudo APT-GET install autoconf automake 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). Installation ORC support libraries, compilers gst-plugins-base will depend on the library

  Download the installation package Address:
  Run the following command to decompress and compile and install:
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) Install GLIB support library
 
  Download the installation package Address:
  Run the following command to decompress and compile and install:
 
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. Install Gstreamer 1.16.2 Base Package (applicable to other versions)

(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

 

Guess you like

Origin www.cnblogs.com/grandblogs/p/12123186.html