[HOW-TO] Compile MPlayer on OSX
I recently managed to compile MPlayer and MEncoder on OSX after several unsuccessful attempts in Linux. It's actually not that hard and so I thought I'd write up a little tutorial.
Why bother, you might ask. Well.. 1st it's makes you feel better, gives you some expirience with *nix and you'll get a faster MPlayer (x264 playback was 20% faster compared to the last official binary release of MplayerOSX). What we gonna need: • The Developer Tools. Grab the latest version off Apple Developer Connection (free registration - recommended) • X11 or FreeType • MPlayer source • ffmpeg source • XviD source (optional) • lame source (optional) • x264 source (optional) I've put the optional stuff for the MEncoder (XviD, lame, x264) at the bottom but those have to be installed first if you want them. 1. Little set-up Everything here will be done with the Terminal. You can find it in Applications > Utilites > Terminal.app You gonna need X11 from Apple for the FreeType library (if you don't already have it or want to obtain it directly). X11 can be found on the OSX installer DVD. First we gonna make a folder for all the sources to be put in. When you open a new Terminal you start in your home folder (/Users/name/) and we create a folder called "Development" right there and open it: Code:
mkdir Development We gonna get the latest CVS version (newest of the new - might be buggy). You can get the latest tarball or release if you prefer. Getting the latest ffmpeg source will bring you the most performance improvements. To get the MPlayer source we create a folder for it and fetch it from the CVS. You first have to log in and when you get asked for a password, just hit enter. After that you get back to the command line and can enter the second cvs command. Code:
mkdir mplayer-src Code:
cvs -d:pserver:anonymous@mplayerhq.hu:/cvsroot/mplayer login Code:
cd .. Code:
cp -R ffmpeg/libavcodec ../mplayer-src/main/ 3. Compiling MPlayer Now we're ready to start compiling. First we change to the MPlayer source directory and start configure with those options: --with-freetype-config=/usr/X11R6/bin/freetype-config (The FreeType library from X11 - read above) --disable-gl (GL doesn't play nice while compiling. Might compile fine but you don't need this anyway) --disable-x11 (dito) But first we specify where pkgconfig is: Code:
export PKG_CONFIG_PATH="/usr/X11R6/lib/pkgconfig/" Now we can start compiling which will take a while: Code:
make Code:
sudo make install 4. Finishing up If you now type "mplayer" in the console there's a good chance that you'll get a "-bash: mplayer: command not found". MPlayer has been installed into /usr/local/bin/ but that folder is not in bash's (Terminal's) default path and so it can't find it. You can either copy mplayer and mencoder from /usr/local/bin/ to /usr/bin/ or add /usr/local/bin/ to your PATH - which is a good idea if you plan to do stuff like this in the future. To do this, we need to create a .bash_profile and a .bashrc file in your home folder (/User/name/ or abbreviated as ~): Code:
cd ~ Code:
. ~/.bashrc Then create the .bashrc file: Code:
nano .bashrc Code:
PATH="$PATH:/usr/local/bin" When you open a new Terminal window, mplayer should now be recognized as a command. You can play a movie by typing "mplayer " and then dragging your movie into the terminal window. 2b: Optional stuff In order to use XviD, Lame and x264 to encode within MEncoder, you need to install them first. You can skip them if you don't need them and you don't have to install all of them. XviD: Create a folder, fetch the source, compile: Code:
cd ~/Development Code:
cvs -d:pserver:anonymous@cvs.xvid.org:/xvid login Code:
cd /usr/local/lib/ Create a folder, fetch source, compile: Code:
cd ~/Development Create a folder, fetch source, compile. x264 uses subversion instead of CVS which isn't installed on OSX by default so got the latest tarball from: ftp://ftp.videolan.org/pub/videolan/x264/snapshots/ and copy it to ~/Development/x264-src Code:
cd ~/Development |
5. Config
Configuration is a pretty personal thing that you can tweak as you like. Add, edit or remove the lines in the config file, found in "~/.mplayer/config". If the config file doesn't exist, you'll have to create it first: Code:
cd ~ Without tweaking subtitles just don't look good in MPlayer but you can get them to look quite pretty. First, you gonna need a suitable ttf font. You can find a set of working ones in /usr/X11R6/lib/X11/fonts/TFF (with an open Finder window hit Command - Shift - G and enter the path above to jump to the directory). I chose Luxi Sans Bold (luxisb.ttf) and added some subtitle settings to make them look better: Code:
ffactor=3 Code:
slang = en Code:
sid = 0 You can choose between Quartz (quartz) and CoreVideo (macosx) output drivers on OSX. CoreVideo is new and hiper technology in Tiger but I didn't notice any significant speed difference. The CoreVideo driver is still experimental and doesn't support video filters so I suggest using the Quartz driver. Code:
vo = quartz If you want to adjust contrast, brightness etc when playing, you have to add the eq2 filter: Code:
vf = eq2 Code:
vf = spp=3 Note: The postprocessing filter produces strange disortions on my mac. You might have more luck... You can also set both filters in a chain: Code:
vf = spp=3,eq2 If you want MPlayer to go fullscreen when opening a movie: Code:
fs = yes Code:
framedrop = yes Code:
cache = 8192 |
Thanks for putting this up--since on OS X CCCP isn't an option, it's nice to see a guide to get MPlayer up and running. I couldn't get the cvs commands to work (it prompted me for a password, then dumped me to the command line without doing anything), but I downloaded the source for MPlayer-1.0pre7try2 from the MPlayer site, and ran the configure and make commands you gave in that directory, and the result is an actually working MPlayer.
Unfortunately, I can't seem to get MPlayer to play nice with softsubs and H.264, which are my two biggest issues with VLC (VLC plays softsubs, but if there's more than one on screen at the same time, it displays them on top of each other, which makes them more than a little hard to read...). I tried specifying the flag for softsubs, and mplayer reports it'll display it, but no subs appear on screen. The subs work fine on a PC running Zoom Player w/ the CCCP pack, so I'm pretty sure it's not the file's fault: Code:
$ ./mplayer -sid 1 '/Volumes/nara/Binchou-tan/Binchou-tan 2.mkv' Code:
$ ./mplayer '/Volumes/nara/Kamichu/Kamichu 6.mkv' |
MPlayer v1.0pre7try2 has broken H.264 support. You have to use a cvs version for playing H.264. Softsubs should work in the limited (but readable ;)) way (no styles etc.) that MPlayer supports them. Did you set up a font for MPlayer? Try the -font option. With freetype support, you should be able to specify a TTF file as the font. If this does help, set the font in your ~/.mplayer/config or where ever the MPlayer config is stored on OS X (Syntax: font=/path/to/a/nice/font.ttf).
As for your cvs problem: When you're asked for a password, just hit enter. There should be no output. Then you enter the second line, which, after a short while, should flood your terminal with lots of stuff. At least, it's that way on linux, but I think that there's no reason for cvs to behave differently on OS X. ;) |
Hmmm...I tried adding the line to my config file, like this:
Code:
# Write your default config options here! Code:
$ ./mplayer -sid 1 '/Volumes/nara/Binchou-tan/Binchou-tan 2.mkv' |
Did you check, whether the subs are displayed? I get that message too, but it works anyway. ;)
MPlayer fonts can be found on the MPlayer download page. Quote:
|
Hmm, excellent tutorial :) A good place to point Mac users who can't use the CCCP yet. (I plan to make a specific mplayer compile for them as soon as I get a Mac or the Intel supporting MacOS is released, seeing as the beta one was a piece o shit.). Posting common compilation breakage and their solutions would be helpful too (forgetting an include directory, some libs, etc).
|
Quote:
Quote:
Code:
Checking for freetype >= 2.0.9 ... no Code:
MacG4:/usr/X11R6/bin suguru$ ls -l freetype-config |
I guess you could compile it from source:
Source: http://prdownloads.sourceforge.net/f...r.bz2?download Code:
cd ~/Development I don't have a Mac, so I couldn't test it, but it should work. :) |
The password for the CVS server is empty, so yu can just hit enter. I forgot to mention this in the tutorial (added).
I also added the config section with my subtitle settings. I didn't have much luck with the OSX ttf fonts but the freetype fonts seem to work good. You can find them in /usr/X11R6/lib/X11/fonts/TTF/ Also check your version of X11 since mplayer needs freetype >= 2.0.9. I've got X11 1.1 XFree86 4.4.0 |
Thanks to everyone for all your help--I ended up downloading fink and using Fink Commander to install Freetype 2.1.3, and now subtitles appear perfectly, not overlapping like VLC :)
Now I just need to get a GUI for it, but looks like fink has skins available in package form as well... |
All times are GMT -5. The time now is 13:41. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.