Skip to content

Instantly share code, notes, and snippets.

@Brainiarc7
Last active June 23, 2021 23:46
Show Gist options
  • Star 17 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save Brainiarc7/9f9b3de1246c0316f2a273c80841cadc to your computer and use it in GitHub Desktop.
Save Brainiarc7/9f9b3de1246c0316f2a273c80841cadc to your computer and use it in GitHub Desktop.
Guide: How to build gstreamer from source on Ubuntu 16.04 for loading via the modules system

Build gstreamer from source (git checkouts):

Install build dependencies:

sudo apt-get install gtk-doc-tools liborc-0.4-0 liborc-0.4-dev libvorbis-dev libcdparanoia-dev libcdparanoia0 cdparanoia libvisual-0.4-0 libvisual-0.4-dev libvisual-0.4-plugins libvisual-projectm vorbis-tools vorbisgain libopus-dev libopus-doc libopus0 libopusfile-dev libopusfile0 libtheora-bin libtheora-dev libtheora-doc libvpx-dev libvpx-doc libvpx3 libqt5gstreamer-1.0-0 libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libflac++-dev libavc1394-dev libraw1394-dev libraw1394-tools libraw1394-doc libraw1394-tools libtag1-dev libtagc0-dev libwavpack-dev wavpack

Extras:

sudo apt-get install libfontconfig1-dev libfreetype6-dev libx11-dev libxext-dev libxfixes-dev libxi-dev libxrender-dev libxcb1-dev libx11-xcb-dev libxcb-glx0-dev

Additionally, if you do not configure with -qt-xcb (for QT only with gstreamer), you should also install these development packages:

sudo apt-get install libxcb-keysyms1-dev libxcb-image0-dev libxcb-shm0-dev libxcb-icccm4-dev libxcb-sync0-dev libxcb-xfixes0-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-render-util0-dev

Some of these packages depend on others in this list, so installing one may cause others to be automatically installed. Other distributions may provide system packages with similar names.

Basic Qt dependencies:

sudo apt-get install libfontconfig1-dev libdbus-1-dev libfreetype6-dev libudev-dev

Dependencies for multimedia:

sudo apt-get install libasound2-dev libavcodec-dev libavformat-dev libswscale-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev gstreamer-tools gstreamer0.10-plugins-good gstreamer0.10-plugins-bad

QtWebKit dependencies:

sudo apt-get install libicu-dev libsqlite3-dev libxslt1-dev libssl-dev

Navigate to the source directory needed for the build:

Check out the sources, one by one:

git clone git://anongit.freedesktop.org/git/gstreamer/gstreamer
git clone git://anongit.freedesktop.org/git/gstreamer/gst-plugins-base
git clone git://anongit.freedesktop.org/git/gstreamer/gst-plugins-good
git clone git://anongit.freedesktop.org/git/gstreamer/gst-plugins-bad
git clone git://anongit.freedesktop.org/git/gstreamer/gst-plugins-ugly
git clone git://anongit.freedesktop.org/git/gstreamer/gst-libav
git clone git://anongit.freedesktop.org/git/gstreamer/gst-python
git clone https://cgit.freedesktop.org/gstreamer/gstreamer-vaapi

Prepare the target directories where the binaries will reside:

sudo mkdir -p /apps/gstreamer/git
sudo mkdir -p /apps/gst-plugins-base/git
sudo mkdir -p /apps/gst-plugins-good/git
sudo mkdir -p /apps/gst-plugins-bad/git
sudo mkdir -p /apps/gst-plugins-ugly/git
sudo mkdir -p /apps/gst-libav/git
sudo mkdir -p /apps/gst-python/git
sudo mkdir -p /apps/gstreamer-vaapi/git

Write an initial module file for gstreamer, to be expanded on completion when dependencies are built:

#%Module1.0
#####################################################################
##
## gstreamer Modulefile
## by Dennis Mungai on December 30 2016
##
## Locally built package
##
## Target: QT5
##
set appname             gstreamer
set version             git
set prefix              /apps/${appname}/${version}/

set url "https://gstreamer.freedesktop.org/"
set msg "This module adds gstreamer v$version to various paths\n\nGstreamer Official Site: $url\n"

