Customize GStreamer build with only the features needed for your application

Thanks to a partnership between Collabora and Huawei is now possible to build Gstreamer with just the features required for a specific application, reducing the binary size for space-constrained embedded systems.

Gstreamer is a very popular open-source multimedia framework used in a wide variety of projects and products, and with an impressive number of features spread over 30 libraries and more than 1600 elements in 230 plugins. This is not a problem on desktop PC and most smartphones, but the size of the binary may be too large for some systems, and until recently it was no easy way to customize GStreamer build for a specific application. But Collabora changed the code to allow gst-build to generate a minimal GStreamer build.

Gstreamer customizeThe company built upon a new feature from GStreamer 1.18, released in September 2020, that makes it possible to build all of GStreamer into a single shared library named gstreamer-full with all libraries, as well as plugins and other dependencies such as a GLib. The company explains that gst-build already provides options to select the plugins to be built, but by using the gstreamer-full library it’s possible to select exactly which libraries are included in the final library with the -Dgst-full-libraries=. The plugins are then automatically included according to the configuration and the dependencies available. Here’s an example:


The important part is the -Dauto_features=disabled line that disables automatic features selection, and then allows us to select specific features within the selected plugin(s).

All of this is already included in Gstreamer 1.18. So what did Collabora do exactly? They added five new options to Gstreamer menu to provide better granularity namely:

  • gst-full-plugins – Select the plugin you’d like to include. By default, all the plugins will be enabled by the build process, and at least one must be passed to avoid building all.
  • gst-full-elements – Select the element(s) using the plugin1:elt1,elt2;plugin2:elt1 format
  • gst-full-typefind-functions – Select the typefind(s) using the plugin1:tf1,tf2;plugin2:tf1 format
  • gst-full-device-providers – Select the decide-provider(s) using the plugin1:dp1,;dp2;plugin2:dp1 format
  • gst-full-dynamic-types – Select the dynamic-type(s) using the plugin1:dt1,;dt2;plugin2:dt1 format

Element, typefind, device-provider, and dynamic type are all plugin features that are defined in Gstreamer documentation.

To showcase the solution, Collabora first built Gsteamer will all options resulting in a 49.2 MB gstreamer-full static library, following by a tailored build with just three elements namely filesrc,fakesink, andidentity:


That ended up being just 3.2 MB in size, or a 93.5% reduction in size. Not too bad!

You’ll find more details about Collabora implementation in the announcement blog post.

Share this:
FacebookTwitterHacker NewsSlashdotRedditLinkedInPinterestFlipboardMeWeLineEmailShare

Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress

ROCK 5 ITX RK3588 mini-ITX motherboard

2 Replies to “Customize GStreamer build with only the features needed for your application”

  1. Great job! I really like it when software developers take care of disabling features to shrink the final executable. First it’s a sign of respect for their users’ resources. Second it’s the best way to imrpove the software architecture by making parts optional and replaceable, and reducing the overall number of longterm bugs. I know such software tend to cause head scratching for distro maintainers who never know what to enable but it’s always better than having everything forcefully enabled!

Leave a Reply

Your email address will not be published. Required fields are marked *

Boardcon Rockchip and Allwinner SoM and SBC products
Boardcon Rockchip and Allwinner SoM and SBC products