GStreamer installer for MacOSX   46 comments

Update: the installer described here is known to cause incompatibilities with other OSX applications. The latest version of GSVideo for mac bundles the GStreamer libs inside the library package, so there is no need for a separate install of GStreamer. If you need a system wide installation of GStreamer for OSX, please try out the one provided by David Liu. Or just use macports.

One of the main limitations for a wider adoption of GStreamer on the Mac platform is the lack of a binary package installer. MacPorts certainly offers a great help to get GStreamer compiled from the source packages on OSX, and the Songbird music player has been making significant inroads by adopting GStreamer as its main media core  on the Windows, Linux and OSX platforms (the GStreamer build environment used by Songbird can be browsed online here).

However, a standalone installation package would greatly simplify the deployment of Mac applications that require GStreamer, specially if the GStreamer files (binaries, libraries and headers) are installed in a default OSX location (such as /Library). It is debatable whether GStreamer should be installed globally, or each application should bundle its own GStreamer binaries. However, if the globally installed files can also be used to compile and added into third-party applications, then the installer could indeed serve both strategies (global install vs application-bundled).

With these goals in mind (creating a Mac OSX installer that deploys GStreamer globally in the system but can also be used to build applications bundled with GStreamer) I started putting together a package installer from the files compiled with MacPorts.  I modified the default portfiles available for the gstreamer, gst-plugins-base, gst-plugins-good, gst-plugins-bad, gst-plugins-ugly and gst-ffmpeg to remove dependencies on packages such as gtk and gnome-vfs which significanly increase the size of the resulting compilation, and are not really needed. The modified port files are available here, and can be used by following the steps to create a local macports repository.

I also added an updated version of the osxvideosrc plugin for grabbing video frames from capture devices. The initial version of this plugin was created by Ole André Vadla Ravnås, and later improved by Ali Sabil and Justin Karneges. The source code that I used to compile osxvideosrc is here.

The first “experimental” version of this GStreamer installer is available for download here. Currently, it is only available for OSX Leopard (10.5) on Intel machines. Besides copying the GStreamer binaries, libraries and headers into the /Library/GStreamer folder, it also modifies the file /etc/launchd.conf by adding the following two lines:

setenv DYLD_LIBRARY_PATH “/Library/GStreamer/lib”
setenv GST_PLUGIN_PATH “/Library/GStreamer/lib/gstreamer-0.10”

These changes are required to have applications loading the GStreamer libraries (as explained here). The should also be innocuous, and and so far I haven’t encountered any problem when using this installer. But please let me know of any incompatibility you might find. To uninstall, just delete the folder /Library/GStreamer and edit the file /etc/launchd.conf to remove the setenv lines.

Advertisements

Posted April 3, 2009 by ac in Programming

Tagged with , , , , ,

46 responses to “GStreamer installer for MacOSX

Subscribe to comments with RSS.

  1. Pingback: GSVideo 0.5 released « codeanticode

  2. Great idea !

    Thanks for you job :)

  3. Hi, i have the following error when i try to launch GStreamer:

    $ /Library/GStreamer/bin/gst-launch
    dyld: Library not loaded: /opt/local/lib/libgstreamer-0.10.0.dylib
    Referenced from: /Library/GStreamer/bin/gst-launch-0.10
    Reason: image not found
    Trace/BPT trap

    The env variables are sets:

    $ echo $DYLD_LIBRARY_PATH
    /Library/GStreamer/lib

    $ echo $GST_PLUGIN_PATH
    /Library/GStreamer/lib/gstreamer-0.10

    Any idea ?

    • Yes, I see the problem. For some reason setting the environment variables DYLD_LIBRARY_PATH and GST_PLUGIN_PATH in /etc/launch.conf doesn’t affect the terminal. You can do the following: edit the file .profile (located in your home directory) and add the following two lines:

      export PATH=/Library/GStreamer/bin:$PATH
      export DYLD_LIBRARY_PATH=/Library/GStreamer/lib:$DYLD_LIBRARY_PATH

      Restart the terminal, gst-inspect and gst-launch should work.

  4. I just try to set up an xcode project and try to link it to gstreamer.
    What I have to do to link the gstreamer dylib to an xcode application?

    • I haven’t used gstreamer in XCode, but I think it should be the same as linking any other dynamic library. Apple developers website has info about this topic.

      • Well, I have managed to identyfy the problem.
        The dynamic library was linked but could not load.
        dyld: Library not loaded: /opt/local/lib/libgstreamer-0.10.0.dylib
        ..
        Reason: image not found

        This happens when I start it from within XCode with gdb.
        If I start it from the Terminal with the enviroment variables set, it works.
        So the problem is that the gdb shell has not the enviroment variables set.
        I guess the internal start path of the dylib has to be set correctly as mentioned above.

        Would be cool if you could fix that.
        Anyway… thx for the nice setup!

      • Yes, you are correct. The gstreamer binaries I included in the installer were compiled with macports, which uses /opt/local as the default location for all the files. I have to figure out a way in macports to change the default library path. Thanks for your comments and feedback!

  5. Do you have any idea how if the osxvideosink is working.
    I try to use it from within my application, but I am not sure how to
    use it in my code. What are the header files that need to be included? How to attach it to a existing NSView?

    Thanks in advance!

    • osxvideosink is a plugin, so you don’t need to access it directly, but rather construct a pipeline that uses it.

      The header file you will need to include for sure is .

      For detailed info on how to build your gstreamer app, take a look at the Application Development Manual on the gstreamer website. It comes with many simple examples

      • Well, I understand that I just have to use it in a pipeline.
        But it does not show up in a window. Further I have no idea how to attach it to an existing window ( similar to the XImageSink through the interface XOverlay ).
        Did you get it working? I guess it is broken …

      • I’m using gstreamer through the gstreamer-java bindings. To get the video buffers to the screen, I use the fakesink element and attach a callback function to a handoff event that is called every time a new buffer reaches fakesink. The callback function pulls out the video buffer into the application.

  6. Hmm… messes up a lot of things on my OSX system. Messages like this are not uncommon:

    Exception Type: EXC_BREAKPOINT (SIGTRAP)
    Exception Codes: 0x0000000000000002, 0x0000000000000000
    Crashed Thread: 0

    Dyld Error Message:
    Symbol not found: _iconv_open
    Referenced from: /Applications/Adium.app/Contents/MacOS/../Frameworks/libglib.framework/Versions/2.0.0/libglib
    Expected in: flat namespace

    • I’m sorry to hear. What version of OSX are you using? I have tested it on Leopard many times, and never had a problem.

      However, the only system file that is actually modified by the installer is /etc/launchd.conf. So, in order to completely uninstall this version of gstreamer, removing the following lines from /etc/launchd.conf:

      # The following two lines were added by the Gstreamer-MacBuild installer
      setenv DYLD_LIBRARY_PATH /Library/GStreamer/lib
      setenv GST_PLUGIN_PATH /Library/GStreamer/lib/gstreamer-0.10

      plus deleting the /Library/GStreamer folder should suffice.

  7. Hi. Does anyone know if there are any GStreamer problems on Snow Leopard. I seem to be having problems getting GSVideo working. Have tried the installer from this page and also the MacPorts way but nothing is working for me. Is this a known issue?

    • I compiled and tested the installers on OSX 10.5, so Snow Leopard might need some teaks. From what I read in the macports forum, the latest version of OSX broke a few things in terms of compatibility with gcc, but people are working to fix these issues. I’ll produce a new version of the GStreamer binaries for OSX as soon as possible.

      BTW, what problems do you find when trying to compile GStreamer yourself using macports?

      • I’ve been told by some OSX devs that 10.6/Snow Leopard got rid of the QT api for video. Does the osxvideosrc use that?

      • Yes, the osxvideosrc plugin uses the QT API for video. I’m unsure about the status of this API on Snow Leopard, whether it has been removed, deprecated but still available, etc… I need to investigate this issue more. After a quick search, I found this thread which seems to be somewhat informative. From skimming through it I get the impression that the old API is still available, but you need do a separate install of QT7 (since QT X is the default). Please correct me if I’m wrong or if you have more reliable information.

      • From what I can tell too, the Quicktime API’s are deprecated in favour of QTKit API’s http://developer.apple.com/quicktime/overview.html

      • Yes, seems quite clear:

        “QTKit is a framework for working with QuickTime content. It is the only way to get access to QuickTime’s capture capabilities, and the only way to incorporate QuickTime into 64-bit applications. QTKit Classes map to the QuickTime abstractions of movie, track, media, and so on.”

        I guess this means that a rewrite of osxvideosrc will be needed soon :(

      • The other joy is that QTKit is an objective-c-only library. Makes it a lot harder :( Perhaps a new plugin instead of a rewrite?

      • It fails on some of the libraries. I managed to get gstreamer and gst-plugins-base installed (+ dependancies) but others do not install. For instance, trying gst-ffmpeg ends with “Error: Status 1 encountered during processing.”. Any updates most appreciated.

        As a side-note for anybody who’s scared of command line, there is a GUI wrapper for MacPorts called Porticus (same results either way though as it basically just writes the command for you).

      • Hey phil, thanks for the reference to Porticus. I’ll look soon at the OSX compilation issues and will post my results…

  8. I have problems with the changes to lounchd.conf: it causes XCode to fail on all builds.

    dyld: lazy symbol binding failed: Symbol not found: _iconv_open
    Referenced from: /usr/bin/iconv
    Expected in: /Library/GStreamer/lib/libiconv.2.dylib

    As you can see XCode 3.x looks for libiconv in the wrong place. Any idea how to resolve that?

  9. Ok, i managed to set DYLD_LIBRARY_PATH for Xcode based on step 6 of these instructions:

    http://lists.apple.com/archives/Xcode-users/2009/Apr/msg00395.html

    but using:

    defaults write \
    /Developer/Applications/Xcode.app/Contents/Info \
    LSEnvironment -dict DYLD_LIBRARY_PATH “”

    [… see link for the rest]

    But still it seems undesirable to have to do that ..

    • Thanks for the update. Just as a side note, I heard that there have been improvements in Mac OSX, and that the gstreamer team as even created a
      buildbot for this platform.

  10. hi Andres,

    seems i broke some bindings (though i don’t even know what that means exactly) by using your gstreamer installer on Snow Leopard. i can’t run any Processing sketch, console says:

    [0] “dyld: lazy symbol binding failed: Symbol not found: _iconv_open”
    [1] ” Referenced from: /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Libraries/libnpt.jnilib”
    [2] ” Expected in: /Library/GStreamer/lib/libiconv.2.dylib”
    [3] “”
    [4] “dyld: Symbol not found: _iconv_open”
    [5] ” Referenced from: /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Libraries/libnpt.jnilib”
    [6] ” Expected in: /Library/GStreamer/lib/libiconv.2.dylib”
    [7] “”

    help :)

    • Until a new version of the OSX installer of gstreamer that solves these issues is released, you can disable the one currently installed in your system just by editing the file launchd.conf located inside the folder /etc and adding the character ‘#’ to the beginning of the following two lines:

      setenv DYLD_LIBRARY_PATH “/Library/GStreamer/lib”
      setenv GST_PLUGIN_PATH “/Library/GStreamer/lib/gstreamer-0.10″

      You can use any text editor to do this. The problem seems to be a file of the version of Java that comes with Snow Leopard (libnpt.jnilib) conflict with a particular library I included in the gstreamer installer (libiconv.2.dylib).

      • hello andres. im having the same problem too but i couldnt save the changes to launchd.conf because its read only. how else can i install gstreamer?

      • hi. you can change make the file writable by doing “chmod +w launchd.conf”

  11. Hi

    I am struggling with an installation on OS X 10.6.2. After having successfully installed the macport libraries (I had to reinstall the complete macport since I made an update from 10.5 -> 10.6) and checking out your dmg for the GStreamer installer, I struggled over the same problem as Jakob Penca some comments further up. I then decided to delete the libraries GStreamer installer (/Library/GStreamer) and change the launchd.conf lines to point to the macport installation. now I get the following error inside processing:

    Exception in thread “Animation Thread” java.lang.UnsatisfiedLinkError: Unable to load library ‘gstreamer-0.10’: dlopen(/opt/local/lib/libgstreamer-0.10.dylib, 9): no suitable image found. Did find:
    /opt/local/lib/libgstreamer-0.10.dylib: mach-o, but wrong architecture

    since I made a complete (and I think successfull) install of the libraries, I am a bit at a loss about this error.

    any hints?

    • It seems to me that you successfully removed the gstreamer binaries coming from my installer, so this error seems to be a macports issue.

      Does gstreamer runs properly from the console? Try some simple test pipeline with gst-launch.

  12. after installing, i had trouble with another app (CarbonCopyCloner — rsync crashed with error about libiconv.2.dylib), so i added the default libraries to the path before the custom lib and it seemed to fix the problem and gstreamer still worked. i didn’t try just deleting that line … but i thought i’d post my change in case it helped anyone else.

    setenv DYLD_LIBRARY_PATH /Library/Frameworks:/Network/Library/Frameworks:/Sys-tem/Library/Frameworks /Library/Frameworks:/Network/Library/Frameworks:/System/Library/Frameworks/System/Library/Frameworks:$(HOME)/lib:/usr/local/lib:/lib:/usr/lib:/Library/GStreamer/lib

  13. Pingback: Solving library conflict with the installer of GStreamer for OSX « codeanticode

  14. It looks like I installed gstreamer successfully. gst-launch and gst-inspect have proper input, but my java app chokes when it tries to use gstreamer.
    “java.lang.UnsatisfiedLinkError: Unable to load library ‘gstreamer-0.10’: dlopen(libgstreamer-0.10.dylib, 1): no suitable image found. Did find:
    /Library/GStreamer/lib/libgstreamer-0.10.dylib: mach-o, but wrong architecture”

    It looks like gstreamer is the correct architecture. I am in a real bind. Any help would be greatly appreciated.

    lipo -detailed_info /Library/GStreamer/lib/libgstreamer-0.10.dylib
    input file /Library/GStreamer/lib/libgstreamer-0.10.dylib is not a fat file
    Non-fat file: /Library/GStreamer/lib/libgstreamer-0.10.dylib is architecture: i386

    • I forgot to hit notify for followup comments. sorry about the spam! thanks again for any suggestions.

    • I managed to solve my own problem.

      #1 Add the following to .profile or .bashrc for use with MacPorts. /etc/launchd.conf is modified by the install script to include environment variables for gstreamer, but it appears these variables were not successfully set.

      export PATH=/opt/local/bin:/opt/local/sbin:$PATH
      export PATH=”/Library/GStreamer/bin:$PATH”
      export DYLD_LIBRARY_PATH=”/Library/GStreamer/lib:$DYLD_LIBRARY_PATH”
      export GST_PLUGIN_PATH=”/Library/GStreamer/lib/gstreamer-0.10″

      This solves the issue in which java could not find the gstreamer lib.
      “”java.lang.UnsatisfiedLinkError: Unable to load library ‘gstreamer-0.10’: dlopen(libgstreamer-0.10.dylib, 1): no suitable image found.”

      #2 Go to /Applications/Utilities/Java Preferences and drag Java SE 6 32-bit so that it is on top of Java SE 6 64-bit. This is the preferred order is used by web browsers and java apps to determine the most appropriate version to use. It appears that Matterhorn used 64 bit for gstreamer even though its architecture is 32 bit, and solves the following issue.
      “/Library/GStreamer/lib/libgstreamer-0.10.dylib: mach-o, but wrong architecture”

      Change this in the UI puts java into “mixed mode” rather than its default 64bit mode on Snow Leopard.

      “java version “1.6.0_17″
      Java(TM) SE Runtime Environment (build 1.6.0_17-b04-248-10M3025)
      Java HotSpot(TM) Client VM (build 14.3-b01-101, mixed mode)”

      • Hey, thanks so much for posting these workarounds!

        The reason why the installer doesn’t modify the .profile or .bashrc files is that its main focus was to deploy gstreamer so it could be used from gsvideo. In this case, setting the environmental variables in the launchd.conf file appears to be enough.

        Regarding the 32/64 bits fix, it will very useful for Snow Leopard users.

        Thanks again!

  15. Pingback: GSVideo 0.7 « codeanticode

  16. Hi,

    Thks for this great installer. Works great on snow leopard.

    I’m usually using v4l2src to get frames from my webcam or other video devices. Is there a plugin which does the same for MacOs? I couldn’t find something similar in the list returned by gst-inspect.

    Thks a lot, and keep up the good work :)

  17. Sorry for this second post, if you can add this message to the previous one.
    Is there a plugin to make a screencast? Under linux there is istxImageSrc (provided by Istanbul).

    • I don’t know of any screencast plugin for OSX. This post, although a little bit old, describes a method for screencasting based exclusively on open source tools.

  18. Does anyone know how to delete the GStreamer from Mac OSX 10.6.4 – i unfortunately installed the GStreamer.dmg file from the site, and now I get errors with Processing (PDE). What happens if I delete the GStreamer folder in the Library section? Would it ruin any other running software or damage something?

    • Hi, I was able to reproduce your problem on my Snow Leopard machine. You can safely remove the GStreamer files from /Library/GStreamer (since only my installer puts files in there). You can do it from Finder, or from a terminal by typing the following:

      sudo rm -R /Library/GStreamer

      Also, you should edit the /etc/launchd.conf file and remove the following lines:

      # The following two lines were added by the Gstreamer-MacBuild installer
      setenv DYLD_LIBRARY_PATH /Library/GStreamer/lib
      setenv GST_PLUGIN_PATH /Library/GStreamer/lib/gstreamer-0.10

      Since the /etc folder is not shown by Finder, you can do the editing from the terminal using nano, which is a simple terminal text editor:

      sudo nano /etc/launchd.conf

      Just remove the lines I mentioned above, and then CTRL+O followed by ENTER to save and then CTRL+X to exit.

      I hope this helps.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: