Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Install & build gstreamer from git
#!/bin/bash --debugger
set -e
BRANCH="master"
if grep -q BCM2708 /proc/cpuinfo; then
echo "RPI BUILD!"
RPI="1"
fi
[ -n "$1" ] && BRANCH=$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
grep -q BCM2708 /proc/cpuinfo && sudo apt-get update && sudo apt-get upgrade -y --force-yes
# Get the required libraries
sudo apt-get install -y --force-yes build-essential autotools-dev automake autoconf \
libtool autopoint libxml2-dev zlib1g-dev libglib2.0-dev \
pkg-config bison flex python3 git gtk-doc-tools libasound2-dev \
libgudev-1.0-dev libxt-dev libvorbis-dev libcdparanoia-dev \
libpango1.0-dev libtheora-dev libvisual-0.4-dev iso-codes \
libgtk-3-dev libraw1394-dev libiec61883-dev libavc1394-dev \
libv4l-dev libcairo2-dev libcaca-dev libspeex-dev libpng-dev \
libshout3-dev libjpeg-dev libaa1-dev libflac-dev libdv4-dev \
libtag1-dev libwavpack-dev libpulse-dev libsoup2.4-dev libbz2-dev \
libcdaudio-dev libdc1394-22-dev ladspa-sdk libass-dev \
libcurl4-gnutls-dev libdca-dev libdirac-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 \
librsvg2-dev librtmp-dev libschroedinger-dev libslv2-dev \
libsndfile1-dev libsoundtouch-dev libspandsp-dev libx11-dev \
libxvidcore-dev libzbar-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
# get the repos if they're not already there
cd $HOME
[ ! -d src ] && mkdir src
cd src
[ ! -d gstreamer ] && mkdir gstreamer
cd gstreamer
# get repos if they are not there yet
[ ! -d gstreamer ] && git clone git://anongit.freedesktop.org/git/gstreamer/gstreamer
[ ! -d gst-plugins-base ] && git clone git://anongit.freedesktop.org/git/gstreamer/gst-plugins-base
[ ! -d gst-plugins-good ] && git clone git://anongit.freedesktop.org/git/gstreamer/gst-plugins-good
[ ! -d gst-plugins-bad ] && git clone git://anongit.freedesktop.org/git/gstreamer/gst-plugins-bad
[ ! -d gst-plugins-ugly ] && git clone git://anongit.freedesktop.org/git/gstreamer/gst-plugins-ugly
[ ! -d gst-libav ] && git clone git://anongit.freedesktop.org/git/gstreamer/gst-libav
[ ! -d gst-omx ] && git clone git://anongit.freedesktop.org/git/gstreamer/gst-omx
[ ! -d gst-python ] && git clone git://anongit.freedesktop.org/git/gstreamer/gst-python
[ ! $RPI ] && [ ! -d gstreamer-vaapi ] && git clone git://gitorious.org/vaapi/gstreamer-vaapi.git
export LD_LIBRARY_PATH=/usr/local/lib/
# checkout branch (default=master) and build & install
cd gstreamer
git checkout -t origin/$BRANCH || true
sudo make uninstall || true
git pull
./autogen.sh --disable-gtk-doc
make
sudo make install
cd ..
cd gst-plugins-base
git checkout -t origin/$BRANCH || true
sudo make uninstall || true
git pull
./autogen.sh --disable-gtk-doc
make
sudo make install
cd ..
cd gst-plugins-good
git checkout -t origin/$BRANCH || true
sudo make uninstall || true
git pull
./autogen.sh --disable-gtk-doc
make
sudo make install
cd ..
cd gst-plugins-ugly
git checkout -t origin/$BRANCH || true
sudo make uninstall || true
git pull
./autogen.sh --disable-gtk-doc
make
sudo make install
cd ..
cd gst-libav
git checkout -t origin/$BRANCH || true
sudo make uninstall || true
git pull
./autogen.sh --disable-gtk-doc
make
sudo make install
cd ..
cd gst-plugins-bad
git checkout -t origin/$BRANCH || true
sudo make uninstall || true
git pull
# some extra flags on rpi
if [[ $RPI -eq 1 ]]; then
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'
./autogen.sh --disable-gtk-doc --disable-examples --disable-x11 --disable-glx --disable-glx --disable-opengl
make CFLAGS+="-Wno-error -Wno-redundant-decls -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux" \
CPPFLAGS+="-Wno-error -Wno-redundant-decls -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux" \
CXXFLAGS+="-Wno-redundant-decls" LDFLAGS+="-L/opt/vc/lib"
else
./autogen.sh --disable-gtk-doc
make CFLAGS+="-Wno-error -Wno-redundant-decls" CXXFLAGS+="-Wno-redundant-decls"
fi
sudo make install
cd ..
# python bindings
cd gst-python
git checkout -t origin/$BRANCH || true
export LD_LIBRARY_PATH=/usr/local/lib/
sudo make uninstall || true
git pull
PYTHON=/usr/bin/python3 ./autogen.sh
make
sudo make install
cd ..
# omx support
cd gst-omx
sudo make uninstall || true
git pull
if [[ $RPI -eq 1 ]]; then
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'
./autogen.sh --disable-gtk-doc --with-omx-target=rpi
# fix for glcontext errors and openexr redundant declarations
make CFLAGS+="-Wno-error -Wno-redundant-decls" LDFLAGS+="-L/opt/vc/lib"
else
./autogen.sh --disable-gtk-doc --with-omx-target=bellagio
# fix for glcontext errors and openexr redundant declarations
make CFLAGS+="-Wno-error -Wno-redundant-decls"
fi
sudo make install
cd ..
# VAAPI, not for RPI
if [[ $RPI -ne 1 ]]; then
cd gstreamer-vaapi
sudo make uninstall || true
git pull
./autogen.sh
make
sudo make install
cd ..
fi
@richtong

