GStreamer In-Band Metadata for MPEG Transport Stream - Getting Started - Building the project

From RidgeRun Developer Connection
Jump to: navigation, search


Previous: Getting Started/Getting the code Index Next: User Guide





Overview

This page provides a guide to install GstMetadata.

This plugin requires some patches on the GStreamer's standard plugins to properly handle the metadata. There are 2 possible scenarios for the installation:

  • On GStreamer version installed in your system
  • On custom GStreamer environment

For both cases, a custom GStreamer environment is needed to install the patches. Follow the instructions on the Dependencies and Prerequisites sections to install the patches on the custom environment.

Dependencies

GstMetaData has the following dependencies:

  • gtk-doc-tools
  • libgstreamer1.0-dev
  • libgstreamer-plugins-base1.0-dev

Make sure you have the following GStreamer elements:

  • videotestsrc
  • xvimagesink
  • videoconvert
  • tsparse
  • tsdemux
  • mpegtsmux
  • h264parse
  • x264enc
  • avdec_h264

In Ubuntu 16.04 and 18.04 based systems, you may install the dependencies with the following command:

sudo apt-get install -y gtk-doc-tools libgtk2.0-dev libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev libmp3lame-dev

Prerequisites

An easy procedure to install a custom environment is available at Evaluating the project under the section Building the alternative GStreamer environment.

When the custom environment is ready, follow the instructions below to apply the patches. In case you want to use the plugin in the GStreamer version installed in your system, create an alternative environment with the same GStreamer version.

Patches Installation

The first step is setting the required environment variables to place the patches in the correct folder.

DEVDIR=~/Gst-versions
BRANCH="1.16"        #Example version used in the guide
GSTENV=$DEVDIR/$BRANCH
  • Move or clone GstMetadata

Enter the custom GStreamer directory

cd $GSTENV

Clone, copy or move GstMetadata to the custom GStreamer environment, the directory should look as follows

ls $GSTENV

Expected output:

gfallas@gfallas-G5-5587:~/Gst-versions/1.16$ ls $GSTENV
gst-libav  gst-metadata  gst-plugins-bad  gst-plugins-base  gst-plugins-good  gst-plugins-ugly  gstreamer  prefix
  • Patch for GStreamer

Change to custom GStreamer version

cd $GSTENV

Copy and apply patch file

cp gst-metadata/extras/fix-sparse-flag-setting-up.patch gstreamer/
cd gstreamer
git apply fix-sparse-flag-setting-up.patch
  • Patch for GStreamer plugins bad

Change to custom GStreamer version

cd $GSTENV

Copy and apply patches

cp gst-metadata/extras/mpegtsmux-reference-clock-on-waiting-pad.patch gst-plugins-bad/
cp gst-metadata/extras/mpegtsmux-meta-specific-pad-templates.patch gst-plugins-bad/
cd gst-plugins-bad
git apply mpegtsmux-reference-clock-on-waiting-pad.patch
git apply mpegtsmux-meta-specific-pad-templates.patch
  • Recompile plugins

Return to DEVDIR and enter the custom Gstreamer environment

cd $DEVDIR
./gst-$BRANCH

Recompile plugins

for module in `echo gstreamer gst-plugins-base gst-plugins-good gst-plugins-bad gst-plugins-ugly gst-libav`; do
    cd $module
    ./autogen.sh --disable-gtk-doc --disable-tests --disable-nls && make -j8
    cd -
done

At this point, the patches are applied in the custom environment

Compile and Install plugin

In Custom GStreamer Environment

Make sure that you are in the custom GStreamer environment.

Create the installation folder for GstMetadata

mkdir -p prefix/lib/gstreamer-1.0

Run the following commands to compile and install the plugin in the custom GStreamer environment.

cd gst-metadata/src
./autogen.sh
./configure --prefix $(realpath ../../prefix/)
make all
make install

