AnimeSuki Forums

Register Forum Rules FAQ Members List Social Groups Search Today's Posts Mark Forums Read

Go Back   AnimeSuki Forum > Support > Tech Support > Playback Help

Notices

 
 
Thread Tools
Old 2006-01-24, 18:13   Link #1
anime_layer
Senior Member
*Graphic Designer
 
 
Join Date: Feb 2003
Location: Zürich, Switzerland
Send a message via ICQ to anime_layer
[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
2. Get sources

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
Same thing for the ffmpeg source which is actually on the same server:
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
Then we need to copy the things we need from the ffmpeg source over to the MPlayer source (no trailing slash in the first path or you will copy the files and not the folder):
Code:
cp -R ffmpeg/libavcodec ../mplayer-src/main/
cp -R ffmpeg/libavutils ../mplayer-src/main/
cp -R ffmpeg/libavformat ../mplayer-src/main
That's it! Now either install the optional software or proceed directly to compiling MPlayer.

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
You should see a lot of options being auto-set (XviD, Lame and x264 should be recognized automatically - spot them in the list or check the configure.log) and finish with telling you that it succeeded configuring MPlayer.
Now we can start compiling which will take a while:
Code:
make
After compiling stops (hopefully without errors), you can install MPlayer or use/move it where you want.
Code:
sudo make install
(Enter your password - you need to be an administrator)

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
Your terminal window will now be used by the nano text editor. Type in following line:
Code:
. ~/.bashrc
Exit with ctrl-x -> Y -> Enter
Then create the .bashrc file:
Code:
nano .bashrc
And enter following line:
Code:
PATH="$PATH:/usr/local/bin"
Again, exit with ctrl-x, y and enter.
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
On OSX MPlayer doesn't like the xvidcore library so we need to fix it (seems to work):
Code:
cd /usr/local/lib/
sudo ranlib libxvidcore.a
Lame:
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
x264
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
__________________
MPlayer OSX Extended (en) | nimmermehr (de) | sttz (de) | last.fm
Life is a game whose first rule is: This is not a game, this is dead serious.

Last edited by anime_layer; 2006-02-11 at 16:08.
anime_layer is offline  
Old 2006-01-24, 18:22   Link #2
anime_layer
Senior Member
*Graphic Designer
 
 
Join Date: Feb 2003
Location: Zürich, Switzerland
Send a message via ICQ to anime_layer
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
Subtitles:
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
To automatically display subtitles, add following line:
Code:
slang = en
This worked good for me but there are cases when this might not work. You could also try this:
Code:
sid = 0
Video output
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
Filters
If you want to adjust contrast, brightness etc when playing, you have to add the eq2 filter:
Code:
vf = eq2
If you want postprocessing, use spp:
Code:
 vf = spp=3
3 is the quality level. You can set it from 0 (weakest) to 6 (strongest).

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
Misc
If you want MPlayer to go fullscreen when opening a movie:
Code:
fs = yes
On slow macs framedropping works wonders:
Code:
framedrop = yes
Cache is good for reading from CDs or streaming (8MB is a bit much for streaming, though ^^):
Code:
cache = 8192
__________________
MPlayer OSX Extended (en) | nimmermehr (de) | sttz (de) | last.fm
Life is a game whose first rule is: This is not a game, this is dead serious.

Last edited by anime_layer; 2006-02-11 at 16:49.
anime_layer is offline  
Old 2006-02-10, 19:01   Link #3
suguru
京都 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)
Trying to play H.264 mplayer detects it correctly--but promptly crashes.

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.
Aargh...oh well, if you happen to know a fix give me a yell, but thanks for your info in any case. I wish I could use the binary of mplayer for OS X on the mplayer site but it crashes at startup, probably doesn't like OS X 10.3.9.
suguru is offline  
Old 2006-02-10, 20:51   Link #4
Jekyll
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.
Jekyll is offline  
Old 2006-02-11, 02:23   Link #5
suguru
京都 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'
...but mplayer doesn't seem to like it.

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
Guess I'll have to hunt around a little more online, it seems like it only wants to accept a font.desc file for some reason. Is there something else I need to do to enable FreeType?
suguru is offline  
Old 2006-02-11, 08:11   Link #6
Jekyll
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:
Is there something else I need to do to enable FreeType?
As long as you get something like "Checking for freetype >= 2.0.9 ... yes" in your configure output, everything should be fine.
Jekyll is offline  
Old 2006-02-11, 10:10   Link #7
movax
Hosar Sub-God
 
Join Date: Dec 2005
Location: Michigan, USA
Send a message via ICQ to movax Send a message via AIM to movax Send a message via MSN to movax Send a message via Yahoo to movax
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).
movax is offline  
Old 2006-02-11, 15:49   Link #8
suguru
京都 ikitai~
 
 
Join Date: Jan 2004
Location: massugu
Quote:
Originally Posted by movax
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).
Yeah, maybe after fleshing it out a little more the tutorial above would be a good reference to pin for OS X users, since it's very hard to find a good guide to how to compile Mplayer on OS X. There is an mplayer-based application for OS X which puts a GUI around mplayer and doesn't require any compiling, and it does play softsubs, but it crashes on H.264 (hasn't been updated in a while so probably an older version of mplayer). It doesn't show softsubs styled properly, but that seems to be an mplayer limitation--at least it doesn't print them on top of each other like VLC.

Quote:
Originally Posted by Jekyll
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.


As long as you get something like "Checking for freetype >= 2.0.9 ... yes" in your configure output, everything should be fine.
Ah, that would be my problem, from my configure output:
Code:
Checking for freetype >= 2.0.9 ... no
I definitely have X11 installed, and it looks like the freetype-config file is where it should be:

Code:
MacG4:/usr/X11R6/bin suguru$ ls -l freetype-config
-rwxr-xr-x  1 root  wheel  1577 14 Sep  2003 freetype-config
How would I install Freetype if it's missing?
suguru is offline  
Old 2006-02-11, 16:10   Link #9
Jekyll
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
Afterwards the "--with-freetype-config=/usr/X11R6/bin/freetype-config" option for MPlayer's configure should not be needed anymore.

I don't have a Mac, so I couldn't test it, but it should work.
Jekyll is offline  
Old 2006-02-11, 16:53   Link #10
anime_layer
Senior Member
*Graphic Designer
 
 
Join Date: Feb 2003
Location: Zürich, Switzerland
Send a message via ICQ to anime_layer
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
__________________
MPlayer OSX Extended (en) | nimmermehr (de) | sttz (de) | last.fm
Life is a game whose first rule is: This is not a game, this is dead serious.
anime_layer is offline  
Old 2006-02-12, 13:45   Link #11
suguru
京都 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...
suguru is offline  
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 10:10.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
We use Silk.