proc ModulesHelp { } {
        puts stderr "$msg"
}

module-whatis   "$msg"

conflict        gstreamer

prepend-path    PATH                         ${prefix}/bin
prepend-path    LD_LIBRARY_PATH              ${prefix}/lib
prepend-path    PKG_CONFIG_PATH              ${prefix}lib/pkgconfig

Now, to build:

Check out all sources above and navigate to each build directory:

cd gstreamer
git pull
./autogen.sh 
./configure --prefix=/apps/gstreamer/git --enable-gtk-doc 
time make -j$(nproc)
sudo make install
cd ..

cd gst-plugins-base
git pull
module load gstreamer/git
./autogen.sh --prefix=/apps/gst-plugins-base/git --enable-gtk-doc --enable-iso-codes --enable-orc
time make -j$(nproc)
sudo make install
cd ..

cd gst-plugins-good
git pull
module load gstreamer/git
./autogen.sh --prefix=/apps/gst-plugins-good/git --enable-gtk-doc --enable-orc
time make -j$(nproc)
sudo make install
cd ..

cd gst-plugins-ugly
git pull
./autogen.sh --prefix=/apps/gst-plugins-ugly/git --enable-gtk-doc --enable-orc
time make -j$(nproc)
sudo make install
cd ..

cd gst-libav
git pull
./autogen.sh --prefix=/apps/gst-libav/git --enable-gtk-doc --enable-orc 
time make -j$(nproc)
sudo make install
cd ..

cd gst-plugins-bad
git pull
./autogen.sh --prefix=/apps/gst-plugins-bad/git --enable-gtk-doc --enable-orc --with-cuda-prefix=/usr/local/cuda
time make -j$(nproc)
sudo make install
cd ..

To build python bindings:

cd gst-python
module load gstreamer/git
git pull
./autogen.sh 
./configure --prefix=/apps/gstreamer/git 
time make -j$(nproc)
sudo make install
cd ..

Create all modules for the installed packages:

For the main gstreamer modulefile:

module show gstreamer/git
-------------------------------------------------------------------
/usr/share/modules/modulefiles/gstreamer/git:

module-whatis	 This module adds gstreamer vgit to various paths

Gstreamer Official Site: https://gstreamer.freedesktop.org/
 
conflict	 gstreamer 
prepend-path	 PATH /apps/gstreamer/git//bin 
prepend-path	 LD_LIBRARY_PATH /apps/gstreamer/git//lib 
prepend-path	 PKG_CONFIG_PATH /apps/gstreamer/git/lib/pkgconfig 
-------------------------------------------------------------------

Content:

#%Module1.0
#####################################################################
##
## gstreamer Modulefile
## by Dennis Mungai on December 30 2016
##
## 
##
## 
##
set appname             gstreamer
set version             git
set prefix              /apps/${appname}/${version}/

set url "https://gstreamer.freedesktop.org/"
set msg "This module adds gstreamer v$version to various paths\n\nGstreamer Official Site: $url\n"

proc ModulesHelp { } {
        puts stderr "$msg"
}

module-whatis   "$msg"

conflict        gstreamer

prepend-path    PATH                         ${prefix}/bin
prepend-path    LD_LIBRARY_PATH              ${prefix}/lib
prepend-path    PKG_CONFIG_PATH              ${prefix}lib/pkgconfig

#No conflict needed, omit it here.

# Make sure gstreamer-plugins-base/git is loaded
# This was compiled against gstreamer-plugins-base/git 
if { ![is-loaded gstreamer-plugins-base/git] } {
    module load gstreamer-plugins-base/git
}

# Make sure gstreamer-plugins-good/git is loaded
# This was compiled against gstreamer-plugins-good/git 
if { ![is-loaded gstreamer-plugins-good/git] } {
    module load gstreamer-plugins-good/git
}

# Make sure gstreamer-plugins-ugly/git is loaded
# This was compiled against gstreamer-plugins-ugly/git 
if { ![is-loaded gstreamer-plugins-ugly/git] } {
    module load gstreamer-plugins-ugly/git
}