This comment has been minimized.

Copy link

richtong commented Mar 24, 2016

I tried running this on intel debian and the vaapi location seems wrong. I forked the gist and am testing now with a different location noted in https://www.freedesktop.org/wiki/Software/vaapi/

It does seem to compile for intel, but gst-launch-1.0 returns the error and using master branch does not work. It does compile setting BRANCH to 1.6 and it seems to be export LD_LIBRARY_PATH=/usr/local/lib is needed and then gst-launch-1.0 --gst-version does seem to work. Might want to document

Thanks much for the script!

@fohletex

This comment has been minimized.

Copy link

fohletex commented Jul 11, 2016

Hey,

really great script you provide here! I had nearly the same issues as @richtong and switched thus from gitorious to freedesktop for VAAPI. Furthermore I was used to add the following package requirements: libudev, libdrm and egl

See my fork for futher details: https://gist.github.com/fohletex/7db8fb50940bbfac32e399c225d66770

@woehrl

This comment has been minimized.

Copy link

woehrl commented Aug 17, 2016

On RPi (Raspbian Jessie, Kernel 4.4) some of the python libraries reside in /usr/lib/arm-linux-gnueabihf/.
This is why gstreamer registry does not find some libs:
** (gst-plugin-scanner:12900): CRITICAL **: Couldn't g_module_open libpython. Reason: /usr/lib/libpython3.4m.so: cannot open shared object file: No such file or directory
Possible fix (as gst-inspect-1.0 obviously ignores /etc/ld.so.conf):

$ rm ~/.cache/gstreamer-1.0/registry.armv7l.bin
$ sudo ln -s /usr/lib/arm-linux-gnueabihf/libpython3.4m.so /usr/lib/libpython3.4m.so
$ gst-inspect-1.0 | grep omx
@woehrl

This comment has been minimized.

Copy link

woehrl commented Aug 17, 2016

gst-omx needs its config file in ~/.config/. So this is my fix:

$ rm ~/.cache/gstreamer-1.0/registry.armv7l.bin
$ mkdir ~/.config
$ cp /usr/local/etc/xdg/gstomx.conf ~/.config/
$ gst-inspect-1.0 | grep omx

