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/launch.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/launch.conf to remove the setenv lines.
25 Comments
Great idea !
Thanks for you job
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.
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!
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 …
Hmm… messes up a lot of things on my OSX system. Messages like this are not uncommon:
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0×0000000000000002, 0×0000000000000000
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:
plus deleting the /Library/GStreamer folder should suffice.
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?
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).
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?
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.
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!
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.
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?
Hey phil, thanks for the reference to Porticus. I’ll look soon at the OSX compilation issues and will post my results…
One Trackback/Pingback
[...] codeanticode art code tech media vis « GStreamer installer for MacOSX [...]