Let's include the prefix path into the GST_PLUGIN_PATH environmental variable to load the meta plugin.

In case that after loading the custom GStreamer environment the meta plugin is not present, load the prefix path into the GST_PLUGIN_PATH environmental variable, in this guide $(realpath ../../prefix/) represents /home/gfallas/Gst-versions/1.8/prefix

export GST_PLUGIN_PATH=$(realpath ../../prefix/):$GST_PLUGIN_PATH

Now, GstMetadata is installed in the custom GStreamer environment.

In GStreamer's Default Path

This section is in case of installing the plugin into a GStreamer's default path on the system, use the arguments below according to the target platform

The configuration stage depend on the target system, use table below as reference:

System Configure Option
Ubuntu 64 bits --prefix /usr/ --libdir /usr/lib/x86_64-linux-gnu/
RidgeRun's Embedded FS --prefix /usr/
Jetson TX1 TX2 Xavier --prefix /usr/ --libdir /usr/lib/aarch64-linux-gnu/
Table 1. Platform configuration options

Run the next commands to configure and compile the plugin

cd gst-plugin-meta-1.0/src
./autogen
./configure $OPTIONS # CHOOSE THE APPROPRIATE CONFIGURATION FROM THE TABLE ABOVE
make all
sudo make install

Now, you will need the modified binaries libgstbase-1.0.so, libgstmpegtsmux.so and libgstmpegpsdemux.so from the custom GStreamer environment, this only applies when the GStreamer version and the custom version are the same.

The installation path depends on the target platform:

Platform Path
Ubuntu 64-bits /usr/lib/x86_64-linux-gnu
RidgeRun's Embedded FS -/usr
Jetson TX1 TX2 Xavier /usr/lib/aarch64-linux-gnu
Table 1. GStreamer's default path

Before installing the binaries in the system, it is highly recommended to backup the default files: As example, for an x86_64 installation the GStreamer's path is /usr/lib/x86_64-linux-gnu/

PATH=/usr/lib/x86_64-linux-gnu

sudo cp $PATH/libgstbase-1.0.so $PATH/libgstbase-1.0.so.bk
sudo cp $PATH/libgstbase-1.0.so.0 $PATH/libgstbase-1.0.so.0.bk
sudo cp $PATH/libgstbase-1.0.so.0.1602.0 $PATH/libgstbase-1.0.so.0.1602.0.bk

sudo cp $PATH/gstreamer-1.0/libgstmpegpsdemux.so $PATH/gstreamer-1.0/libgstmpegpsdemux.so.bk
sudo cp $PATH/gstreamer-1.0/libgstmpegtsmux.so $PATH/gstreamer-1.0/libgstmpegtsmux.so.bk

Then, copy the required libraries from the custom GStreamer environment.

cd $GSTENV
sudo cp $GSTENV/gstreamer/libs/gst/base/.libs/libgstbase-1.0.so* $PATH/libgstbase-1.0.so

sudo cp $PATH/gst-plugins-bad/gst/mpegdemux/.libs/libgstmpegpsdemux.so $PATH/gstreamer-1.0/libgstmpegpsdemux.so
sudo cp $PATH/gst-plugins-bad/gst/mpegtsmux/.libs/libgstmpegtsmux.so $PATH/gstreamer-1.0/libgstmpegtsmux.so

Now the binaries andGtsMetadata are installed in the system.

Verify

The plugin installation can be verified by running:

gst-inspect-1.0 meta

Expected output:

Plugin Details:
Name meta
Description Elements used to send and receive metadata
Filename /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstmeta.so
Version 1.6.0
License Proprietary
Source module gst-plugin-meta
Binary package RidgeRun elements
Origin URL http://www.ridgerun.com

metasrc: Metadata Source
metasink: Metadata Sink
misbparser: MISB Parser

3 features:
+-- 3 elements


Previous: Getting Started/Getting the code Index Next: User Guide