Otherwise, something like this happens:
0:00:00.752900872 1130 0x1eb7540 ERROR omx gstomx.c:2681:plugin_init: Failed to load configuration file: Valid key file could not be found in search dirs (searched in: /home/pi/.config:/etc/xdg as per GST_OMX_CONFIG_DIR environment variable, the xdg user config directory (or XDG_CONFIG_HOME) and the system config directory (or XDG_CONFIG_DIRS)

@woehrl

This comment has been minimized.

Copy link

woehrl commented Aug 17, 2016

As I'm compiling on a Raspberry Pi 3, I had to change "BCM2708" to "BCM2709" or simply "BCM270" to catch both.

@SpicySimon

This comment has been minimized.

Copy link

SpicySimon commented Oct 6, 2016

Thanks for publishing. Please would you mind replacing:
git clone git://gitorious.org/vaapi/gstreamer-vaapi.git
with
git clone http://gitorious.org/vaapi/gstreamer-vaapi.git
?

@johnboiles

This comment has been minimized.

Copy link

johnboiles commented Dec 4, 2016

A few things I had to do to get this to work:

  • (before running script) I had to change BCM2708 to BCM270 as @woehrl mentioned.
  • (before running script) Remove any static library versions of dependencies from /usr/lib (I previously had compiled libx264 with --enable-static for in order to build ffmpeg from source)
  • (before or after running script) Remove the gstreamer packages I already had installed previously: sudo apt-get remove libgstreamer* gstreamer1.0*.

Other than that the script worked great on RaspberryPi 3 w/ Raspbian Jessie!
Linux piscope 4.4.34-v7+ #930 SMP Wed Nov 23 15:20:41 GMT 2016 armv7l GNU/Linux

Thanks @sphaero for saving me a ton of time!

@aplocher

This comment has been minimized.

Copy link

aplocher commented Dec 5, 2016

Would be great if we could specify a prefix too. Thanks for the script!

@hblanken

This comment has been minimized.

Copy link

hblanken commented Dec 9, 2016

It takes a long time on the tiny Pi 3. I followed @johnboiles suggestions. I adjusted all the make to make -j3 and I executed with root sudo ./gstreamer-build.sh. Otherwise it will have write issues and hangs at config.

config.status: creating config.h
config.status: executing depfiles commands

...then raspberry just hangs...

@hblanken

This comment has been minimized.

Copy link

hblanken commented Dec 9, 2016

Not completely successful yet. I am trying to encode with voaacenc and this is a plugin that has not been built in gst-plugins-bad.
Gives me the following error:

configure: *** checking feature: vo-aacenc library ***
configure: *** for plug-ins: vo-aacenc ***
checking for VOAACENC... no
configure: No package 'vo-aacenc' found
configure: *** These plugins will not be built: vo-aacenc

configure: *** Plug-ins without external dependencies that will be built:
accurip
adpcmdec
adpcmenc
aiff
asfmux
audiobuffersplit
audiofxbad
audiomixer
audiovisualizers
autoconvert
bayer
camerabin2
coloreffects
compositor
debugutils
dvbsuboverlay
dvdspu
festival
fieldanalysis
freeverb
frei0r
gaudieffects
gdp
geometrictransform
id3tag
inter
interlace
ivfparse
ivtc
jp2kdecimator
jpegformat
librfb
midi
mpegdemux
mpegpsmux
mpegtsdemux
mpegtsmux
mxf
netsim
onvif
pcapparse
pnm
rawparse
removesilence
sdp
segmentclip
siren
smooth
speed
stereo
subenc
timecode
videofilters
videoframe_audiolevel
videoparsers
videosignal
vmnc
y4m
yadif

configure: *** Plug-ins with dependencies that will NOT be built:
...
ttml
vdpau
vo-aacenc
vo-amrwbenc
vulkan
wasapi
wayland
webp
webrtcdsp
wildmidi
wininet
winks
winscreencap
x265
xvid

How can I build voaacenc plugin?

@mpuz

This comment has been minimized.

Copy link

mpuz commented Dec 13, 2016

Hello all.. I stuck at

make[4]: Entering directory '/root/src/gstreamer/gstreamer/gst'
GEN      Gst-1.0.gir
Package gstreamer-video-1.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gstreamer-video-1.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gstreamer-video-1.0' found

....
Command '['/root/src/gstreamer/gstreamer/gst/tmp-introspectcRrydB/Gst-1.0', '--introspect-
dump=/root/src/gstreamer/gstreamer/gst/tmp-introspectcRrydB/functions.txt,/root/src/gstreamer/gstreamer/gst/tmp-
introspectcRrydB/dump.xml']' returned non-zero exit status -11
Makefile:2020: recipe for target 'Gst-1.0.gir' failed

Raspberry pi 2, 2016-11-25-raspbian-jessie-lite

P.S. Also I've searched and there is no such file in pkg-config - gstreamer-video-1.0.pc

@Swap-File

This comment has been minimized.

Copy link

Swap-File commented Dec 22, 2016

Thank you very much for this. It saved me a lot of time. Here are some notes: I started with a fresh Jessie lite image, then as stated above, on my Pi 3 I had to change "BCM2708" to "BCM270". I built from main and 10.2 and both worked. adding -j3 to the make commands sped it up. After I ran the script, I added the following lines to my .profile (not sure if all were needed, but they were suggested in another gstreamer post)

export GST_PLUGIN_PATH=/usr/local/lib/gstreamer-1.0/
export GST_OMX_CONFIG_DIR=/usr/local/etc/xdg/
export LD_LIBRARY_PATH=/usr/local/lib/

And also copy libpython3.4m to where gstreamer was looking for it:
cp /usr/lib/arm-linux-gnueabihf/libpython3.4m.so.1.0 /usr/lib/libpython3.4m.so

It did not seem required to run the script via sudo.

@johnboiles

This comment has been minimized.

Copy link

johnboiles commented Jan 28, 2017

Building just now I got failures when building gst-omx. I had to add a few libraries to line 148:

make CFLAGS+="-Wno-error -Wno-redundant-decls" LDFLAGS+="-L/opt/vc/lib -lGLESv2 -lEGL -lbcm_host"

Seems like maybe a bug with the gst-omx Makefile. Hopefully other people won't have to do this in the future.

@Swap-File

This comment has been minimized.

Copy link

Swap-File commented Feb 22, 2017

The master branch doesn't seem to be compiling correctly on the Pi right now. To get 1.10.3 to compile I made some minor changes. Below is my edited build file. I have not tested it with 1.11. It also grabs and compiles rpicamsrc.

https://gist.github.com/Swap-File/ea4b7a4739ca8c859bd7c3c3d8b087e6

Thanks again to everyone who has helped share their fixes.

Note: Python seems to not be working, not sure of why, could be something on my end from testing. I'll check it out....

@Swap-File

This comment has been minimized.

Copy link

Swap-File commented Mar 14, 2017

I realized I had to define the GI_TYPELIB_PATH to get gst-python to work. To compile 1.10, starting with a clean image of jessie lite, I first run this build script (as my normal user, not via sudo):

https://gist.github.com/Swap-File/ea4b7a4739ca8c859bd7c3c3d8b087e6

Then I add the following lines to my .profile

export GST_PLUGIN_PATH=/usr/local/lib/gstreamer-1.0/
export GST_OMX_CONFIG_DIR=/usr/local/etc/xdg/
export LD_LIBRARY_PATH=/usr/local/lib/
export GI_TYPELIB_PATH=/usr/local/lib/girepository-1.0/

and add the link like woehrl suggested:

sudo ln -s /usr/lib/arm-linux-gnueabihf/libpython3.4m.so /usr/lib/libpython3.4m.so

I also noticed that setting j higher than 2 can sometimes cause the script to crash. I'm not sure if it is due to the Pi overheating or running out of ram. My power supply seems adequate. I'll try it with a heatsink and watch my temps next time.

@Swap-File

This comment has been minimized.

Copy link

Swap-File commented Mar 15, 2017

Tested and working with 1.11.2 and 1.10.4 (edit branch to 1.11 or 1.10 before running the script).

Does anyone know if there is a better option than manually setting GI_TYPELIB_PATH?

Note: libgstdvdsub.so seems to give me a "** (gst-plugin-scanner:1848): CRITICAL **: Could not get Gst.Element" error when gstreamer first scans the plugins to populate the registry, but it does not blacklist the plugin. I'm not sure if it is dvdsub is prevented from working, it's not a plugin I am familiar with.

Here is a list of all the plugins included with 1.11.2:
https://gist.github.com/Swap-File/221f397ca8472fcdd6f29b8752a07504

@Adam-Langley

This comment has been minimized.

Copy link

Adam-Langley commented Apr 4, 2017

Thanks for writing this script - great work.

I have 1.8 working, but I've had some issues which I feel I might need some recent pi3 patches (SKIP64BIT flag). After using this script with 1.10 (it compiled file), gstreamer omx was pretty broken - couldn't get anything but corrupted h264 out of the encoder. Has anyone else had success on 1.10 or 1.11 which included gstomxh264dec and gstomxh264enc in the pipeline (basically a transcoder)?

@paolocavagnolo

This comment has been minimized.

Copy link

paolocavagnolo commented May 10, 2017

It worked on RPi-zero !

  • Gstreamer version: BRANCH = 1.8
  • changed BCM2708 to BCM2835
  • add to ~/.profile:
    export GST_PLUGIN_PATH=/usr/local/lib/gstreamer-1.0/
    export GST_OMX_CONFIG_DIR=/usr/local/etc/xdg/
    export LD_LIBRARY_PATH=/usr/local/lib/
    export GI_TYPELIB_PATH=/usr/local/lib/girepository-1.0/
  • add the link:
    sudo ln -s /usr/lib/arm-linux-gnueabihf/libpython3.4m.so /usr/lib/libpython3.4m.so
  • Gst-omx version: BRANCH = 1.0 (otherwise it requires GStreamer version 1.13)

my version here.

Thanks for the script!

@dariuskrail

This comment has been minimized.

Copy link

dariuskrail commented May 12, 2017

For my RPi3, I did the following modifications.

  • Changed BCM2708 to BCM2835.
  • Added "python-dev" to the apt-get for required libraries to fix gst-python build.
  • Changed to LDFLAGS+="-L/opt/vc/lib -lGLESv2 -lEGL" to fix some undefined references in gst-plugins-bad build.
  • Changed to LDFLAGS+="-L/opt/vc/lib -lGLESv2 -lEGL -lbcm_host" to fix some undefined references in gst-omx build.
  • Added "-j3" option to the make commands.

I have managed to build most of the gst components. However, for gst-libav, I am getting the error "GNU assembler not found, install/update gas-preprocessor". I have tried obtaining the gas-preprocessor.pl script from https://github.com/libav/gas-preprocessor, adding it to /usr/local/bin and adding a chmod +x to it as suggested by some users in Stack Overflow but the error still persist.

Anyone has encountered this error so far?

@deadplant

This comment has been minimized.

Copy link

deadplant commented May 13, 2017

Yes @dariuskrail I'm stuck at the same spot.
Can't get gst-libav to compile.

after installing gas-preprocessor.pl I'm seeing errors like this in gst-libav/gst-libs/ext/libav/config.log

`gas-preprocessor.pl -arch arm -as-type -- as -v

unknown as type: '--'
`

and

`as -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -DPIC -march=armv6 -fPIC -c -o /tmp/ffconf.1TgBWyqx.o /tmp/ffconf.FVLDOfEV.S

as: unrecognized option '-_ISOC99_SOURCE'
`

before it bombs out with the "GNU assembler not found, install/update gas-preprocessor" error.

@dariuskrail

This comment has been minimized.

Copy link

dariuskrail commented May 13, 2017

@deadplant, I have gotten the same error as you did on gst-libav/gst-libs/ext/libav/config.log on the unrecognized option '-_ISOC99_SOURCE', when libav's configure was running in libav checking the GNU assembler's capability.

You could skip this autogen.sh step in libav to avoid this error and run make directly. However, I think this is not the proper way as even if the build is successful, there is no guarantee that libav's plugins would properly work after that.

@gohai

This comment has been minimized.

Copy link

gohai commented May 15, 2017

@dariuskrail @deadplant
I have the same issue building gst-ffmpeg on Raspbian. I can force -as-type to be gas instead of empty string, which will fix the "unknown type" error, but the unrecognized option '-_ISOC99_SOURCE' one remains and also bites during compilation.

Wrote to gst-devel and ffmpeg-user, but nothing yet.

@North46

This comment has been minimized.

Copy link

North46 commented Jun 9, 2017

Using all the suggestions here, I was able to build gstreamer 1.10.4 on Raspbian Lite (Raspberry Pi3) with full omx support, but was unable to build it properly on full Raspbian. Has anyone else been able to build it on full Raspbian??

@matteo1974

This comment has been minimized.

Copy link

matteo1974 commented Aug 12, 2017

I had the same issue on RPI 3 related to missing voaacenc plugin (as reported by hblanken).
I was able to solve such problem installing lib-voaacenc among the required libraries (line #20).

Thanks a lot for the script!

@Swap-File

This comment has been minimized.

Copy link

Swap-File commented Aug 21, 2017

It looks like the new version of Raspbian that is Stretch based now includes gstreamer 1.10 precompiled, but glimagesink doesn't seem to work in Raspbian Stretch Lite without X.

When I went to compile 1.10 and 1.12 myself the above script complained about:

/usr/bin/ld: cannot find -lGLESv2
/usr/bin/ld: cannot find -lEGL

It looks like some of the GLES files were renamed in Stretch. I copied /opt/vc/lib/libbrcmGLESv2.so to /opt/vc/lib/libGLESv2.so and /opt/vc/lib/libbrcmEGL.so to /opt/vc/lib/libEGL.so and it seems to be compiling now. I'm going to test both self compiled 1.10 and 1.12, and poke around a bit more with the 1.10 that comes in the default Raspbian repository.

1.12 seems to compile OK, but glimagesink complains about "ERROR: from element /GstPipeline:pipeline0/GstGLImageSinkBin:glimagesinkbin0/GstGLImageSink:sink: could not GetProcAddress core opengl functions"

@Swap-File

This comment has been minimized.

Copy link

Swap-File commented Aug 22, 2017

Near as I can tell, the version of gstreamer 1.10 that is included in the Raspbian Stretch repository is designed for use with X, I get full acceleration when using a minimal X installation on Raspbian Stretch Lite with the fake KMS OpenGL driver, and I don't get any of the display driver leaks I was getting when I was using my self compiled version of 1.10 and 1.12 on Raspbian Jessie Lite with OpenGL ES without X. They both have similar CPU usage.

I think getting a self compiled version of 1.10 or 1.12 working under stretch is likely beyond my capabilities at this point, but I will continue to test and report back.

@Swap-File

This comment has been minimized.

Copy link

Swap-File commented Aug 22, 2017

I've given up on getting self compiled 1.10 or 1.12 working under Raspbian Stretch Lite for now. Instead I installed the gstreamer1.0 (1.10) package onto Raspbian Stretch Lite from the repository, then did a minimal X install, switched to the fake KMS OpenGL driver, and can now launch my program that links to gstreamer via startx.

Minimal X:
sudo apt-get install --no-install-recommends xserver-xorg
sudo apt-get install --no-install-recommends xinit

Test:
sudo apt-get install mesa-utils
sudo startx glxgears

It loads very quickly with no window manager installed, gstreamer works very nicely, but I can't get transparency to work right when I launch my other programs.

Until I get the transparency stuff figured out I think I'll be sticking to Jessie.

Edit: It seems like under X, there is a higher initial CPU cost in my simple pipelines, but total CPU usage for intensive pipelines is noticeably lower (to the point I can up my framerate). I'm not sure if this is due to something in Stretch or because I am using gstreamer with X.

@Swap-File

This comment has been minimized.

Copy link

Swap-File commented Aug 24, 2017

After noticing that 1.10 in stretch seemed to work better than self compiled 1.12 did in Jessie, I installed Jessie Lite on a fresh SD card and recompiled 1.10. I noticed that the memory leaks I had in 1.12 were gone in 1.10.

My program creates and destroys a lot of pipelines via gst_parse_launch, and in 1.12 it appeared that the "glimagesink" element count name kept going up each time I used the element in a new pipeline, until crashing. I'm assuming that unused copies of it were hanging around until all video ram was consumed. My quick hack fix with 1.12 was to use replace gst_parse_launch in my program with spawning "gst-launch-1.0". It appears the resources get released when "gst-launch-1.0" quits, but not when I stopped and killed the pipeline created with gst_parse_launch. In 1.10 it all works perfectly for me with gst_parse_launch, which launches way faster than gst-launch-1.0.

As a secondary operation, I also overlay some OpenGL ES 2 animations with a shutter effect that opens and closes to show and hide the video stream. With the Legacy Raspbian opengl driver, any OpenGL program can write to the video card directly, and transparent areas in other programs are seen as visible. This compositing seems to be very fast. In Jessie with 1.10 and 1.12 this works well.

Once I switched to stretch I couldn't get my self compiled version to compile any more, so I installed stock 1.10 via apt-get, but that version requires the new KMS OpenGL driver & X to be installed. I got that working with minimal X (see above), but compositing a different program over another with transparent areas in X didn't seem to work right, every sample I tried created black boxes where they should be transparent. But relying on X to do compositing isn't the best idea anyway so....

As a final test, in Jessie I played with a C program that could grab the textures from gstreamer using the built in callbacks and share gstreamer's openGL context for rendering some 3D. This is probably the "correct" way to solve my problem, but is is more complex. It was basically a heavily modified version of this: https://github.com/GStreamer/gst-plugins-bad/tree/master/tests/examples/gl/generic/cube I got the glimagesink "client-draw" callback to work and produce openGL textures, but it was too slow on the Pi to be viable for live video, I was getting about half the performance of my past gstreamer (gst_parse_launch or gst-launch-1.0) plus a separate opengl program solutions. I'd guess that the buffers are probably getting copied back and forth from the video card during rendering slowing stuff down, but I'm not familiar enough with what every gstreamer api call does behind the scenes yet. I need to also figure out how to use the appsink or fakesink callbacks and see if they work better, or find any way to use the textures directly without making a copy of them.

Until then, self compiled gstreamer 1.10 (using the above build scripts) on Raspbian jessie lite will be my preferred choice.

@Swap-File

This comment has been minimized.

Copy link

Swap-File commented Aug 25, 2017

I spent the last few days mashing the glxgears demo together with some gstreamer demos to make a new sample program that can share textures from gstreamer frames to OpenGL without copying them (and from OpenGL to gstreamer, if you wanted to). I tested it under Raspbian Stretch Lite with 1.10 (precompiled) with minimal X and the Fake KMS OpenGL Driver.

https://github.com/Swap-File/gst-context-share/tree/master

There were a lot of people asking on the gstreamer forums about how to do this, but I couldn't find any examples of it. It's currently rough around the edges but hopefully someone will find it useful.

@gkreidl

This comment has been minimized.

Copy link

gkreidl commented Sep 14, 2017

On Raspbian Wheezy and Jessie I have been using gstreamer and gstreamer-omx for real time transcoding of DVB streams.

On Stretch gstreamer is version 1.10.4, but gstreamer-omx is still version 1.0.0.1 and does not work with gstreamer any more. Compiling gstreamer-omx from 1.10.5 source was only possible after compiling the bad plugins with Rasperry Pi specific settings (from 1.10 branch).

But trying to use gstreamer-omx decoding in a tool chain always throws an error:

ERROR: from element /GstPipeline:pipeline0/GstOMXH264Dec-omxh264dec:omxh264dec-omxh264dec0: Internal data stream error.
Additional debug info:
gstomxvideodec.c(1599): gst_omx_video_dec_loop (): /GstPipeline:pipeline0/GstOMXH264Dec-omxh264dec:omxh264dec-omxh264dec0:
stream stopped, reason not-negotiated

Did anybody create a working gstreamer-omx 1.10.5 module (and how)?

@Swap-File

This comment has been minimized.

Copy link

Swap-File commented May 23, 2018

I was able to fully compile 1.14 on my Pi with the following script on Stretch Lite:

https://gist.github.com/Swap-File/d8511128930c93281f36f18d634f6748

It also installs minimal X & 217 plugins.

https://gist.github.com/Swap-File/bfa6d6e9f1047d6f7be0f83d7d2bdf78

Video acceleration seems to be working OK & accelerated video output with the Fake / Real KMS driver enabled.

@Lin-Buo-Ren

This comment has been minimized.

Copy link

Lin-Buo-Ren commented Sep 30, 2018

@mpuz

P.S. Also I've searched and there is no such file in pkg-config - gstreamer-video-1.0.pc

Check out the libgstreamer-plugins-base1.0-dev package, just in case anyone encounters the same issue.

@vpolimenov

This comment has been minimized.

Copy link

vpolimenov commented Nov 21, 2018

I am getting the following:

make[5]: Entering directory '/home/pi/src/gstreamer/gst-plugins-base/gst-libs/gst/video'
  CC       libgstvideo_1.0_la-colorbalance.lo
  CC       libgstvideo_1.0_la-colorbalancechannel.lo
  CC       libgstvideo_1.0_la-navigation.lo
  CC       libgstvideo_1.0_la-video.lo
  CC       libgstvideo_1.0_la-video-anc.lo
video-anc.c:617:5: error: "G_GNUC_CHECK_VERSION" is not defined [-Werror=undef]
 #if G_GNUC_CHECK_VERSION(3,4)
     ^
video-anc.c:617:25: error: missing binary operator before token "("
 #if G_GNUC_CHECK_VERSION(3,4)
                         ^
cc1: all warnings being treated as errors
@kevkid

This comment has been minimized.

Copy link

kevkid commented Dec 22, 2018

this is insane! getting this from a fresh pull.

In file included from gst_private.h:49:0,
                 from gstpad.c:90:
gstpad.c: In function ‘cleanup_hook’:
gstpad.c:1376:7: error: format ‘%llu’ expects argument of type ‘long long unsigned int’, but a
rgument 8 has type ‘gulong {aka long unsigned int}’ [-Werror=format=]
       "cleaning up hook %" G_GUINT64_FORMAT " with flags %08x", hook->hook_id,
       ^
gstinfo.h:640:31: note: in definition of macro ‘GST_CAT_LEVEL_LOG’
         (GObject *) (object), __VA_ARGS__);    \
                               ^~~~~~~~~~~
gstpad.c:1375:3: note: in expansion of macro ‘GST_DEBUG_OBJECT’
   GST_DEBUG_OBJECT (pad,
   ^~~~~~~~~~~~~~~~
  CC       libgstreamer_1.0_la-gstparamspecs.lo
  CC       libgstreamer_1.0_la-gstpipeline.lo
  CC       libgstreamer_1.0_la-gstplugin.lo
  CC       libgstreamer_1.0_la-gstpluginfeature.lo
  CC       libgstreamer_1.0_la-gstpluginloader.lo
  CC       libgstreamer_1.0_la-gstpoll.lo
  CC       libgstreamer_1.0_la-gstpreset.lo
  CC       libgstreamer_1.0_la-gstprotection.lo
  CC       libgstreamer_1.0_la-gstquark.lo
  CC       libgstreamer_1.0_la-gstquery.lo
  CC       libgstreamer_1.0_la-gstregistry.lo
  CC       libgstreamer_1.0_la-gstregistrychunks.lo
cc1: all warnings being treated as errors
Makefile:1363: recipe for target 'libgstreamer_1.0_la-gstpad.lo' failed
make[4]: *** [libgstreamer_1.0_la-gstpad.lo] Error 1
make[4]: *** Waiting for unfinished jobs....
make[4]: Leaving directory '/root/src/gstreamer/gstreamer/gst'
Makefile:1732: recipe for target 'all-recursive' failed
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory '/root/src/gstreamer/gstreamer/gst'
Makefile:936: recipe for target 'all' failed
make[2]: *** [all] Error 2
make[2]: Leaving directory '/root/src/gstreamer/gstreamer/gst'
Makefile:742: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/root/src/gstreamer/gstreamer'
Makefile:648: recipe for target 'all' failed
make: *** [all] Error 2

I can comment out the offending code but surprise surprise there are more errors.

Anyone else get this error on a raspberry pi 3 b+?

@grkblood13

This comment has been minimized.

Copy link

grkblood13 commented Aug 28, 2019

I'd like to suggest adding rock64 support as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.