2006-01-24, 18:13 | Link #1 |
Senior Member
Graphic Designer
|
[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 cd 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 cd mplayer-src Code:
cvs -d:pserver:anonymous@mplayerhq.hu:/cvsroot/mplayer login cvs -z3 -d:pserver:anonymous@mplayerhq.hu:/cvsroot/mplayer co -P main Code:
cd .. mkdir ffmpeg-src cd ffmpeg-src cvs -d:pserver:anonymous@mplayerhq.hu:/cvsroot/ffmpeg login cvs -z3 -d:pserver:anonymous@mplayerhq.hu:/cvsroot/ffmpeg co -P ffmpeg Code:
cp -R ffmpeg/libavcodec ../mplayer-src/main/ cp -R ffmpeg/libavutils ../mplayer-src/main/ cp -R ffmpeg/libavformat ../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/" ./configure --with-freetype-config=/usr/X11R6/bin/freetype-config --disable-gl --disable-x11 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 ~ nano .bash_profile 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 mkdir xvid-src cd xvid-src Code:
cvs -d:pserver:anonymous@cvs.xvid.org:/xvid login cvs -d:pserver:anonymous@cvs.xvid.org:/xvid co xvidcore cd xvidcore/build/generic ./bootstrap.sh ./configure make sudo make install Code:
cd /usr/local/lib/ sudo ranlib libxvidcore.a Create a folder, fetch source, compile: Code:
cd ~/Development mkdir lame-src cd lame-src cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/lame login cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/lame co -P lame cd lame ./configure make sudo make install 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 cd x264-src tar -zjf x264-snapshot-2006XXXX-XXXX.tar.bz2 cd x264-snapshot-2006XXXX-XXXX ./configure make sudo make install
__________________
Last edited by anime_layer; 2006-02-11 at 16:08. |
2006-01-24, 18:22 | Link #2 |
Senior Member
Graphic Designer
|
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 ~ mkdir .mplayer nano config 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 subfont-autoscale=2 subfont-text-scale=4 subfont-blur=1.1 subfont-outline=3 subalign=2 subfont-encoding=unicode subpos=95 font=/usr/X11R6/lib/X11/fonts/TTF/luxisb.ttf 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
__________________
Last edited by anime_layer; 2006-02-11 at 16:49. |
2006-02-10, 19:01 | Link #3 |
京都 ikitai~
Join Date: Jan 2004
Location: massugu
|
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' MPlayer 1.0pre7try2-3.3 (C) 2000-2005 MPlayer Team AltiVec found CPU: PowerPC Playing /Volumes/nara/Binchou-tan/Binchou-tan 2.mkv. [mkv] Track ID 1: video (V_MS/VFW/FOURCC), -vid 0 [mkv] Track ID 2: audio (A_MPEG/L3), -aid 0, -alang jpn [mkv] Track ID 3: subtitles (S_TEXT/ASS), -sid 0, -slang eng [mkv] Track ID 4: subtitles (S_TEXT/UTF8), -sid 1, -slang eng [mkv] Will play video track 1 [mkv] Will play audio track 2 [mkv] Will display subtitle track 4 Matroska file format detected. VIDEO: [DIVX] 640x480 16bpp 29.970 fps 0.0 kbps ( 0.0 kbyte/s) Code:
$ ./mplayer '/Volumes/nara/Kamichu/Kamichu 6.mkv' MPlayer 1.0pre7try2-3.3 (C) 2000-2005 MPlayer Team AltiVec found CPU: PowerPC Playing /Volumes/nara/Kamichu/Kamichu 6.mkv. [mkv] Track ID 1: video (V_MPEG4/ISO/AVC), -vid 0 [mkv] Track ID 2: audio (A_VORBIS), -aid 0, -alang jpn [mkv] Track ID 3: subtitles (S_TEXT/ASS), -sid 0, -slang eng [mkv] Track ID 4: subtitles (S_TEXT/UTF8), -sid 1, -slang eng [mkv] Will play video track 1 [mkv] Will play audio track 2 Matroska file format detected. VIDEO: [1cva] 704x480 24bpp 23.810 fps 0.0 kbps ( 0.0 kbyte/s) ========================================================================== Opening audio decoder: [libvorbis] Ogg/Vorbis audio decoder AUDIO: 48000 Hz, 2 ch, s16be, 128.0 kbit/8.33% (ratio: 16000->192000) Selected audio codec: [vorbis] afm:libvorbis (OggVorbis Audio Decoder) ========================================================================== ========================================================================== Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family Selected video codec: [ffh264] vfm:ffmpeg (FFmpeg H.264) ========================================================================== Checking audio filter chain for 48000Hz/2ch/s16be -> 48000Hz/2ch/s16be... AF_pre: 48000Hz/2ch/s16be AO: [macosx] 44100Hz 2ch floatbe (4 bps) Building audio filter chain for 48000Hz/2ch/s16be -> 44100Hz/2ch/floatbe... Starting playback... [h264 @ 0x4540c8]QP -20 out of range Error while decoding frame! A: 0.4 V: 0.2 A-V: 0.254 ct: 0.000 1/ 1 ??% ??% ??,?% 0 0 MPlayer interrupted by signal 10 in module: decode_video - MPlayer crashed. This shouldn't happen. |
2006-02-10, 20:51 | Link #4 |
Rozen Detective
Join Date: Dec 2005
Location: Germany
Age: 40
|
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. Last edited by Jekyll; 2006-02-10 at 21:22. |
2006-02-11, 02:23 | Link #5 |
京都 ikitai~
Join Date: Jan 2004
Location: massugu
|
Hmmm...I tried adding the line to my config file, like this:
Code:
# Write your default config options here! font='/Users/suguru/Library/Fonts/MS PGothic.ttf' Code:
$ ./mplayer -sid 1 '/Volumes/nara/Binchou-tan/Binchou-tan 2.mkv' MPlayer 1.0pre7try2-3.3 (C) 2000-2005 MPlayer Team AltiVec found CPU: PowerPC /Users/suguru/Library/Fonts/MS PGothic.ttf doesn't look like a font description, ignoring. Cannot load font: /Users/suguru/Library/Fonts/MS PGothic.ttf |
2006-02-11, 08:11 | Link #6 | |
Rozen Detective
Join Date: Dec 2005
Location: Germany
Age: 40
|
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:
|
|
2006-02-11, 10:10 | Link #7 |
Hosar Sub-God
|
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).
|
2006-02-11, 15:49 | Link #8 | ||
京都 ikitai~
Join Date: Jan 2004
Location: massugu
|
Quote:
Quote:
Code:
Checking for freetype >= 2.0.9 ... no Code:
MacG4:/usr/X11R6/bin suguru$ ls -l freetype-config -rwxr-xr-x 1 root wheel 1577 14 Sep 2003 freetype-config |
||
2006-02-11, 16:10 | Link #9 |
Rozen Detective
Join Date: Dec 2005
Location: Germany
Age: 40
|
I guess you could compile it from source:
Source: http://prdownloads.sourceforge.net/f...r.bz2?download Code:
cd ~/Development tar -xjf freetype-2.1.10.tar.bz2 cd freetype-2.1.10 ./configure && make && sudo make install I don't have a Mac, so I couldn't test it, but it should work. |
2006-02-11, 16:53 | Link #10 |
Senior Member
Graphic Designer
|
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
__________________
|
2006-02-12, 13:45 | Link #11 |
京都 ikitai~
Join Date: Jan 2004
Location: massugu
|
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... |
Thread Tools | |
|
|