Skip to content

Instantly share code, notes, and snippets.

@moritzvieli
Forked from Swap-File/gstreamer-build.sh
Last active October 23, 2022 07:50
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save moritzvieli/417de950209a24a4f7a57ce1bb5bfeb7 to your computer and use it in GitHub Desktop.
Save moritzvieli/417de950209a24a4f7a57ce1bb5bfeb7 to your computer and use it in GitHub Desktop.
#!/bin/bash
export MAKEFLAGS="-j 3"
set -e
VERSION="1.16.0"
LIBNICE_VERSION="0.1.16" # libnice (v>=0.1.14) needed for webrtcbin
LIBSRTP_VERSION="2.2.0" # libsrtp (v>=2.2.0) required for srtp plugin
WEBRTCAUDIO_VERSION="0.3.1" # webrtc-audio-processing required for webrtcdsp
[ -n "$1" ] && VERSION=$1
# Create a log file of the build as well as displaying the build on the tty as it runs
exec > >(tee build_gstreamer.log)
exec 2>&1
# Update and Upgrade the Pi, otherwise the build may fail due to inconsistencies
sudo apt-get update
sudo apt-get upgrade -y --force-yes
# Remove old versions of dependencies; these will be build
sudo apt-get remove -y libnice-dev libsrtp2-dev
# Get the required libraries without X server
sudo apt-get install -y build-essential autotools-dev automake autoconf checkinstall \
libtool autopoint libxml2-dev zlib1g-dev libglib2.0-dev \
pkg-config bison flex python3 wget tar gtk-doc-tools libasound2-dev \
libgudev-1.0-dev libvorbis-dev libcdparanoia-dev \
libtheora-dev libvisual-0.4-dev iso-codes \
libraw1394-dev libiec61883-dev libavc1394-dev \
libv4l-dev libcaca-dev libspeex-dev libpng-dev \
libshout3-dev libjpeg-dev libflac-dev libdv4-dev \
libtag1-dev libwavpack-dev libsoup2.4-dev libbz2-dev \
libcdaudio-dev libdc1394-22-dev ladspa-sdk libass-dev \
libcurl4-gnutls-dev libdca-dev libdvdnav-dev \
libexempi-dev libexif-dev libfaad-dev libgme-dev libgsm1-dev \
libiptcdata0-dev libkate-dev libmimic-dev libmms-dev \
libmodplug-dev libmpcdec-dev libofa0-dev libopus-dev \
librtmp-dev libschroedinger-dev libslv2-dev \
libsndfile1-dev libsoundtouch-dev libspandsp-dev \
libxvidcore-dev libzvbi-dev liba52-0.7.4-dev \
libcdio-dev libdvdread-dev libmad0-dev libmp3lame-dev \
libmpeg2-4-dev libopencore-amrnb-dev libopencore-amrwb-dev \
libsidplay1-dev libtwolame-dev libx264-dev libusb-1.0 \
python-gi-dev yasm python3-dev libgirepository1.0-dev \
freeglut3 libgles2-mesa-dev libgl1-mesa-dri \
weston wayland-protocols pulseaudio libpulse-dev libssl-dev
# gstreamer
PACKAGE=gstreamer
wget https://gstreamer.freedesktop.org/src/$PACKAGE/$PACKAGE-$VERSION.tar.xz
tar xvf $PACKAGE-$VERSION.tar.xz
cd $PACKAGE-$VERSION
./configure --prefix=/usr --disable-gtk-doc
make
echo $PACKAGE > description-pak
sudo checkinstall -y --fstrans=no
sudo ldconfig
cd ..
# gst-plugins-base
PACKAGE=gst-plugins-base
wget https://gstreamer.freedesktop.org/src/$PACKAGE/$PACKAGE-$VERSION.tar.xz
tar xvf $PACKAGE-$VERSION.tar.xz
cd $PACKAGE-$VERSION
# compiled with GLES without X
export LDFLAGS='-L/opt/vc/lib' \
CFLAGS='-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux/' \
CPPFLAGS='-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux/'
./configure --prefix=/usr \
--disable-gtk-doc --disable-examples \
--disable-opengl --enable-gles2 --enable-egl --disable-glx \
--disable-x11 --enable-wayland --enable-dispmanx \
--with-gles2-module-name=/opt/vc/lib/libbrcmGLESv2.so \
--with-egl-module-name=/opt/vc/lib/libbrcmEGL.so
make
echo $PACKAGE > description-pak
sudo checkinstall -y --fstrans=no
sudo ldconfig
cd ..
# gst-plugins-good
PACKAGE=gst-plugins-good
wget https://gstreamer.freedesktop.org/src/$PACKAGE/$PACKAGE-$VERSION.tar.xz
tar xvf $PACKAGE-$VERSION.tar.xz
cd $PACKAGE-$VERSION
./configure --prefix=/usr --disable-gtk-doc
make
echo $PACKAGE > description-pak
sudo checkinstall -y --fstrans=no
sudo ldconfig
cd ..
# gst-plugins-ugly
PACKAGE=gst-plugins-ugly
wget https://gstreamer.freedesktop.org/src/$PACKAGE/$PACKAGE-$VERSION.tar.xz
tar xvf $PACKAGE-$VERSION.tar.xz
cd $PACKAGE-$VERSION
./configure --prefix=/usr --disable-gtk-doc
make
echo $PACKAGE > description-pak
sudo checkinstall -y --fstrans=no
sudo ldconfig
cd ..
# gst-libav
PACKAGE=gst-libav
wget https://gstreamer.freedesktop.org/src/$PACKAGE/$PACKAGE-$VERSION.tar.xz
tar xvf $PACKAGE-$VERSION.tar.xz
cd $PACKAGE-$VERSION
./configure --prefix=/usr --disable-gtk-doc
make
echo $PACKAGE > description-pak
sudo checkinstall -y --fstrans=no
sudo ldconfig
cd ..
# libnice
PACKAGE=libnice
wget https://nice.freedesktop.org/releases/$PACKAGE-$LIBNICE_VERSION.tar.gz
tar xvf $PACKAGE-$LIBNICE_VERSION.tar.gz
cd $PACKAGE-$LIBNICE_VERSION
./configure --prefix=/usr
make
echo $PACKAGE > description-pak
sudo checkinstall -y --fstrans=no
sudo ldconfig
cd ..
# libsrtp
PACKAGE=libsrtp
wget https://github.com/cisco/$PACKAGE/archive/v$LIBSRTP_VERSION.tar.gz
tar xzf v$LIBSRTP_VERSION.tar.gz
cd $PACKAGE-$LIBSRTP_VERSION
./configure --prefix=/usr
make
echo $PACKAGE > description-pak
sudo checkinstall -y --fstrans=no
sudo ldconfig
cd ..
# webrtc audio processing
PACKAGE=webrtc-audio-processing
wget http://freedesktop.org/software/pulseaudio/$PACKAGE/$PACKAGE-$WEBRTCAUDIO_VERSION.tar.xz
tar xvf $PACKAGE-$WEBRTCAUDIO_VERSION.tar.xz
cd $PACKAGE-$WEBRTCAUDIO_VERSION
./configure --prefix=/usr
make
echo $PACKAGE > description-pak
sudo checkinstall -y --fstrans=no
sudo ldconfig
cd ..
# gst-plugins-bad
PACKAGE=gst-plugins-bad
wget https://gstreamer.freedesktop.org/src/$PACKAGE/$PACKAGE-$VERSION.tar.xz
tar xvf $PACKAGE-$VERSION.tar.xz
cd $PACKAGE-$VERSION
./configure --prefix=/usr --disable-gtk-doc --disable-examples
make
echo $PACKAGE > description-pak
sudo checkinstall -y --fstrans=no
sudo ldconfig
cd ..
# python bindings
PACKAGE=gst-python
wget https://gstreamer.freedesktop.org/src/$PACKAGE/$PACKAGE-$VERSION.tar.xz
tar xvf $PACKAGE-$VERSION.tar.xz
cd $PACKAGE-$VERSION
PYTHON=/usr/bin/python3 ./configure --prefix=/usr
make
echo $PACKAGE > description-pak
sudo checkinstall -y --fstrans=no
sudo ldconfig
cd ..
# omx support
PACKAGE=gst-omx
wget https://gstreamer.freedesktop.org/src/$PACKAGE/$PACKAGE-$VERSION.tar.xz
tar xvf $PACKAGE-$VERSION.tar.xz
cd $PACKAGE-$VERSION
export LDFLAGS='-L/opt/vc/lib' \
CFLAGS='-I/opt/vc/include -I/opt/vc/include/IL -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/IL' \
CPPFLAGS='-I/opt/vc/include -I/opt/vc/include/IL -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/IL'
./configure --prefix=/usr --disable-gtk-doc --with-omx-target=rpi --disable-examples
make
echo $PACKAGE > description-pak
sudo checkinstall -y --fstrans=no
sudo ldconfig
cd ..
# Gstreamer RTSP Server
PACKAGE=gst-rtsp-server
wget https://gstreamer.freedesktop.org/src/$PACKAGE/$PACKAGE-$VERSION.tar.xz
tar xvf $PACKAGE-$VERSION.tar.xz
cd $PACKAGE-$VERSION
./configure --prefix=/usr --disable-gtk-doc
make
echo $PACKAGE > description-pak
sudo checkinstall -y --fstrans=no
sudo ldconfig
cd ..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment