Back to

Skip to end of metadata
Go to start of metadata

This page explains how to deploy GStreamer along your application. There are different mechanisms, which have been reviewed in Deploying your application. The details for some of the mechanisms are given here, and more options might be added to this documentation in the future.

The recommended tool to create installer packages for Mac OS X is PackageMaker, provided with the XCode developer tools.

Shared GStreamer

This is the easiest way to deploy GStreamer, although most of the time it installs unnecessary files which grow the size of the installer and the target drive free space requirements. Since the SDK might be shared among all applications that use it, though, the extra space requirements are somewhat blurred.

With PackageMaker, simply add the GStreamer SDK  runtime  disk image  (the same one you used to install the runtime in your development machine) inside your installer package and create a post-install script that mounts the disk image and installs the SDK package. You can use the following example, where you should replace $INSTALL_PATH with the path where your installer copied the SDK's disk image files (the /tmp directory is good place to install it as it will be removed at the end of the installation):

Private deployment of GStreamer

You can decide to distribute a private copy of the SDK with your application, although it's not the recommended method. In this case, simply copy the framework to the application's Frameworks folder as defined in the bundle programming guide:

Note that you can have several versions of the SDK, and targeting different architectures, installed in the system. Make sure you only copy the version you need and that you update accordingly the link GStreamer.framework/Version/Current:

Since the SDK will be relocated, you will need to follow the instructions on how to relocate the SDK at the end of this page.

Deploy only necessary files, by manually picking them

On the other side of the spectrum, if you want to reduce the space requirements (and installer size) to the maximum, you can manually choose which GStreamer libraries to deploy. Unfortunately, you are on your own on this road, besides using the object file displaying tool: otool. Being a similar technique to deploying a private copy of the SDK, keep in mind that you should relocate the SDK too, as explained at the end of this page.

Bear also in mind that GStreamer is modular in nature. Plug-ins are loaded depending on the media that is being played, so, if you do not know in advance what files you are going to play, you do not know which plugins and shared libraries you need to deploy.

Deploy only necessary packages, using the provided ones

This will produce a smaller installer than deploying the complete GStreamer SDK, without the added burden of having to manually pick each library. You just need to know which packages your application requires.

 Available packages (Click to expand)
Package nameDependenciesLicensesDescription
base-system JPEG, FreeType, BSD-like, LGPL,
LGPL-2+, LGPL-2.1, LibPNG and MIT
Base system dependencies
gobject-pythonbase-systemLGPLGLib/GObject python bindings
gstreamer-capturebase-system, gstreamer-coreLGPL and LGPL-2+GStreamer plugins for capture
gstreamer-clutterbase-system, gtk+-2.0, gstreamer-coreLGPLGStreamer Clutter support
gstreamer-codecsbase-system, gstreamer-coreBSD, Jasper-2.0, BSD-like, LGPL,
LGPL-2, LGPL-2+, LGPL-2.1 and LGPL-2.1+
GStreamer codecs
gstreamer-codecs-gplbase-system, gstreamer-coreBSD-like, LGPL, LGPL-2+ and LGPL-2.1+GStreamer codecs under the GPL license and/or with patents issues
gstreamer-corebase-systemLGPL and LGPL-2+GStreamer core
gstreamer-dvdbase-system, gstreamer-coreGPL-2+, LGPL and LGPL-2+GStreamer DVD support
gstreamer-effectsbase-system, gstreamer-coreLGPL and LGPL-2+GStreamer effects and instrumentation plugins
gstreamer-networkingbase-system, gstreamer-coreGPL-3, LGPL, LGPL-2+, LGPL-2.1+
and LGPL-3+
GStreamer plugins for network protocols
gstreamer-playbackbase-system, gstreamer-coreLGPL and LGPL-2+GStreamer plugins for playback
gstreamer-pythonbase-system, gobject-python,
LGPL and LGPL-2.1+GStreamer python bindings
gstreamer-systembase-system, gstreamer-coreLGPL, LGPL-2+ and LGPL-2.1+GStreamer system plugins
gstreamer-tutorials LGPLTutorials for GStreamer
gstreamer-visualizersbase-system, gstreamer-coreLGPL and LGPL-2+GStreamer visualization plugins
gtk+-2.0base-systemLGPLGtk toolkit
gtk+-2.0-pythonbase-system, gtk+-2.0LGPL and LGPL-2.1+Gtk python bindings

base-system, gstreamer-clutter,
gtk+-2.0, gstreamer-playback,
gstreamer-core, gstreamer-codecs

LGPLSnappy media player

Get the disk image file with all the packages:

Due to the size of these files, usage of a Download Manager is highly recommended. Take a look at this list if you do not have one installed. If, after downloading, the installer reports itself as corrupt, chances are that the connection ended before the file was complete. A Download Manager will typically re-start the process and fetch the missing parts.

Relocation of the SDK in OS X

In some situations we might need to relocate the SDK, moving it to a different place in the file system, like for instance when we are shipping a private copy of the SDK with our application.

Location of dependent dynamic libraries.

On Darwin operating systems, the dynamic linker doesn't locate dependent dynamic libraries using their leaf name, but instead it uses full paths, which makes it harder to relocate them as explained in the DYNAMIC LIBRARY LOADING section of dyld's man page:

Unlike many other operating systems, Darwin does not locate dependent dynamic libraries via their leaf file name. Instead the full path to each dylib is used (e.g. /usr/lib/libSystem.B.dylib). But there are times when a full path is not appropriate; for instance, may want your binaries to be installable in anywhere on the disk.

We can get the list of paths used by an object file to locate its dependent dynamic libraries using otool:

As you might have already noticed, if we move the SDK to a different folder, it will stop working because the runtime linker won't be able to find gstreamer-0.10 in the previous location /Library/Frameworks/GStreamer.framework/Versions/0.10/x86/lib/libgstreamer-0.10.0.dylib.

This full path is extracted from the dynamic library  install name , a path that is used by the linker to determine its location. The install name of a library can be retrieved with otool too:

Any object file that links to the dynamic library gstreamer-0.10 will use the path /Library/Frameworks/GStreamer.framework/Versions/0.10/x86/lib/libgstreamer-0.10.0.dylib to locate it, as we saw previously with gst-launch-0.10.

Since working exclusively with full paths wouldn't let us install our binaries anywhere in the path, the linker provides a mechanism of string substitution, adding three variables that can be used as a path prefix. At runtime the linker will replace them with the generated path for the prefix. These variables are @executable_path, @loader_path and @rpath, described in depth in the DYNAMIC LIBRARY LOADING section of dyld's man page.

For our purpose we will use the @executable_path variable, which is replaced with a fixed path, the path to the directory containing the main executable: /Applications/ The @loader_path variable can't be used in our scope, because it will be replaced with the path to the directory containing the mach-o binary that loaded the dynamic library, which can vary.

Therefore, in order to relocate the SDK we will need to replace all paths containing /Library/Frameworks/GStreamer.framework/ with @executable_path/../Frameworks/GStreamer.framework/, which can be done using the install_name_tool utility

Relocation of the binaries

As mentioned in the previous section, we can use the install_name_tool in combination with otool to list all paths for dependant dynamic libraries and modify them to use the new location. However the SDK has a huge list of binaries and doing it manually would be a painful task. That's why a simple relocation script is provided which you can find in cerbero's repository (cerbero/tools/ This scripts takes 3 parameters:

  1. directory: the directory to parse looking for binaries
  2. old_prefix: the old prefix we want to change (eg: /Library/Frameworks/GStreamer.framework)
  3. new_prefix: the new prefix we want to use (eg: @executable_path/../Frameworks/GStreamer.framework/)
When looking for binaries to fix, we will run the script in the following directories:

Adjusting environment variables with the new paths

The application also needs to set the following environment variables to help other libraries finding resources in the new path:

  • GST_PLUGIN_SYSTEM_PATH=/Applications/
  • GST_PLUGIN_SCANNER=/Applications/
  • GTK_PATH=/Applications/
  • GIO_EXTRA_MODULES=/Applications/
You can use the following functions: