Difference between revisions of "GStreamer In-Band Metadata for MPEG Transport Stream/Getting Started/Building the project"
Rgutierrez (talk | contribs) m (→Compile and Install plugin) |
Rgutierrez (talk | contribs) (→Compile and Install plugin) |
||
Line 243: | Line 243: | ||
VERSION=1602 | VERSION=1602 | ||
− | sudo cp $MY_PATH/libgstbase-1.0.so.0.$VERSION.0 $ | + | sudo cp $MY_PATH/libgstbase-1.0.so.0.$VERSION.0 $MY_PATH/libgstbase-1.0.so.0.$VERSION.0.bk |
− | sudo cp $MY_PATH/libgstcodecparsers-1.0.so.0.$VERSION.0 $ | + | sudo cp $MY_PATH/libgstcodecparsers-1.0.so.0.$VERSION.0 $MY_PATH/libgstcodecparsers-1.0.so.0.$VERSION.0.bk |
− | sudo cp $MY_PATH/libgstmpegts-1.0.so.0.$VERSION.0 $ | + | sudo cp $MY_PATH/libgstmpegts-1.0.so.0.$VERSION.0 $MY_PATH/libgstmpegts-1.0.so.0.$VERSION.0.bk |
− | sudo cp $MY_PATH/gstreamer-1.0/libgstmpegpsdemux.so $ | + | sudo cp $MY_PATH/gstreamer-1.0/libgstmpegpsdemux.so $MY_PATH/gstreamer-1.0/libgstmpegpsdemux.so.bk |
− | sudo cp $MY_PATH/gstreamer-1.0/libgstmpegtsmux.so $ | + | sudo cp $MY_PATH/gstreamer-1.0/libgstmpegtsmux.so $MY_PATH/gstreamer-1.0/libgstmpegtsmux.so.bk |
− | sudo cp $MY_PATH/gstreamer-1.0/libgstmpegtsdemux.so $ | + | sudo cp $MY_PATH/gstreamer-1.0/libgstmpegtsdemux.so $MY_PATH/gstreamer-1.0/libgstmpegtsdemux.so.bk |
</syntaxhighlight> | </syntaxhighlight> |
Revision as of 12:25, 8 March 2021
GStreamer In-Band Metadata for MPEG Transport Stream | |
---|---|
![]() | |
MPEG TS Metadata Basics | |
|
|
Getting Started | |
|
|
User Guide | |
|
|
Examples | |
|
|
FAQ | |
Contact Us |
Contents
Overview
This page provides a guide to install GstMetadata.
This plugin requires some patches on the GStreamer 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.
Install purchased gst-metadata source code
The first step is setting the required environment variables to place the code in the correct folder.
DEVDIR=~/Gst-versions
BRANCH="1.16" #Example version used in the guide
GSTENV=$DEVDIR/$BRANCH
Then you can get the gst-metatada source code in place, for this you should clone the repo:
CLIENT_NAME=client # Change this with your client name in the repo
REPO_URL=https://gitlab.com/RidgeRun/orders/$CLIENT_NAME/gst-metadata
cd $GSTENV
git clone $REPO_URL
Patches Installation
Enter the custom GStreamer directory
cd $GSTENV
The directory should look as follows
ls $GSTENV
Expected output:
~/Gst-versions/1.16$ ls $GSTENV
gst-libav gst-metadata gst-plugins-bad gst-plugins-base gst-plugins-good gst-plugins-ugly gstreamer prefix
If gst-metadata is not present here, copy the folder from where you cloned it:
cd $GSTENV
GSTMETADATA_LOCATION=~/gst-metadata/
cp $GSTMETADATA_LOCATION gst-metadata -r
- Patch for GStreamer
Change to custom GStreamer version
cd $GSTENV
NOTE: If you are using a tag in the form 1.y.x for the BRANCH variable, use BRANCH=1.y for copying the patches from the gst-metadata/extras/ folder
Copy and apply patch file
cp gst-metadata/extras/gstreamer-$BRANCH.x/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/gstreamer-$BRANCH.x/mpegtsmux-reference-clock-on-waiting-pad.patch gst-plugins-bad/
cp gst-metadata/extras/gstreamer-$BRANCH.x/mpegtsmux-meta-specific-pad-templates.patch gst-plugins-bad/
cp gst-metadata/extras/gstreamer-$BRANCH.x/tsmux-demux-update-klv-support.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
git apply tsmux-demux-update-klv-support.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/ |
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 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 |
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/
MY_PATH=/usr/lib/x86_64-linux-gnu
VERSION=1602
sudo cp $MY_PATH/libgstbase-1.0.so.0.$VERSION.0 $MY_PATH/libgstbase-1.0.so.0.$VERSION.0.bk
sudo cp $MY_PATH/libgstcodecparsers-1.0.so.0.$VERSION.0 $MY_PATH/libgstcodecparsers-1.0.so.0.$VERSION.0.bk
sudo cp $MY_PATH/libgstmpegts-1.0.so.0.$VERSION.0 $MY_PATH/libgstmpegts-1.0.so.0.$VERSION.0.bk
sudo cp $MY_PATH/gstreamer-1.0/libgstmpegpsdemux.so $MY_PATH/gstreamer-1.0/libgstmpegpsdemux.so.bk
sudo cp $MY_PATH/gstreamer-1.0/libgstmpegtsmux.so $MY_PATH/gstreamer-1.0/libgstmpegtsmux.so.bk
sudo cp $MY_PATH/gstreamer-1.0/libgstmpegtsdemux.so $MY_PATH/gstreamer-1.0/libgstmpegtsdemux.so.bk
Then, copy the required libraries from the custom GStreamer environment. Remember to check the path according to the platform and the gstmetadata library location inside the prefix folder according to the tables above to copy it properly.
MY_PATH=/usr/lib/x86_64-linux-gnu
VERSION=1602
cd $GSTENV
sudo cp $GSTENV/prefix/lib/gstreamer-1.0/libgstmeta.so $MY_PATH/gstreamer-1.0/libgstmeta.so
sudo cp $GSTENV/gstreamer/libs/gst/base/.libs/libgstbase-1.0.so.0.$VERSION.0 $MY_PATH/libgstbase-1.0.so.0.$VERSION.0
sudo cp $GSTENV/gst-plugins-bad/gst-libs/gst/codecparsers/.libs/libgstcodecparsers-1.0.so.0.$VERSION.0 $MY_PATH/libgstcodecparsers-1.0.so.0.$VERSION.0
sudo cp $GSTENV/gst-plugins-bad/gst-libs/gst/mpegts/.libs/libgstmpegts-1.0.so.0.$VERSION.0 $MY_PATH/libgstmpegts-1.0.so.0.$VERSION.0
sudo cp $GSTENV/gst-plugins-bad/gst/mpegdemux/.libs/libgstmpegpsdemux.so $MY_PATH/gstreamer-1.0/libgstmpegpsdemux.so
sudo cp $GSTENV/gst-plugins-bad/gst/mpegtsmux/.libs/libgstmpegtsmux.so $MY_PATH/gstreamer-1.0/libgstmpegtsmux.so
sudo cp $GSTENV/gst-plugins-bad/gst/mpegtsdemux/.libs/libgstmpegtsdemux.so $MY_PATH/gstreamer-1.0/libgstmpegtsdemux.so
Now the binaries and GtsMetadata 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