Skip to content

Instantly share code, notes, and snippets.

@J-Rojas
Created March 2, 2021 21:27
Show Gist options
  • Save J-Rojas/95cf4f71afe023e18c7c50bfb44b15e7 to your computer and use it in GitHub Desktop.
Save J-Rojas/95cf4f71afe023e18c7c50bfb44b15e7 to your computer and use it in GitHub Desktop.
Gstreamer build on Nvidia jetson platform
#!/bin/bash
cwd="$(realpath $( cd "$(dirname "$0")" ; pwd -P )/.. )"
cd $cwd
function usage() {
echo "usage: [PATH FOR BUILD FOLDER] [GSTREAMER VERSION] [INSTALLATION_PATH] [PATH TO NVIDIA LIBRARIES]"
}
if [ "$#" -ne 4 ]; then
usage
exit -1
fi
MESON=$(which meson)
if [ -z "$MESON" ]; then
echo "meson not found in path, please install via these instructions:"
echo "pip3 install --user meson"
exit -1
fi
NINJA=$(which ninja)
if [ -z "$NINJA" ]; then
echo "ninja not found in path, please install via these instructions: https://github.com/GStreamer/gst-build"
echo "for ubuntu, use the following"
echo "sudo apt install ninja-build"
exit -1
fi
PATH_TO_BUILD=$1
VERSION=$2
INSTALLATION_PATH=$3
NVIDIA_LIBS=$4
mkdir -p $PATH_TO_BUILD
git clone [email protected]:GStreamer/gst-build.git $PATH_TO_BUILD
pushd $PATH_TO_BUILD
git checkout $VERSION
meson --reconfigure --prefix=$INSTALLATION_PATH ./build-$VERSION/ -Dgst-plugins-bad:nvcodec=enabled
ninja -C build-$VERSION
sudo $MESON install -C ./build-$VERSION/
# copy nvidia libraries
sudo cp $NVIDIA_LIBS/libgstnv* $INSTALLATION_PATH/lib/aarch64-linux-gnu/
sudo cp $NVIDIA_LIBS/libgstomx.so $INSTALLATION_PATH/lib/aarch64-linux-gnu/
echo "To use the custom installation of gstreamer, set the following in your environment:"
echo "LD_LIBRARY_PATH=$INSTALLATION_PATH/lib/aarch64-linux-gnu:\$LD_LIBRARY_PATH"
echo "PATH=$INSTALLATION_PATH/bin:\$PATH"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment