Difference between revisions of "Setting a GStreamer Alternative Environment"

From RidgeRun Developer Connection
Jump to: navigation, search
m
 
(7 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<seo title="How To Set Up a GStreamer Alternative Environment | RidgeRun" titlemode="replace" keywords="GStreamer, Linux SDK, Linux BSP,  Embedded Linux, Device Drivers, Nvidia, Xilinx, TI, NXP, Freescale, Embedded Linux driver development, Linux Software development, Embedded Linux SDK, Embedded Linux Application development, GStreamer Multimedia Framework." description="Learn how to set up a GStreamer alternative environment by reading this simple guide today. Setting up a GStreamer alternative environment has a variety of advantages."></seo>
+
<seo title="How To Set Up a GStreamer Alternative Environment | RidgeRun" titlemode="replace" metakeywords="GStreamer, Linux SDK, Linux BSP,  Embedded Linux, Device Drivers, Nvidia, Xilinx, TI, NXP, Freescale, Embedded Linux driver development, Linux Software development, Embedded Linux SDK, Embedded Linux Application development, GStreamer Multimedia Framework." metadescription="Learn how to set up a GStreamer alternative environment by reading this simple guide today. Setting up a GStreamer alternative environment has a variety of advantages."></seo>
  
= Overview =
+
<table>
 +
<tr>
 +
<td><div class="clear; float:right">__TOC__</div></td>
 +
<td>
 +
{{NVIDIA Preferred Partner logo}}
 +
<td>
 +
<td>
 +
{{GStreamer debug}}
 +
<td>
 +
<center>
 +
{{ContactUs Button}}
 +
</center>
 +
</tr>
 +
</table>
 +
<br>
 +
== Overview ==
  
This guide describes the steps necessary to setup an alternative GStreamer environment on your machine. There are several reasons you might want to do this:
+
This guide describes the steps necessary to set up an alternative GStreamer environment on your machine. There are several reasons you might want to do this:
 
* Building and using the newest version
 
* Building and using the newest version
 
* Having multiple versions alongside
 
* Having multiple versions alongside
 
* Installing in a non-standard location
 
* Installing in a non-standard location
* Avoiding conflicts with system's default one
+
* Avoiding conflicts with the system's default one
  
= GStreamer below version 1.16 =
+
== Install GStreamer below version 1.16 ==
  
== Dependencies ==
+
=== Dependencies ===
  
 
You'll need the following dependencies:
 
You'll need the following dependencies:
Line 25: Line 40:
 
Additionally, install the packages in [[Setting_a_GStreamer_Alternative_Environment#Optional_Dependencies|Optional Dependencies]] if you wish to enable the construction of plug-ins with external dependencies.
 
Additionally, install the packages in [[Setting_a_GStreamer_Alternative_Environment#Optional_Dependencies|Optional Dependencies]] if you wish to enable the construction of plug-ins with external dependencies.
  
== Building the Environment ==
+
=== Building the Environment ===
  
 
For this example, I'm going to build the latest available version. At this point its 1.16, from a Git perspective "master" will always point to the latest.
 
For this example, I'm going to build the latest available version. At this point its 1.16, from a Git perspective "master" will always point to the latest.
Line 56: Line 71:
 
</pre>
 
</pre>
  
== Using the Environment ==
+
=== Using the Environment ===
  
 
You'll find each version you downloaded as a set of scripts and directories. To switch to the environment run the following:
 
You'll find each version you downloaded as a set of scripts and directories. To switch to the environment run the following:
Line 75: Line 90:
 
In this special environment, all the paths are configured to point to the appropriate plugins.
 
In this special environment, all the paths are configured to point to the appropriate plugins.
  
== Customizing the environment ==
+
=== Customizing the environment ===
  
=== Changing the version ===
+
==== Changing the version ====
  
 
Modify the BRANCH variable in the '''create-uninstalled-setup.sh''' to the desired version. For example:
 
Modify the BRANCH variable in the '''create-uninstalled-setup.sh''' to the desired version. For example:
Line 84: Line 99:
 
* BRANCH=1.4
 
* BRANCH=1.4
  
New version don't require a new area, since they are stored in different directories within the original area
+
New versions don't require a new area, since they are stored in different directories within the original area
  
=== Changing the location of the build ===
+
==== Changing the location of the build ====
  
 
Modify the UNINSTALLED_ROOT variable in the '''create-uninstalled-setup.sh'''. After creating the area, you'll also need to modify the MYGST variable in the '''gst-master''' script (or whatever version you've downloaded)
 
Modify the UNINSTALLED_ROOT variable in the '''create-uninstalled-setup.sh'''. After creating the area, you'll also need to modify the MYGST variable in the '''gst-master''' script (or whatever version you've downloaded)
  
=== Path considerations when using JetPack and Jetson platforms ===
+
==== Path considerations when using JetPack and Jetson platforms ====
  
 
If the environment doesn't recognize your new GStreamer version, it could be for the way that JetPack handles the $PATH and $LD_LIBRARY_PATH libraries. You can solve this issue by modifying the end of the '''~/.bashrc''' file inside your Jetson platform as follows:
 
If the environment doesn't recognize your new GStreamer version, it could be for the way that JetPack handles the $PATH and $LD_LIBRARY_PATH libraries. You can solve this issue by modifying the end of the '''~/.bashrc''' file inside your Jetson platform as follows:
Line 98: Line 113:
 
</pre>
 
</pre>
  
== Optional Dependencies ==
+
=== Optional Dependencies ===
  
 
The following dependencies are optional, and if installed will enable the construction of the associated plug-ins. For example, if '''libx264-dev''' is installed, '''x264enc''' will be built.
 
The following dependencies are optional, and if installed will enable the construction of the associated plug-ins. For example, if '''libx264-dev''' is installed, '''x264enc''' will be built.
Line 109: Line 124:
 
sudo apt install libavc1394-dev libaa1-dev libcaca-dev libcairo2-dev libdv4-dev libflac-dev libgdk-pixbuf2.0-dev libjack-dev libjpeg9-dev libpng-dev libpulse-dev libshout3-dev libsoup2.4-dev libspeex-dev libtaglib-cil-dev libwavpack-dev libx11-dev
 
sudo apt install libavc1394-dev libaa1-dev libcaca-dev libcairo2-dev libdv4-dev libflac-dev libgdk-pixbuf2.0-dev libjack-dev libjpeg9-dev libpng-dev libpulse-dev libshout3-dev libsoup2.4-dev libspeex-dev libtaglib-cil-dev libwavpack-dev libx11-dev
  
 +
</syntaxhighlight>
 +
 +
== GStreamer-1.16 through GStreamer-1.19 non-invasive method - gst-build ==
 +
 +
=== Building the environment ===
 +
 +
'''1.''' Create a directory to download and install all GStreamer packages
 +
 +
{{Ambox
 +
|type=notice
 +
|small=left
 +
|issue= '''Note:''' Set the GST_VERSION according to your needs, supported values are between 1.16-1.19
 +
|style=width:unset;
 +
}}
 +
 +
<pre>
 +
GST_VERSION=1.16
 +
mkdir -p /home/$USER/gst-$GST_VERSION
 +
cd /home/$USER/gst-$GST_VERSION
 +
</pre>
 +
 +
'''2.''' Install dependencies
 +
 +
<pre>
 +
git clone https://github.com/GStreamer/gst-build
 +
cd gst-build
 +
git checkout origin/$GST_VERSION
 +
meson builddir
 +
ninja -C builddir
 +
</pre>
 +
 +
=== Using the environment ===
 +
{{Ambox
 +
|type=notice
 +
|small=left
 +
|issue='''Note:'''Now, this is an awesome way to use a GStreamer version just in your current terminal:
 +
|style=width:unset;
 +
}}
 +
 +
<pre>
 +
cd builddir
 +
ninja devenv
 +
</pre>
 +
 +
To check your version use:
  
</syntaxhighlight>
+
<pre>
 +
gst-launch-1.0 --gst-version
 +
</pre>
 +
 
 +
If you want to leave this environment use the:
 +
 
 +
<pre>
 +
exit
 +
</pre>
 +
 
 +
Every time you need to use this version you have to repeat these steps, and adjust the GST_VERSION (1.16-1.19):
 +
<pre>
 +
GST_VERSION=1.16
 +
cd /home/$USER/gst-$GST_VERSION/gst-build/builddir
 +
ninja devenv
 +
</pre>
 +
 
 +
{{Ambox
 +
|type=notice
 +
|small=left
 +
|issue='''Note:''' Some dependencies needed for certain plugins will not be automatically installed. It is recommended to check the 'REQUIREMENTS' file in the 'gst-plugins' directories for uninstalled optional libraries. These files also specify for which plugin each library is for. Once the preferred optional libraries are installed, run the following commands (from the gst-build/builddir directory) again:
 +
|style=width:unset;
 +
}}
 +
 
 +
<pre>
 +
meson builddir
 +
ninja -C builddir
 +
</pre>
 +
 
 +
{{ContactUs}}
  
 
[[Category:GStreamer]]
 
[[Category:GStreamer]]

Latest revision as of 13:57, 31 July 2023

Nvidia-preferred-partner-badge-rgb-for-screen.png

Error something wrong.jpg Problems running the pipelines shown on this page?
Please see our GStreamer Debugging guide for help.

RR Contact Us.png


Overview

This guide describes the steps necessary to set up an alternative GStreamer environment on your machine. There are several reasons you might want to do this:

  • Building and using the newest version
  • Having multiple versions alongside
  • Installing in a non-standard location
  • Avoiding conflicts with the system's default one

Install GStreamer below version 1.16

Dependencies

You'll need the following dependencies:

sudo apt-get install \
pkg-config bison flex git \
libglib2.0-dev liborc-0.4-dev \
libtool autopoint autoconf \
gettext yasm

Additionally, install the packages in Optional Dependencies if you wish to enable the construction of plug-ins with external dependencies.

Building the Environment

For this example, I'm going to build the latest available version. At this point its 1.16, from a Git perspective "master" will always point to the latest.

#Download and grant execution permissions
wget https://raw.githubusercontent.com/GStreamer/gstreamer/1.16/scripts/create-uninstalled-setup.sh
chmod ug+rx create-uninstalled-setup.sh

#Execute the script. 
#By default, the script downloads the environment to ~/gst
#By default, the script downloads the master branch
./create-uninstalled-setup.sh

#Switch to the new environment
cd ~/gst/
./gst-master

#Build the environment

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
 
#Leave the environment
exit
cd ~/gst/

Using the Environment

You'll find each version you downloaded as a set of scripts and directories. To switch to the environment run the following:

cd ~/gst

#Select your version, this example uses master
./gst-master

#Use the new gstreamer!
gst-launch-1.0 --gst-version

#When finished, exit the session to return to normality 
exit

In this special environment, all the paths are configured to point to the appropriate plugins.

Customizing the environment

Changing the version

Modify the BRANCH variable in the create-uninstalled-setup.sh to the desired version. For example:

  • BRANCH=master
  • BRANCH=1.8
  • BRANCH=1.4

New versions don't require a new area, since they are stored in different directories within the original area

Changing the location of the build

Modify the UNINSTALLED_ROOT variable in the create-uninstalled-setup.sh. After creating the area, you'll also need to modify the MYGST variable in the gst-master script (or whatever version you've downloaded)

Path considerations when using JetPack and Jetson platforms

If the environment doesn't recognize your new GStreamer version, it could be for the way that JetPack handles the $PATH and $LD_LIBRARY_PATH libraries. You can solve this issue by modifying the end of the ~/.bashrc file inside your Jetson platform as follows:

export PATH=$PATH:/usr/local/cuda-9.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-9.0/lib64:

Optional Dependencies

The following dependencies are optional, and if installed will enable the construction of the associated plug-ins. For example, if libx264-dev is installed, x264enc will be built.

# For gst-plugins-base
sudo apt install libasound2-dev libcdparanoia-dev libvorbisidec-dev libvisual-0.4-dev libopus-dev libpango1.0-dev libxv-dev

# For gst-plugins-good
sudo apt install libavc1394-dev libaa1-dev libcaca-dev libcairo2-dev libdv4-dev libflac-dev libgdk-pixbuf2.0-dev libjack-dev libjpeg9-dev libpng-dev libpulse-dev libshout3-dev libsoup2.4-dev libspeex-dev libtaglib-cil-dev libwavpack-dev libx11-dev

GStreamer-1.16 through GStreamer-1.19 non-invasive method - gst-build

Building the environment

1. Create a directory to download and install all GStreamer packages

GST_VERSION=1.16
mkdir -p /home/$USER/gst-$GST_VERSION
cd /home/$USER/gst-$GST_VERSION

2. Install dependencies

git clone https://github.com/GStreamer/gst-build
cd gst-build
git checkout origin/$GST_VERSION
meson builddir
ninja -C builddir

Using the environment

cd builddir
ninja devenv

To check your version use:

gst-launch-1.0 --gst-version

If you want to leave this environment use the:

exit

Every time you need to use this version you have to repeat these steps, and adjust the GST_VERSION (1.16-1.19):

GST_VERSION=1.16
cd /home/$USER/gst-$GST_VERSION/gst-build/builddir
ninja devenv
meson builddir
ninja -C builddir


RidgeRun Resources

Quick Start Client Engagement Process RidgeRun Blog Homepage
Technical and Sales Support RidgeRun Online Store RidgeRun Videos Contact Us

OOjs UI icon message-progressive.svg Contact Us

Visit our Main Website for the RidgeRun Products and Online Store. RidgeRun Engineering informations are available in RidgeRun Professional Services, RidgeRun Subscription Model and Client Engagement Process wiki pages. Please email to support@ridgerun.com for technical questions and contactus@ridgerun.com for other queries. Contact details for sponsoring the RidgeRun GStreamer projects are available in Sponsor Projects page. Ridgerun-logo.svg
RR Contact Us.png