RaoulSerio
Posts: 10
Joined: Tue Dec 19, 2017 9:12 am

Re: GStreamer and omx encoding from live source.. a naive problem

Fri Feb 09, 2018 12:40 pm

Good morning folks,
today we installed a fresh Raspbian Stretch Lite installation from scratch, with common dist-upgrade operations.

Everything seems to be working correctly in different conditions at every bitrate.
We will make more tests during next days.

Many thanks to all involved in this thread *6by9 *shiftplusone and *gkreidl

:D

gkreidl
Posts: 5911
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany

Re: GStreamer and omx encoding from live source.. a naive problem

Mon Feb 12, 2018 8:09 am

ShiftPlusOne wrote:
Thu Feb 08, 2018 1:01 pm
Haven't seen that one before. Starting from the latest raspbian or raspbian lite image, how do I reproduce the problem?
Using apt-get:

Setting up gstreamer1.0-omx-rpi (1.10.4-1+rpt3) ...
update-alternatives: using /usr/lib/arm-linux-gnueabihf/gstreamer-1.0/libgstomx-rpi.so to provide /usr/lib/arm-linux-gnueabihf/gstreamer-1.0/libgstomx.so (libgstomx-arm-linux-gnueabihf.so) in auto mode
Setting up gstreamer1.0-omx-rpi-config (1.10.4-1+rpt3) ...
update-alternatives: error: alternative path /etc/xdg/gstomx-rpi.conf doesn't exist
dpkg: error processing package gstreamer1.0-omx-rpi-config (--configure):
subprocess installed post-installation script returned error exit status 2
Errors were encountered while processing:
gstreamer1.0-omx-rpi-config
E: Sub-process /usr/bin/dpkg returned an error code (1)
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5655
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: GStreamer and omx encoding from live source.. a naive problem

Mon Feb 12, 2018 1:35 pm

Here's what I'm seeing:

Code: Select all

[email protected]:~# apt install gstreamer1.0-omx-rpi-config
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  gstreamer1.0-omx-rpi libgstreamer-plugins-bad1.0-0 libwayland-cursor0 libwayland-egl1-mesa
The following NEW packages will be installed:
  gstreamer1.0-omx-rpi gstreamer1.0-omx-rpi-config libgstreamer-plugins-bad1.0-0 libwayland-cursor0 libwayland-egl1-mesa
0 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Need to get 2051 kB of archives.
After this operation, 3233 kB of additional disk space will be used.
Do you want to continue? [Y/n] 
Get:1 http://archive.raspberrypi.org/debian stretch/main armhf libwayland-egl1-mesa armhf 13.0.6-1+rpi2 [42.7 kB]
Get:2 http://archive.raspberrypi.org/debian stretch/main armhf gstreamer1.0-omx-rpi armhf 1.10.4-1+rpt3 [115 kB]
Get:4 http://archive.raspberrypi.org/debian stretch/main armhf gstreamer1.0-omx-rpi-config armhf 1.10.4-1+rpt3 [40.5 kB]
Get:3 http://mirror.mythic-beasts.com/raspbian/raspbian stretch/main armhf libgstreamer-plugins-bad1.0-0 armhf 1.10.4-1 [1841 kB]
Get:5 http://mirror.mythic-beasts.com/raspbian/raspbian stretch/main armhf libwayland-cursor0 armhf 1.12.0-1 [12.1 kB]
Fetched 2051 kB in 0s (2526 kB/s)              
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libwayland-egl1-mesa:armhf.
(Reading database ... 45652 files and directories currently installed.)
Preparing to unpack .../libwayland-egl1-mesa_13.0.6-1+rpi2_armhf.deb ...
Unpacking libwayland-egl1-mesa:armhf (13.0.6-1+rpi2) ...
Selecting previously unselected package libgstreamer-plugins-bad1.0-0:armhf.
Preparing to unpack .../libgstreamer-plugins-bad1.0-0_1.10.4-1_armhf.deb ...
Unpacking libgstreamer-plugins-bad1.0-0:armhf (1.10.4-1) ...
Selecting previously unselected package libwayland-cursor0:armhf.
Preparing to unpack .../libwayland-cursor0_1.12.0-1_armhf.deb ...
Unpacking libwayland-cursor0:armhf (1.12.0-1) ...
Selecting previously unselected package gstreamer1.0-omx-rpi.
Preparing to unpack .../gstreamer1.0-omx-rpi_1.10.4-1+rpt3_armhf.deb ...
Unpacking gstreamer1.0-omx-rpi (1.10.4-1+rpt3) ...
Selecting previously unselected package gstreamer1.0-omx-rpi-config.
Preparing to unpack .../gstreamer1.0-omx-rpi-config_1.10.4-1+rpt3_armhf.deb ...
Unpacking gstreamer1.0-omx-rpi-config (1.10.4-1+rpt3) ...
Processing triggers for libc-bin (2.24-11+deb9u1) ...
Setting up libwayland-egl1-mesa:armhf (13.0.6-1+rpi2) ...
Setting up libwayland-cursor0:armhf (1.12.0-1) ...
Setting up libgstreamer-plugins-bad1.0-0:armhf (1.10.4-1) ...
Setting up gstreamer1.0-omx-rpi (1.10.4-1+rpt3) ...
update-alternatives: using /usr/lib/arm-linux-gnueabihf/gstreamer-1.0/libgstomx-rpi.so to provide /usr/lib/arm-linux-gnueabihf/gstreamer-1.0/libgstomx.so (libgstomx-arm-linux-gnueabihf.so) in auto mode
Setting up gstreamer1.0-omx-rpi-config (1.10.4-1+rpt3) ...
update-alternatives: using /etc/xdg/gstomx-rpi.conf to provide /etc/xdg/gstomx.conf (gstomx.conf) in auto mode
Processing triggers for libc-bin (2.24-11+deb9u1) ...
Are you running that on a clean image or have you done things on there before? Perhaps manually removing/modifying /etc/xdg/gstomx-rpi.conf ?

gkreidl
Posts: 5911
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany

Re: GStreamer and omx encoding from live source.. a naive problem

Mon Feb 12, 2018 6:07 pm

ShiftPlusOne wrote:
Mon Feb 12, 2018 1:35 pm
Here's what I'm seeing:

Code: Select all

[email protected]:~# apt install gstreamer1.0-omx-rpi-config
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  gstreamer1.0-omx-rpi libgstreamer-plugins-bad1.0-0 libwayland-cursor0 libwayland-egl1-mesa
The following NEW packages will be installed:
  gstreamer1.0-omx-rpi gstreamer1.0-omx-rpi-config libgstreamer-plugins-bad1.0-0 libwayland-cursor0 libwayland-egl1-mesa
0 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Need to get 2051 kB of archives.
After this operation, 3233 kB of additional disk space will be used.
Do you want to continue? [Y/n] 
Get:1 http://archive.raspberrypi.org/debian stretch/main armhf libwayland-egl1-mesa armhf 13.0.6-1+rpi2 [42.7 kB]
Get:2 http://archive.raspberrypi.org/debian stretch/main armhf gstreamer1.0-omx-rpi armhf 1.10.4-1+rpt3 [115 kB]
Get:4 http://archive.raspberrypi.org/debian stretch/main armhf gstreamer1.0-omx-rpi-config armhf 1.10.4-1+rpt3 [40.5 kB]
Get:3 http://mirror.mythic-beasts.com/raspbian/raspbian stretch/main armhf libgstreamer-plugins-bad1.0-0 armhf 1.10.4-1 [1841 kB]
Get:5 http://mirror.mythic-beasts.com/raspbian/raspbian stretch/main armhf libwayland-cursor0 armhf 1.12.0-1 [12.1 kB]
Fetched 2051 kB in 0s (2526 kB/s)              
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libwayland-egl1-mesa:armhf.
(Reading database ... 45652 files and directories currently installed.)
Preparing to unpack .../libwayland-egl1-mesa_13.0.6-1+rpi2_armhf.deb ...
Unpacking libwayland-egl1-mesa:armhf (13.0.6-1+rpi2) ...
Selecting previously unselected package libgstreamer-plugins-bad1.0-0:armhf.
Preparing to unpack .../libgstreamer-plugins-bad1.0-0_1.10.4-1_armhf.deb ...
Unpacking libgstreamer-plugins-bad1.0-0:armhf (1.10.4-1) ...
Selecting previously unselected package libwayland-cursor0:armhf.
Preparing to unpack .../libwayland-cursor0_1.12.0-1_armhf.deb ...
Unpacking libwayland-cursor0:armhf (1.12.0-1) ...
Selecting previously unselected package gstreamer1.0-omx-rpi.
Preparing to unpack .../gstreamer1.0-omx-rpi_1.10.4-1+rpt3_armhf.deb ...
Unpacking gstreamer1.0-omx-rpi (1.10.4-1+rpt3) ...
Selecting previously unselected package gstreamer1.0-omx-rpi-config.
Preparing to unpack .../gstreamer1.0-omx-rpi-config_1.10.4-1+rpt3_armhf.deb ...
Unpacking gstreamer1.0-omx-rpi-config (1.10.4-1+rpt3) ...
Processing triggers for libc-bin (2.24-11+deb9u1) ...
Setting up libwayland-egl1-mesa:armhf (13.0.6-1+rpi2) ...
Setting up libwayland-cursor0:armhf (1.12.0-1) ...
Setting up libgstreamer-plugins-bad1.0-0:armhf (1.10.4-1) ...
Setting up gstreamer1.0-omx-rpi (1.10.4-1+rpt3) ...
update-alternatives: using /usr/lib/arm-linux-gnueabihf/gstreamer-1.0/libgstomx-rpi.so to provide /usr/lib/arm-linux-gnueabihf/gstreamer-1.0/libgstomx.so (libgstomx-arm-linux-gnueabihf.so) in auto mode
Setting up gstreamer1.0-omx-rpi-config (1.10.4-1+rpt3) ...
update-alternatives: using /etc/xdg/gstomx-rpi.conf to provide /etc/xdg/gstomx.conf (gstomx.conf) in auto mode
Processing triggers for libc-bin (2.24-11+deb9u1) ...
Are you running that on a clean image or have you done things on there before? Perhaps manually removing/modifying /etc/xdg/gstomx-rpi.conf ?
I have installed and removed it (both the plugin and the config) multiple times in the past, using apt, dpkg and synaptic.

In between I have installed my own 1.10.5 version (and created a package using checkinstall). It does not require any update -alternatives and doesn't use fake names. Before I tried to install the Foundation packages again I removed it using dpkg.
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5655
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: GStreamer and omx encoding from live source.. a naive problem

Mon Feb 12, 2018 6:16 pm

Sure, that makes sense then. Debian errs on the side of caution when it comes to /etc and preserves the changes that the user makes. By removing the file, you've told dpkg that you don't want it there. Then when the postinst script tries to make that the default gst conf, it rightfully complains.

https://unix.stackexchange.com/question ... he-default
https://askubuntu.com/questions/66533/h ... tion-files

gkreidl
Posts: 5911
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany

Re: GStreamer and omx encoding from live source.. a naive problem

Mon Feb 12, 2018 6:29 pm

ShiftPlusOne wrote:
Mon Feb 12, 2018 6:16 pm
Sure, that makes sense then. Debian errs on the side of caution when it comes to /etc and preserves the changes that the user makes. By removing the file, you've told dpkg that you don't want it there. Then when the postinst script tries to make that the default gst conf, it rightfully complains.

https://unix.stackexchange.com/question ... he-default
https://askubuntu.com/questions/66533/h ... tion-files
But there is no gstomx.conf after I have deinstalled my package version. I checked it before installing the Foundation packages.
And how can I fix this? I need the Foundation packages for testing.
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5655
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: GStreamer and omx encoding from live source.. a naive problem

Mon Feb 12, 2018 6:41 pm

I don't I can provide better information than what's already linked above. I believe the file you need to fix is/etc/xdg/gstomx-rpi.conf and make sure the update-alternatives system is set up to use it as your gstomx.conf provider.. I can't write up step by step what you need to do because I don't have the same situation in front of me.

ktemby
Posts: 12
Joined: Mon Dec 01, 2014 3:46 am

Re: GStreamer and omx encoding from live source.. a naive problem

Wed Apr 11, 2018 7:48 am

This was a hassle for me too, and if anyone is looking for a more simple workaround for existing systems, you can use this method:

I posted my answer here as well -
https://stackoverflow.com/questions/454 ... 5#49769275

GStreamer Buffer has no PTS Failure Mode
This may not completely solve the problem using GStreamer, but this is a workaround that I'm now using. It involves isolating out the failing component which is the 'mp4mux' element in the gstreamer pipeline.

I'm finding that even a sample video encoding in Gstreamer is currently failing e.g. with the Buffer has no PTS failure mode:

Code: Select all

gst-launch-1.0 videotestsrc num_buffers=300 ! videoconvert ! videoscale ! omxh264enc ! h264parse ! mp4mux ! filesink location=test.mp4

Using Gstreamer for h264 Encoding only.

Removing the mp4mux element allows us to successfully create .h264 files. Particularly handy if you're using a Raspberry Pi omxh264 encoder element.

Code: Select all

gst-launch-1.0 videotestsrc num_buffers=300 ! videoconvert ! videoscale ! omxh264enc ! filesink location=test.h264
Solving the problem of Mixing Audio and Video

Now to convert that into an MP4 (the initial goal) we can use the nice lightweight Gpac MP4box.

Code: Select all

sudo apt-get install gpac

Code: Select all

MP4Box -isma -inter 250 -fps 30.0 -mpeg4 -hint -noprog -add test.h264 test.mp4
Then you can add in your audio as well if needed

Code: Select all

MP4Box -add audio.mp3 test.mp4
Summary
1. GStreamer appears currently broken in Stretch with the No PTS failure mode when using mp4mux element.
2. GStreamer general h264 encoding and piplines are awesome, and working.
3. Using GPac to combine audio into MP4 files is a viable alternative.

horai
Posts: 43
Joined: Fri Apr 21, 2017 2:45 pm

Re: GStreamer and omx encoding from live source.. a naive problem

Sat Sep 01, 2018 9:31 pm

Dear sir,

do you still keep on building OMX packages? Do you mind sharing the deb package with me? I do not want to use repository package.

Thank you
Best regards,
Ivo
gkreidl wrote:
Sun Jan 07, 2018 9:57 am
6by9 wrote:
Fri Jan 05, 2018 5:02 pm
I'm in the middle of something else at the moment. My friendly Raspbian maintainer has built the modules at https://drive.google.com/file/d/14hpi7R ... sp=sharing for testing. When I stuck them on an image it resulted in gst-inspect-1.0 and gst-launch throwing wobblers over something being very wrong, but you're welcome to try them. Use "dpkg -i *.deb" to install them. It may be worth installing gstreamer1.0-omx-rpi via apt-get first to get the dependencies sorted, and PLEASE don't use an important system (I can't get mine back to gst-omx being recognised at all).
gstreamer1.0-omx-rpi_1.10.4-1+rpt3_armhf.deb did not work for me (the functions of the module were not found). I noticed, that the required config file in /etc/xdg was missing. Then I tried to install gstreamer1.0-omx-rpi-config_1.10.4-1+rpt3_armhf.deb hoping to get the config file, but this package threw an error.

I created a Debian package from my working version which I have compiled from source using checkinstall. This version is based on gst-omx 1.10.5 and includes the patch from 6by9 and two more upstream patches. The package is available from
gstreamer1.0-omx-rpi_1.10.5-1+rpi+patches_armhf.deb
The modified source files can be downloaded from
gst-omx-modified-sources.tar.gz

Before you install the package, remove all gstreamer1.0-omx packages you have installed before and remove all gst-omx config files (they may have different names!) from /etc/xdg.

For installation I recommend using gdebi (install gdebi-core), because it will also install all dependencies.

gkreidl
Posts: 5911
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany

Re: GStreamer and omx encoding from live source.. a naive problem

Sun Sep 02, 2018 5:21 am

horai wrote:
Sat Sep 01, 2018 9:31 pm
Dear sir,

do you still keep on building OMX packages? Do you mind sharing the deb package with me? I do not want to use repository package.

Thank you
Best regards,
Ivo
I have compiled one more version: gstreamer1.0-omx-rpi_1.10.5-2+rpi+patches_armhf.deb.
I have not made it available for download as a separate package, but it is part of my rtranscode V4 package:
https://www.raspberrypi.org/forums/view ... 76#p835946
You'll find it inside the installation directory and the modified sources are in the sources directory.
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer

asilvestre
Posts: 2
Joined: Thu Mar 14, 2019 12:26 am

Re: GStreamer and omx encoding from live source.. a naive problem

Thu Mar 14, 2019 12:30 am

Hi,

I really need cutting edge gstreamer releases so I've compiled them myself and I found this issue is not solved upstream.

I assumed this patch would be somewhere in git fork but I haven't found it. Sorry I'm really new here and I don't know how things work internally.

In the end I've adapted the patch to the latest version 1.15 and made a pull request in gstreamer's github.

https://github.com/GStreamer/gst-omx/pull/1

Posting it here in case someone finds it useful.

And by the way thank you a lot to everyone involved I've been wasting so many hours trying to understand why the encoder was failing...

asilvestre
Posts: 2
Joined: Thu Mar 14, 2019 12:26 am

Re: GStreamer and omx encoding from live source.. a naive problem

Thu Mar 14, 2019 9:26 pm

Actually github it's just a mirror I've open it in their gitlab and they have found some potential issues:
https://gitlab.freedesktop.org/gstreame ... equests/15

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6633
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: GStreamer and omx encoding from live source.. a naive problem

Fri Mar 15, 2019 7:38 am

Well I guess you've got them looking at it again. As commented earlier, they have had it open as an issue at https://bugzilla.gnome.org/show_bug.cgi?id=736829 / https://gitlab.freedesktop.org/gstreame ... x/issues/4 since 2014.

If you're using the 4.19 kernel (available via rpi-update) then you can use v4l2h264enc instead. It supports dmabufs which should also be more efficient. It's works on GST 1.14 and above without mods.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

Lich
Posts: 6
Joined: Wed Apr 11, 2018 8:41 pm
Location: Russia

Re: GStreamer and omx encoding from live source.. a naive problem

Thu Apr 11, 2019 10:05 pm

Hello to all.

As I understand it, the gst-omx module from the Raspbian Stretch repository does not work (accordingly, the hardware acceleration of the video does not work).

1. Does gst-omx work in Raspbian Stretch if I compile the packages manually? Which version of gstreamer should I use for it - 1.10.4, 1.10.5 or other?

I found this compilation script: https://github.com/cxphong/Build-gstrea ... r-build.sh

For the "bad" plugin. Flags disable drivers that do not support raspberry hardware accelerator (opengl and others):

Code: Select all

cd gst-plugins-bad
# some extra flags on rpi
./autogen.sh --disable-gtk-doc
export CFLAGS='-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux/'
export LDFLAGS='-L/opt/vc/lib'
./configure CFLAGS='-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux/' LDFLAGS\
[b]--disable-gtk-doc --disable-opengl --enable-gles2 --enable-egl --disable-glx \
--disable-x11 --disable-wayland --enable-dispmanx \
--with-gles2-module-name=/opt/vc/lib/libGLESv2.so \
--with-egl-module-name=/opt/vc/lib/libEGL.so[/b]
make CFLAGS+='-Wno-error -Wno-redundant-decls' LDFLAGS+='-L/opt/vc/lib' -j4

2. If the above method does not help, is there any way to enable hardware acceleration of gstreamer in Raspbian Stretch? Is there an instruction for solving this problem?

3. Does gst-omx work in Raspbian Jessie?

Thank you in advance for your answers!

gkreidl
Posts: 5911
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany

Re: GStreamer and omx encoding from live source.. a naive problem

Fri Apr 12, 2019 6:12 am

gst-omx does work both in Stretch and in Jessie. It is more efficient in Jessie, if you need to scale the video.

What doesn't work, is the video output of gstreamer (at least not for higher resolutions). The gstreamer-bad plugins are compiled against OpenGL. This is replaced by a software version in Default Raspbian. If you enable the experimental GL driver, you may get an output, but it is simply too slow (stop and go effect). I've compiled the bad plugins against OpenGL ES (and also compiled gst-omx after adding the patches from 6by9) and together it could be used to decode and display Video.
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer

Lich
Posts: 6
Joined: Wed Apr 11, 2018 8:41 pm
Location: Russia

Re: GStreamer and omx encoding from live source.. a naive problem

Sat Apr 13, 2019 6:42 pm

Thank you for reply, gkreidl!

At this stage of my project, I only need to display HD video (h264, 1280x720 or 1920x1080) on the screen. Now, when displaying a HD video using a gtreamer, the CPU usage is 80-90%. For example, when playing the same file with the OMX player, CPU usage is 2%.

I cannot use the OpenGL experimental driver, because it does not work stably and the some programs I need are not compatible with it. So I want to compile plugins.

1. What version of gstreamer code are you using for the compilation and from which source?
2. Is it possible to download all compiled files somewhere? To install the package "gstreamer1.0-omx-rpi_-2+rpi+patches_armhf.deb" requires gstreamer version 1.10.5, gstreamer version in Stretch repository is a 1.10.4

Lich
Posts: 6
Joined: Wed Apr 11, 2018 8:41 pm
Location: Russia

Re: GStreamer and omx encoding from live source.. a naive problem

Tue Apr 16, 2019 9:53 pm

Some updates.

The following error occurs when I trying to compile the module according to the instructions from my first post:

Code: Select all

make [5]: enter the directory "/home/pi/gstreamer/gst-plugins-bad-1.10.4/gst-libs/gst/gl/egl"
   CC libgstgl_egl_la-gstglcontext_egl.lo
   CC libgstgl_egl_la-gstgldisplay_egl.lo
In file included from gstglcontext_egl.c: 31: 0:
gstglcontext_egl.h: 66: 37: error: unknown type name ‘EGLAttrib’
        EGLClientBuffer buffer, const EGLAttrib * attrib_list);
                                      ^ ~~~~~~~~
In file included from ../../../../gst-libs/gst/gl/egl/gsteglimage.h:30
                  from gstgldisplay_egl.c: 26:
../../../../gst-libs/gst/gl/egl/gstglcontext_egl.h:66:37: error: unknown type name ‘EGLAttrib’
        EGLClientBuffer buffer, const EGLAttrib * attrib_list);

I tried versions 1.10.4 and 1.10.5 from Raspbian and Gstreamer repositories, it seems that all the necessary libraries are installed.

What could be the problem?


Module gst-omx-1.10.4 is compiled successfully with the following flags:

Code: Select all

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
make CFLAGS+='-Wno-error -Wno-redundant-decls' LDFLAGS+='-L/opt/vc/lib' -j4

gkreidl
Posts: 5911
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany

Re: GStreamer and omx encoding from live source.. a naive problem

Wed Apr 17, 2019 7:17 am

Compiling gst-omx from source is useless without adding the patches from 6by9.

I have compiled the bad plugins and gst-omx from 1.10.5 source (modified by patches). For everything else I have used the Raspbian packages (1.10.4).

To complile the bad plugins, I have used the following:

Code: Select all

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 -I/opt/vc/include/EGL -I/opt/vc/include/GLES -I/opt/vc/include/GLES2' CPPFLAGS='-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/EGL -I/opt/vc/include/GLES -I/opt/vc/include/GLES2'

./autogen.sh --disable-gtk-doc --disable-examples --disable-x11 --disable-glx --disable-opengl --enable-dispmanx --enable-introspection=yes --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib/arm-linux-gnueabihf

make CFLAGS+="-Wno-error -Wno-redundant-decls" CXXFLAGS+="-Wno-redundant-decls" LDFLAGS+="-L/opt/vc/lib -lbrcmGLESv2 -lbrcmEGL" 
For gstreamer-omx I have used:

Code: Select all

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 -I/opt/vc/include/EGL -I/opt/vc/include/GLES -I/opt/vc/include/GLES2' 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 -I/opt/vc/include/EGL -I/opt/vc/include/GLES -I/opt/vc/include/GLES2'

./autogen.sh --disable-gtk-doc --with-omx-target=rpi --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib/arm-linux-gnueabihf --disable-examples --with-omx-header-path=/opt/vc/include/IL --with-omx-struct-packing=4

make CFLAGS+="-Wno-error -Wno-redundant-decls" LDFLAGS+="-L/opt/vc/lib -lbrcmGLESv2 -lbrcmEGL -lbcm_host"
My modified sources contain two or three upstream patches and the patches from 6by9.
Attachments
gst-omx-modified-sources.tar.gz
(25.28 KiB) Downloaded 21 times
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer

Lich
Posts: 6
Joined: Wed Apr 11, 2018 8:41 pm
Location: Russia

Re: GStreamer and omx encoding from live source.. a naive problem

Wed Apr 17, 2019 9:48 pm

gkreidl, thank you very much!

I will try to compile gst-plugins-bad and gst-omx the next few days.I will write about the result. If hardware acceleration works, I will test working with HD video, including streaming video from the IP camera.

Previously I have tried to install your package gstreamer-1.0-omx-rpi_1.10.5-2+rp+patches_armhf.deb (instead of the 1.10.4 from the repository) using gdebi, but it requires the gstreamer 1.10.5.

The next step I will try to combine gstreamer and OpenCV. OpenCV only supports OpenGL (not OpenGL ES), but it seems to work with gstreamer (if this module was enabled during OpenCV installation).


I also found another potential way to enable raspberry hardware acceleration in the gstreamer - MMAL. The gst-mmal and its description is available here: https://github.com/youviewtv/gst-mmal. MMAL is used in VLC (latest update) now to play HD video with raspberry hardware acceleration.

Lich
Posts: 6
Joined: Wed Apr 11, 2018 8:41 pm
Location: Russia

Re: GStreamer and omx encoding from live source.. a naive problem

Sun May 26, 2019 7:55 pm

Hardware acceleration of video is now working on my Raspberry Pi 3 with Raspbian Stretch!

gkreidl, thank you very much!

I compiled the Gstreamer Bad plugin (gst-plugins-bad1.0-1.10.4 from repository) with the flags you wrote above and installed the Gstreamer OMX plugin that you compiled (gstreamer-1.0-omx-rpi_1.10.5-2+rp+patches_armhf.deb).

Some notes for Gstreamer Bad plugin compilation.

1. I used "clean" Raspbian Stretch (version with Desktop) and installed the necessary libraries:

Code: Select all

sudo apt-get install 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

and Gstreamer modules:

Code: Select all

gstreamer1.0-plugins-ugly
gstreamer1.0-tools
libgstreamer1.0-dev

2. I added some flags to ./autogen.sh: --disable-wayland --enable-gles2 --enable-egl with-gles2-module-name=/opt/vc/lib/libbrcmGLESv2.so --with-egl-module-name=/opt/vc/lib/libbrcmEGL.so. Without these changes, glimagesink did not work.

Code: Select all

./autogen.sh --disable-gtk-doc --disable-examples --disable-x11 --disable-glx --disable-opengl --disable-wayland --enable-gles2 --enable-egl --enable-dispmanx --enable-introspection=yes -with-gles2-module-name=/opt/vc/lib/libbrcmGLESv2.so --with-egl-module-name=/opt/vc/lib/libbrcmEGL.so --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib/arm-linux-gnueabihf

3. After compiling, I created the package using the checkinstall. The resulting package (gst-plugins-bad1.0-1.10.4-2) could not be installed using apt-get install or Gdebi, because it overwrites some installed libraries. I installed it using dpkg with the option
--force-overwrite.

Code: Select all

sudo dpkg -i --force-overwrite gstreamer1.0-plugins-bad_1.10.4-2_armhf.deb

My tests with video:

1. videotestsrc

Code: Select all

gst-launch-1.0 --gst-debug-level=3 videotestsrc ! glimagesink 	
gst-launch-1.0 --gst-debug-level=3 videotestsrc ! omxh264enc ! h264parse ! omxh264dec ! glimagesink
2-5% CPU

2. H264 video (from local files)

Code: Select all

gst-launch-1.0 --gst-debug-level=3 filesrc location=/path/h264_test.mp4 ! qtdemux ! h264parse ! omxh264dec ! glimagesink
HD 1280x720 30fps CBR 1..5 Mb/s 2-6% CPU
FHD 1920x1080 30fps CBR 6 Mb/s 5-10% CPU
FHD 1920x1080 30fps CBR 12 Mb/s 7-12% CPU plays with some lags

3. H264 RTSP stream (from IP camera in local net)

Code: Select all

gst-launch-1.0 rtspsrc location='rtsp://ip_adress' latency=300 rtph264depay ! h264parse ! omxh264dec ! glimagesink
HD 1280x720 25fps CBR 1..3 Mb/s 2-7% CPU

Delay is less than when using the VLC player on a PC! It is very cool!


CPU temperature in all cases did not exceed 45 degrees, but I use a fan. Also all tests work in Python 3.


Next, I'll try to compile the OpenCV 4х library to work with Gstreamer. If I succeed, I'll create a new thread in this forum.

Return to “Advanced users”