Sunday, November 20, 2011

Compile mplayer on OS X

Finally, success. My tears of frustration did not short out my kkkkkkeyboard and I ca finally type ut thi simple howto (well, simle for me ayway).

So why compile mplayer? There's a relatively recent binary for Tiger and up available here inside an application wrapper that you can extract if you want to use it from the command line. It's from September 2009, recent enough for pretty much anything now, but it's almost 2012 and 2014 or 2015 are just around the corner, and by then it'll be six years old. So what if nobody steps up and provides a distributable binary for Tiger or PowerPC users? What if it's 2015 and users clinging to Classic and using TenFourFox 147 need an updated binary? Well, you're gonna have to roll your own and here are the basic steps to do it.

First, in order to compile anything, you need to install Xcode. In fact, for this compile specifically, you'll need SVN and Git, too. Specific instructions about this are in two posts back here. Also, you'll need to install Make 3.82 available here.

If you haven't added /usr/local/bin to your path, do it now by editing or creating ~/.bash_profile and adding the line:

. ~/.bashrc
(don't forget both dots).

Then edit or create the file ~/.bashrc with the line:


With this you can call anything installed in /usr/local/bin simply by typing the application name in the command line.

Onto compiling:

On the surface it's just a simple process of downloading the source, running ./configure, make, and sudo make install, but I came across a few hurdles that I'll show you how to get over.

First, create a new folder to download the source into, set that folder to the current directory, and then download the source with these three commands:

mkdir ~/Development

cd ~/Development

svn checkout svn:// mplayer (on one line)

Then you want to run the configuration script like this:

cd mplayer

./configure --enable-menu --with-freetype-config=/usr/X11R6/bin/freetype-config (on one line, the two arguments are for OSD support and require X11 to be installed)

At this point I got a message I wasn't prepared for: No FFmpeg checkout, press enter to download one with git or CTRL+C to abort

When I didn't have Git installed, that was a problem. But after I installed Git and reran the script, I simply pressed enter and continued on. At this point you may get a longer error message that ends with:

git pull failed, (re)move ffmpeg/mp_auto_pull to disable pulling

The solution is to remove "mp_auto_pull" from ~/Development/mplayer/ffmpeg. Then when the ./configure script ends, run make. But there's a bug here. Make 3.80 won't work. You'll get an error, make: *** virtual memory exhausted. Stop. You have to upgrade to Make 3.82.

After installing 3.82, you'll notice the default Make is still 3.80 in /usr/bin. Since I didn't know how to make the new version the default and wasn't sure of the implications of mixing an updated Make with other dev tools, I just invoked it by typing its full path. So after the ./configure script completes, type:

/usr/local/bin/make (this will take awhile)

Then at the conclusion, run:

sudo /usr/local/bin/make install

And that's it! You should have a working binary. To get Truetype subtitles working, you can copy any fontname.ttf file from your /Library/Fonts directory to ~/.mplayer/subfont.ttf like:

cp /Library/Fonts/fontname.ttf ~/.mplayer/subfont.ttf (one line)

The file in your ~/.mplayer folder must be called subfont.ttf.

When I first started this whole mess, I couldn't get it to compile with OSD support. I tried using Macports to install some of the dependencies as described here, and man what a nightmare. Finally I went back to look for a simple explanation and found the ./configure arguments for OSD support here.

And with that I'm gonna watch a movie.


  1. Nice detailed instructions. I'm just wondering what advantages mplayer has over VLC that makes you want to go through all that.

  2. How does this compare to "MPlayer OSX Extended"?

  3. Thanks, got mplayer working in my iBook G4 (OS X 10.4) even though installing xcode etc. felt a bit overkill :)

  4. Advantages over VLC in Tiger: You can use command line arguments for playback that make it much more CPU efficient. Also mplayer has much better frame skipping. Although I hear newer versions of VLC that only run on Leopard are much improved.

    How does this compare to Mplayer OSX Extended? This runs on Tiger which Extended no longer does, and it's just a binary so no GUI, but other than that they have pretty much the same performance.

    Installing Xcode for this one thing is a bit overkill, but it opens up a whole new world of compiling and even writing your own applications.

  5. Oh, I didn't know the latest VLC versions were Leopard only.

    I installed Xcode a few days ago. There are some useful little applications in there - even if you don't want to code. There's even an audio application that lets you set the volume level for the boot up sound (now why isn't that in the OSX Sound preferences??)

    Core Image Fun House is pretty neat too - but the damn thing only saves in .funhouse format.

  6. Why doesn't someone just make a torrent for coreplayer for os x?

  7. This comment has been removed by the author.

  8. This comment has been removed by the author.

  9. Hi, first of all thanks for this great blog.I mentioned it here
    hope you don't mind.
    Since you are compiling this, is there any chance of bringing a "G4" or "G5" optimized build like this one: ?
    It was cool if you could share your work too =)

  10. These compile instructions are machine specific, meaning they're for your machine only so I assume the configure script will optimize it for your specific processor. The optimized build in the Macrumors Forum was a distributable binary, meaning it can be distributed and work on other computers as well. I don't quite know how to make a distributable binary yet, but hopefully I'll get around to it.

  11. I can't get the instructions to work. I constantly have the following error:

    -framework AudioUnit -framework AudioToolbox
    Undefined symbols:
    "_FcFreeTypeQueryFace", referenced from:
    _fontconfig_init in ass_fontconfig.o
    ld: symbol(s) not found
    collect2: ld returned 1 exit status
    make: *** [mplayer] Error 1

    Did you run into such similar problem?

    1. Never saw that problem. Do you have X11 installed? That ./configure line in the instructions "--with-freetype-config=/usr/X11R6/bin/freetype-config" is for OSD support and points to freetype-config in your /usr/X11R6 folder. So if you don't have X11 installed that could be a problem. Also, the line break on my blog might make it look like there is a space in the line, but there are no spaces.

      I'm not sure I mentioned this in the post, but I did this on OS X 10.4.11.

  12. hello, can you help me to fix this error when trying to "make"
    libvo/osx_objc_common.m: In function '-[MPCommonOpenGLView preinit]':
    libvo/osx_objc_common.m:135: error: 'GLint' undeclared (first use in this function)
    libvo/osx_objc_common.m:135: error: (Each undeclared identifier is reported only once
    libvo/osx_objc_common.m:135: error: for each function it appears in.)
    libvo/osx_objc_common.m:135: error: parse error before 'swapInterval'
    libvo/osx_objc_common.m:174: error: 'swapInterval' undeclared (first use in this function)
    Makefile:765: recipe for target 'libvo/osx_objc_common.o' failed
    make: *** [libvo/osx_objc_common.o] Error 1

    1. Maybe it's a GL error. I've seen others use the "--disable-gl --disable-x11" options for ./configure. Maybe you could try that.

  13. Greetings from 2016! My 1.2GHz iBook runs TenFourFox 38 and currently plays videos through VLC or QuickTime, and I'm excited to try mplayer out!

    1. I haven't tried compiling Mplayer in a long time, so your adventures may vary. You can always use the compiled version I linked to in the second paragraph above. Good luck!

  14. I'm fighting the compilation for three days now and no success. Last three releases as well as svn version do not compile at all, version 1.1 compiles only to X11 output, which is horribly slow, because no hardware acceleration at all. I hope I will find a version, that works - but I'm afraid release previous to what I'm trying now is from 2012, so nothing new...

  15. you can get MPlayer 1.2-4.2.1 (C) 2000-2015 MPlayer Team
    via Tigerbrew,
    but it does not help with Https://
    infact, when playing a stream it says

    libavformat version 56.40.101 (internal)
    https protocol not found, recompile FFmpeg with openssl, gnutls,
    or securetransport enabled.