# Make sure gstreamer-plugins-ugly/git is loaded
# This requires gstreamer-plugins-ugly/git
if { ![is-loaded gstreamer-plugins-ugly/git] } {
    module load gstreamer-plugins-ugly/git
}

#Make sure gstreamer-libav/git is loaded
#Some plugins require gstreamer-libav/git
if { ![is-loaded gstreamer-libav/git] } {
    module load gstreamer-libav/git
}

gstreamer-plugins-base/git modulefile:

module show gstreamer-plugins-base/git
-------------------------------------------------------------------
/usr/share/modules/modulefiles/gstreamer-plugins-base/git:

module-whatis	 This module adds gstreamer-plugins-base vgit to various paths

Gstreamer Official Site: https://gstreamer.freedesktop.org/
 
prepend-path	 PATH /apps/gst-plugins-base/git//bin 
prepend-path	 LD_LIBRARY_PATH /apps/gst-plugins-base/git//lib 
prepend-path	 PKG_CONFIG_PATH /apps/gst-plugins-base/git/lib/pkgconfig 
-------------------------------------------------------------------

Content:

#%Module1.0
#####################################################################
##
## gstreamer-plugins-base Modulefile
## by Dennis Mungai on December 30 2016
##
set appname             gst-plugins-base
set version             git
set prefix              /apps/${appname}/${version}/

set url "https://gstreamer.freedesktop.org/"
set msg "This module adds gstreamer-plugins-base v$version to various paths\n\nGstreamer Official Site: $url\n"

proc ModulesHelp { } {
        puts stderr "$msg"
}

module-whatis   "$msg"

#Omit plugins

prepend-path    PATH                         ${prefix}/bin
prepend-path    LD_LIBRARY_PATH              ${prefix}/lib
prepend-path    PKG_CONFIG_PATH              ${prefix}lib/pkgconfig

gstreamer-plugins-good/git modulefile:

module show gstreamer-plugins-good/git
-------------------------------------------------------------------
/usr/share/modules/modulefiles/gstreamer-plugins-good/git:

module-whatis	 This module adds gstreamer-plugins-good vgit to various paths

Gstreamer Official Site: https://gstreamer.freedesktop.org/
 
prepend-path	 PATH /apps/gst-plugins-good/git//bin 
prepend-path	 LD_LIBRARY_PATH /apps/gst-plugins-good/git//lib 
prepend-path	 PKG_CONFIG_PATH /apps/gst-plugins-good/git/lib/pkgconfig 
-------------------------------------------------------------------

Module content:

#%Module1.0
#####################################################################
##
## gstreamer-plugins-good Modulefile
## by Dennis Mungai on December 30 2016
##
set appname             gst-plugins-good
set version             git
set prefix              /apps/${appname}/${version}/

set url "https://gstreamer.freedesktop.org/"
set msg "This module adds gstreamer-plugins-good v$version to various paths\n\nGstreamer Official Site: $url\n"

proc ModulesHelp { } {
        puts stderr "$msg"
}

module-whatis   "$msg"

#No conflict needed

prepend-path    PATH                         ${prefix}/bin
prepend-path    LD_LIBRARY_PATH              ${prefix}/lib
prepend-path    PKG_CONFIG_PATH              ${prefix}lib/pkgconfig

gstreamer-plugins-ugly/git module:

module show gstreamer-plugins-ugly/git
-------------------------------------------------------------------
/usr/share/modules/modulefiles/gstreamer-plugins-ugly/git:

module-whatis	 This module adds gstreamer-plugins-ugly vgit to various paths

Gstreamer Official Site: https://gstreamer.freedesktop.org/
 
prepend-path	 PATH /apps/gst-plugins-ugly/git//bin 
prepend-path	 LD_LIBRARY_PATH /apps/gst-plugins-ugly/git//lib 
prepend-path	 PKG_CONFIG_PATH /apps/gst-plugins-ugly/git/lib/pkgconfig 
-------------------------------------------------------------------

Content:

#%Module1.0
#####################################################################
##
## gstreamer-plugins-ugly Modulefile
## by Dennis Mungai on December 30 2016
##
set appname             gst-plugins-ugly
set version             git
set prefix              /apps/${appname}/${version}/

set url "https://gstreamer.freedesktop.org/"
set msg "This module adds gstreamer-plugins-ugly v$version to various paths\n\nGstreamer Official Site: $url\n"

proc ModulesHelp { } {
        puts stderr "$msg"
}

module-whatis   "$msg"

#No conflict needed

prepend-path    PATH                         ${prefix}/bin
prepend-path    LD_LIBRARY_PATH              ${prefix}/lib
prepend-path    PKG_CONFIG_PATH              ${prefix}lib/pkgconfig

gstreamer-libav module:

module show gstreamer-libav/git
-------------------------------------------------------------------
/usr/share/modules/modulefiles/gstreamer-libav/git:

module-whatis	 This module adds gstreamer-plugins-base vgit to various paths

Gstreamer Official Site: https://gstreamer.freedesktop.org/
 
prepend-path	 PATH /apps/gstreamer-libav/git//bin 
prepend-path	 LD_LIBRARY_PATH /apps/gstreamer-libav/git//lib 
prepend-path	 PKG_CONFIG_PATH /apps/gstreamer-libav/git/lib/pkgconfig 
-------------------------------------------------------------------

Module content:

#%Module1.0
#####################################################################
##
## gstreamer-libav Modulefile
## by Dennis Mungai on December 30 2016
##
set appname             gstreamer-libav
set version             git
set prefix              /apps/${appname}/${version}/

set url "https://gstreamer.freedesktop.org/"
set msg "This module adds gstreamer-plugins-base v$version to various paths\n\nGstreamer Official Site: $url\n"

proc ModulesHelp { } {
        puts stderr "$msg"
}

module-whatis   "$msg"

#No conflict

prepend-path    PATH                         ${prefix}/bin
prepend-path    LD_LIBRARY_PATH              ${prefix}/lib
prepend-path    PKG_CONFIG_PATH              ${prefix}lib/pkgconfig

Now, you've successfully deployed gstreamer in a custom location for use.

Next gist: Building QT5 with this version of gstreamer baked in.

@MuhaiminMN
Copy link

this command error sir (not found) :
git clone https://cgit.freedesktop.org/gstreamer/gstreamer-vaapi

@Brainiarc7
Copy link
Author

Hello,

is git in your path?

Run:

type git

And:

which git

To confirm.

@Giribushan
Copy link

Check this out..

sathish@sathish-linux-deep:~/gitRepos/gst-others$ git clone git://anongit.freedesktop.org/gstreamer/gstreamer-vaapi
Cloning into 'gstreamer-vaapi'...
remote: Counting objects: 23858, done.
remote: Compressing objects: 100% (10278/10278), done.
remote: Total 23858 (delta 16583), reused 19516 (delta 13528)
Receiving objects: 100% (23858/23858), 4.53 MiB | 978.00 KiB/s, done.
Resolving deltas: 100% (16583/16583), done.
Checking connectivity... done.
sathish@sathish-linux-deep:~/gitRepos/gst-others$

@phomlish
Copy link

phomlish commented Oct 6, 2018

Why do I need to install gstreamer in order to build gstreamer?

@Brainiarc7
Copy link
Author

@phomlish: Headers for the custom build targeting the module system.

@maxironstark
Copy link

sorry but i ve this error on ubuntu 16.04:
checking for GST... no
configure: No package 'gstreamer-1.0' found
configure: error: no gstreamer-1.0 >= 1.15.0.1 (GStreamer) found
configure failed

i've removed all gstreamer installations

can u help me please?
tnx

@Brainiarc7
Copy link
Author

@maxironstark I'll take a look at this

@usstq
Copy link

usstq commented Mar 26, 2019

There is a shell script in gstreamer which does the same thing, also tells us how to build/debug against uninstalled version:
https://github.com/GStreamer/gstreamer/blob/master/scripts/create-uninstalled-setup.sh

@NoahSchiffman
Copy link

Hi, can I get instructions for this for manjaro gnome?

@Brainiarc7
Copy link
Author

There is a shell script in gstreamer which does the same thing, also tells us how to build/debug against uninstalled version:
https://github.com/GStreamer/gstreamer/blob/master/scripts/create-uninstalled-setup.sh

Excellent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment