-
-
Save dasl-/a43320008bb3c6359e8665a14f266a30 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Build gstreamer for Raspberry Pi | |
# Edit the SRC and DEST environment variables at the top and then | |
# run this script. You'll need to add the following two envronment | |
# variables to your .profile | |
# | |
# LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${PREFIX}/lib" | |
# PATH="${PATH}:${PREFIX}/bin" | |
# | |
# Then logout and log back in again. | |
# | |
# Author: David Thorpe <[email protected]> | |
# updates by: https://github.com/dasl- | |
# Install parameters | |
SRC="${HOME}/gstreamer" | |
DEST="/opt" | |
PREFIX="${DEST}/gstreamer" | |
VC="/opt/vc/lib/pkgconfig" | |
# Preamble | |
echo GStreamer installation: | |
echo | |
echo " SRC=${SRC}" | |
echo " PREFIX=${PREFIX}" | |
echo | |
# Create build folder | |
if [ ! -d "${SRC}" ]; then | |
install -d "${SRC}" || exit 1 | |
fi | |
# Munge pkgconfig | |
cd "${VC}" || exit 1 | |
if [ ! -f "${VC}/egl.pc" ]; then | |
sudo ln -s brcmegl.pc egl.pc | |
fi | |
if [ ! -f "${VC}/glesv2.pc" ]; then | |
sudo ln -s brcmglesv2.pc glesv2.pc | |
fi | |
# Create destination folders | |
if [ ! -w "${DEST}" ]; then | |
sudo chgrp users "${DEST}" | |
sudo chmod g+w "${DEST}" | |
fi | |
if [ ! -d "${PREFIX}" ]; then | |
install -d "${PREFIX}" || exit 1 | |
fi | |
# Install dependencies | |
sudo apt update | |
sudo apt -y -q install \ | |
meson libglib2.0-dev flex bison \ | |
libvorbis-dev libtheora-dev libflac-dev libdv4-dev \ | |
libwavpack-dev libopus-dev liba52-0.7.4-dev \ | |
libmp3lame-dev libmpeg2-4-dev libx264-dev libx265-dev \ | |
libsoup2.4-dev libgles2-mesa-dev libcairo2-dev git | |
# Get gst-build repo | |
cd "${SRC}" || exit 1 | |
[ ! -d gst-build ] && git clone git://anongit.freedesktop.org/git/gstreamer/gst-build | |
# Configure and build | |
cd "${SRC}/gst-build" || exit 1 | |
PKG_CONFIG_PATH="${VC}" meson --prefix="${PREFIX}" build \ | |
-D gst-plugins-base:gl_api=gles2 \ | |
-D gst-plugins-base:gl_platform=egl \ | |
-D gst-plugins-base:gl_winsys=dispmanx \ | |
-D gst-plugins-base:gles2_module_name=/opt/vc/lib/libbrcmGLESv2.so \ | |
-D gst-plugins-base:egl_module_name=/opt/vc/lib/libbrcmEGL.so \ | |
-D gst-plugins-bad:bluez=disabled -D gst-plugins-bad:opencv=disabled -D bad=enabled \ | |
-D omx=enabled -D gst-omx:header_path=/opt/vc/include/IL -D gst-omx:target=rpi \ | |
-D python=disabled -D introspection=disabled -D examples=disabled || exit 1 | |
ninja -C build install || exit 1 | |
# End with success | |
echo | |
echo Add the following lines to your .profile file: | |
echo | |
echo " LD_LIBRARY_PATH=\"\${LD_LIBRARY_PATH}:/opt/gstreamer/lib/arm-linux-gnueabihf\"" | |
echo " PATH=\"\${PATH}:${PREFIX}/bin\"" | |
echo | |
echo ...then logout and log back in again. | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
takes about 45 minutes to run on raspberry pi 4