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 2008-07-06, 16:22   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 (2008 edition)

I've wirtten a guide more than two years ago and just recently I happened to wonder how compiling MPlayer on OSX has developed over that time.

The good news is: Thanks to MacPorts and the MPlayer team, compiling MPlayer on OSX has never been easier.

Here's a guide on how to roll your own personally compiled MPlayer. If you ask yourself why you should bother, well, obviously for kicks but also for a little bit of performance. The 1080p Miyori no Mori encode was stuttering a lot with haque's current build but it runs well enough with my own.

-------------------------------

1. Dependencies

Most of the hot stuff is done in the Terminal. You can find it in Applications > Utilities > Terminal.

To compile anything on OSX, the Developer Tools are needed. The current version (3.0) can be found on the Leopard install dvd or downloaded from Apple (registration required):
http://developer.apple.com/tools/download/

The various dependencies of MPlayer can be conveniently installed using MacPorts. You need to download and install (dmg + pkg installer) MacPorts:
http://www.macports.org/

Note: MacPorts will download and compile all dependencies. The packages can be quite big and take long to compile.

Once MacPorts is installed, open up a Terminal and enter following line to install the basic dependencies (ass subtitles but no additional codec support - enter admin password):
Code:
sudo port install subversion pkgconfig freetype fontconfig libiconv ncurses zlib lzo2
Explanation: We will need subversion in a moment to get the current MPlayer sources. pkgconfig tells mplayer where some our libraries are. freetype, fontconfig and libiconv will be needed for ass subtitles, ncurses is used for terminal output and zlib and lzo2 are compression libraries.

There's also some optional dependencies that can be installed with MacPorts:
Code:
sudo port install xvid x264 lame libtheora libmad faac libcaca libogg libvorbis twolame libdts libdv jpeg libpng libungif
Explanation: Those are all additonal codecs and some are needed only for encoding (like xvid/h264), mplayer has the basic codecs already included with libavcodec.

MPlayer can use binary codecs to play proprietary formats like WMV, RealVideo and QuickTime. To enable those codecs, you will have to download and install the OSX binary codec pack from the MPlayer homepage:
http://www.mplayerhq.hu/design7/dload.html

-------------------------------

2. Compile

Now we can get to compile MPlayer. First, we create a directory and get the sources from svn:
Code:
mkdir ~/dev/
cd ~/dev/
svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer
Now we need to configure our installation:
Code:
cd mplayer
export PKG_CONFIG_PATH="/opt/local/lib/pkgconfig"
./configure --with-extraincdir=/opt/local/include --with-extralibdir=/opt/local/lib --prefix=/opt/mplayer
This will tell the compile script that we have some additonal stuff installed with MacPorts and tells it to install mplayer to /opt/mplayer. The command will print a long list with checks. Everything you want to have in your MPlayer should show up with a "yes" and if configure finishes successfully, it prints a summary at the end.

If everything went fine, we can now go one to compile MPlayer:
Code:
make
This will take some time. Sit back an enjoy.

If no error shows up (there's no "successful" message), we can check if our binary is fine and then proceed to installing (enter admin password):
Code:
./mplayer
sudo make install
Finally, to make the terminal find our build, we need to edit bash's PATH variable:
Code:
nano ~/.profile
Paste following into the terminal, use ctrl-x to exit and confirm to save:
Code:
export PATH="$PATH:/opt/mplayer/bin"
And then reload the profile to apply:
Code:
source ~/.profile
-------------------------------

3. Post-Installation

Now we have our own MPlayer that's usable from the command line. If we want to set some general options, we can do that with a configuration file:
Code:
mkdir ~/.mplayer
nano ~/.mplayer/config
Here's how my config file looks like:
Code:
# Enable ASS subtitles                   
ass=yes
fontconfig=yes
embeddedfonts=yes

# Subtitle languages
slang=en,de,fr

# Faster but unprecise decoding for MPEG2, MPEG4 and h264
lavdopts=fast=yes
-------------------------------

4. GUI

I've created MPlayer OSX Extended with a recent static build of mplayer. You can find out more here:
http://forums.animesuki.com/showthread.php?t=70005

To install your own, copy the "MPlayer OSX Extended" application to your Applications folder and execute following command in a terminal:
Code:
sudo cp /opt/mplayer/bin/mplayer /Applications/MPlayer\ OSX\ Extended.app/Contents/Resources/External_Binaries/mplayer.app/Contents/MacOS/mplayer
__________________
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; 2008-08-31 at 08:13.
anime_layer is offline  
Old 2008-07-09, 15:00   Link #2
Nicholi
King of Hosers
 
Join Date: Dec 2005
Age: 41
Soooooooo many dependencies . Nice to see someone else jump off the deep end with a guide for how to compile mplayer.

I wish it were as easy on Windows.
Nicholi is offline  
Old 2008-07-09, 19:11   Link #3
Epyon9283
Geek
 
 
Join Date: Dec 2005
Location: New Jersey
Age: 40
Send a message via ICQ to Epyon9283 Send a message via AIM to Epyon9283
You don't need to install subversion via macports. I think it's installed by default with the dev tools. I have it in /usr/bin and its in one of the com.apple.* boms in /Library/Receipts/boms/.
Epyon9283 is offline  
Old 2008-07-24, 09:02   Link #4
Discerptor
ANIUE!111
 
 
Join Date: Oct 2006
This is fantastic. Thanks so much for a finally updated GUI. I didn't use MacPorts, but the same principles apply in compiling it all yourself (as I've done in the past). It would appear that this lavdopts option causes weird blockiness after tracking through the file sometimes on all platforms, but that's not something we can really control...

Oh, and Nicholi, there's a thread Kovensky posted on the front page of this forum that provides an easy .exe for having a similar build on Windows.

http://forums.animesuki.com/showthread.php?t=69047

Last edited by Discerptor; 2008-07-24 at 09:27.
Discerptor is offline  
Old 2008-07-24, 18:10   Link #5
TheFluff
Excessively jovial fellow
 
 
Join Date: Dec 2005
Location: ISDB-T
Age: 37
Quote:
Originally Posted by Discerptor View Post
Oh, and Nicholi, there's a thread Kovensky posted on the front page of this forum that provides an easy .exe for having a similar build on Windows.

http://forums.animesuki.com/showthread.php?t=69047
Uh. Nicholi is the one who compiles most CCCP stuff, including the MPlayer builds, and he is also the one who wrote the compilation guide/autocompiling shell script that Kovensky is most likely using. It's a lot more annoying to compile it on windows than it is on mac, hence Nicholi's comment.
__________________
| ffmpegsource
17:43:13 <~deculture> Also, TheFluff, you are so fucking slowpoke.jpg that people think we dropped the DVD's.
17:43:16 <~deculture> nice job, fag!

01:04:41 < Plorkyeran> it was annoying to typeset so it should be annoying to read
TheFluff is offline  
Old 2008-07-25, 02:54   Link #6
Discerptor
ANIUE!111
 
 
Join Date: Oct 2006
Quote:
Originally Posted by TheFluff View Post
Uh. Nicholi is the one who compiles most CCCP stuff, including the MPlayer builds, and he is also the one who wrote the compilation guide/autocompiling shell script that Kovensky is most likely using. It's a lot more annoying to compile it on windows than it is on mac, hence Nicholi's comment.
Well, don't I feel foolish now. Sorry for the misinterpretation, Nicholi. I had no idea.
Discerptor is offline  
Old 2008-07-25, 05:38   Link #7
blueorange
Junior Member
 
Join Date: Jul 2006
OK, so what do I have to do to get mplayer to play MKVs with ordered chapters? Do i have to apply a patch or what? Also, any special commands to make it function?
blueorange is offline  
Old 2008-07-25, 17:08   Link #8
anime_layer
Senior Member
*Graphic Designer
 
 
Join Date: Feb 2003
Location: Zürich, Switzerland
Send a message via ICQ to anime_layer
Well. When I added the ASS and lavdopts option to the GUI I said to myself that the preferences dialog was a bit cluttered and could do with a little reconditioning. Also, there were still a lot of mplayer options unexposed that could be integrated.

So I sat down and remade the preferences dialog. I certainly managed to add a lot of options, I don't know about reducing the clutter.

I'm most proud of integrating screenshots which you can now snap with comman-shift-s. You can even choose if you want the raw frame or with all filters (including ass subtitles). I'm also quite proud of the equalizers, even if they're not interactive. I'd like to make them so but haven't yet found a way to do so.

Here are some screenshots to get you an idea:


The build is not thoroughly tested and there are definitely some rough edges and bugs.
- link removed, see first post for current version -

This build also contains no mplayer build. You have to compile it yourself, following the steps above!

I haven't figured out how to do a static build myself and the existing builds don't yet support -vf-add and -af-add which make compiling the command line a lot easier. If anyone can give me the basic steps to make a static build, then I think I could figure it out by myself.
__________________
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; 2008-07-27 at 17:16.
anime_layer is offline  
Old 2008-07-25, 19:19   Link #9
Discerptor
ANIUE!111
 
 
Join Date: Oct 2006
For some reason, this new GUI broke my MPlayer's ability to read external subtitle files without crashing. Here's the console log:

Spoiler for log:


This happens in any of the VOs, and I don't think I did anything terribly unusual in the preferences... pretty much exactly what's in your except with soft framedrop turned on.

EDIT: Fixed. Well, apparently when I replaced the old MPlayer OSX.app, the MKVs switched to be opened up by VLC by default. And somehow, the fact they open with VLC by default is what broke this. Changing it back in Finder fixed this. I'm not sure exactly how this works, but it seems like an odd bug.

EDIT: Wait, never mind...the problem is still there. This problem isn't there in my standalone (non-GUI) mplayer. Any ideas based on the console message?

Last edited by Discerptor; 2008-07-26 at 18:23.
Discerptor is offline  
Old 2008-07-27, 09:07   Link #10
anime_layer
Senior Member
*Graphic Designer
 
 
Join Date: Feb 2003
Location: Zürich, Switzerland
Send a message via ICQ to anime_layer
@Discerptor
I reproduced the problem. Not sure yet what's the cause, I will look into it.

EDIT: The culprit seems to be fontconfig. If I disable ASS, which implicitly enables fontconfig, external subtitles play fine. Also, if I enable fontconfig when running the command line, mplayer also crashes (the rc2 build though not my own build). Not sure if this is a problem with the fontconfig configuration or an mplayer bug.

EDIT 2: Well, my error was. I got that fixed by adding the fontconfig conf files to the package and now get the same error as you. Seems to be a problem with ass, just using -fontconfig works.
__________________
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; 2008-07-27 at 10:09.
anime_layer is offline  
Old 2008-07-27, 10:08   Link #11
Ryoujin
What?
 
 
Join Date: Nov 2007
Location: The house besides yours
Age: 40
The first GUI linked isn't there anymore, it seems:

Code:
Error: Unkown file: "MPlayer_OSX_GUI-ONLY.zip"
Edit 1: I also installed MacPorts after installing Developer Tools and it kept saying sudo: port: command not found

Edit 2: It seemed I needed to write this in the terminal

Code:
export PATH=$PATH:/opt/local/bin
export MANPATH=$MANPATH:/opt/local/share/man
export INFOPATH=$INFOPATH:/opt/local/share/info
Read it from here http://bparanj.blogspot.com/2007/03/...not-found.html

Edit 3: When I was trying the first port line this came up in the logs, I'm guessing something went wrong:

Code:
Error: Target org.macports.configure returned: configure failure: shell command " cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_devel_ncursesw/work/ncurses-5.6" && ./configure --prefix=/opt/local --enable-widec --disable-rpath --with-shared --without-debug --without-ada --enable-safe-sprintf --enable-sigwinch --mandir=/opt/local/share/man " returned error 1
Command output: Configuring for darwin9.4.0
checking for prefix... /opt/local
checking for gcc... /usr/bin/gcc-4.0
checking for C compiler default output... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for executable suffix... 
checking for object suffix... o
checking whether we are using the GNU C compiler... yes
checking whether /usr/bin/gcc-4.0 accepts -g... yes
checking version of /usr/bin/gcc-4.0... 4.0.1
checking how to run the C preprocessor... /usr/bin/cpp-4.0
checking whether /usr/bin/gcc-4.0 needs -traditional... no
checking whether /usr/bin/gcc-4.0 understands -c and -o together... yes
checking for POSIXized ISC... no
checking for /usr/bin/gcc-4.0 option to accept ANSI C... -DCC_HAS_PROTOS
checking for ldconfig... no
checking if you want to ensure bool is consistent with C++... yes
checking whether we are using the GNU C++ compiler... yes
checking whether /usr/bin/g++-4.0 accepts -g... yes
checking version of g++... 4.0.1
checking if you want to build C++ binding and demo... yes
checking if you want to build with Ada95... no
checking if you want to build programs such as tic... yes
checking if you wish to install curses.h... yes
checking for mawk... (cached) no
checking for gawk... (cached) no
checking for nawk... (cached) no
checking for awk... (cached) no
configure: error: No awk program found

Error: The following dependencies failed to build: apr-util sqlite3 gawk gettext ncurses ncursesw gmake readline cyrus-sasl2 openssl zlib neon serf
Error: Status 1 encountered during processing.

Last edited by Ryoujin; 2008-07-27 at 11:09.
Ryoujin is offline  
Old 2008-07-27, 16:44   Link #12
anime_layer
Senior Member
*Graphic Designer
 
 
Join Date: Feb 2003
Location: Zürich, Switzerland
Send a message via ICQ to anime_layer
@Discerptor
Have you selected a font in the preferences? There's a bug with the encoding selection that produces the iconv error (iconv is used to make encoding conversions). You can deselect the font and it should work and I'll upload a fixed version later.

@Ryoujin
I delted the first gui since it's out of date now.

There seems to have been a problem with your macports installation. The commands you posted set the right environment variables for the current terminal session but you need to set the for all. For this, you need to edit or create your .profile file.
Open a terminal and type:
Code:
nano ~/.profile
Paste the lines above into the view that opens and exit with ctrl-x, and use y to save. Close the window and the port command should work in all new windows from that point.
Maybe this fixes your second problem or else you should try to reinstall macports.
__________________
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 2008-07-27, 16:49   Link #13
Discerptor
ANIUE!111
 
 
Join Date: Oct 2006
Quote:
Originally Posted by anime_layer View Post
@Discerptor
Have you selected a font in the preferences? There's a bug with the encoding selection that produces the iconv error (iconv is used to make encoding conversions). You can deselect the font and it should work and I'll upload a fixed version later.
Perfect, that got it working. Thanks!
Discerptor is offline  
Old 2008-07-27, 17:13   Link #14
anime_layer
Senior Member
*Graphic Designer
 
 
Join Date: Feb 2003
Location: Zürich, Switzerland
Send a message via ICQ to anime_layer
I've rewritten the command line to use only one -vf and -af for all filters since I hope this fixes some problems with the screenshot filter not loading. This way, the gui also works with older mplayer builds.

This version also includes the fontconfig and font encoding fix.

http://files.rubbishchute.net/animes...X_ext-rev3.dmg
I've now included the official rc2 binary with this build so it can be used without an own compile. Though I recommend building oneself for anyone up for the trouble.
__________________
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 2008-07-27, 18:03   Link #15
Discerptor
ANIUE!111
 
 
Join Date: Oct 2006
Whoa, this build REALLY messed up the font size being displayed with the subtitle file in question... as well as an MKV I made using said file. It all became HUGE. I guess I can just adjust the font size down on my own. Did you already delete rev2?

Last edited by Discerptor; 2008-07-27 at 23:45.
Discerptor is offline  
Old 2008-07-27, 18:36   Link #16
Ryoujin
What?
 
 
Join Date: Nov 2007
Location: The house besides yours
Age: 40
Quote:
Originally Posted by anime_layer View Post
@Ryoujin
I delted the first gui since it's out of date now.

There seems to have been a problem with your macports installation. The commands you posted set the right environment variables for the current terminal session but you need to set the for all. For this, you need to edit or create your .profile file.
Open a terminal and type:
Code:
nano ~/.profile
Paste the lines above into the view that opens and exit with ctrl-x, and use y to save. Close the window and the port command should work in all new windows from that point.
Maybe this fixes your second problem or else you should try to reinstall macports.
I'm guessing you mean something like this:

Code:
nano ~/.profile
when the new thing comes up then I write there

Code:
export PATH=$PATH:/opt/local/bin
export MANPATH=$MANPATH:/opt/local/share/man
export INFOPATH=$INFOPATH:/opt/local/share/info
After that I press ctrl-x, y and it asks me File name to Write: /Users/name/.profile

What do I select from there? Would it be Append? How do I press M-A?

Edit: I pressed enter and it seems it goes thru. I'm going to re-run the first port commands and see if it works this time

Code:
sudo port install subversion pkgconfig freetype fontconfig libiconv ncurses zlib lzo2
sudo port install xvid x264 lame libtheora libmad faac libcaca libogg libvorbis twolame libdts libdv jpeg libpng libungif
Edit 2: I got another question, when I run those two port commands I've noticed that it installs stuff that it's not included in the lines (my guess), for example, openssl, cyrus-sas, readline, neon and other random stuff like that. Is that ok?

Edit 3: After running the first port line this came up. Going to do the second one now:

Quote:
Error: Target org.macports.activate returned: Image error: /opt/local/etc/fonts/conf.avail/10-autohint.conf already exists and does not belong to a registered port. Unable to activate port fontconfig.
Error: Status 1 encountered during processing.
Edit 4: I think I'm the only one that can't make this work out I'm trying

Code:
cp /opt/local/mplayer /Applications/MPlayer\ OSX.app/Contents/Resources/External_Binaries/mplayer.app/Contents/MacOS/mplayer
and I get

Code:
cp: /opt/local/mplayer: No such file or directory
By the way, my .profile file has this as the content:

Code:
export PATH="$PATH:/opt/mplayer/bin"
export PATH=$PATH:/opt/local/bin
export MANPATH=$MANPATH:/opt/local/share/man
export INFOPATH=$INFOPATH:/opt/local/share/info

Last edited by Ryoujin; 2008-07-27 at 19:14.
Ryoujin is offline  
Old 2008-07-27, 19:57   Link #17
Nonezumi
Member
 
Join Date: Apr 2007
Glad to see others are working on this - haven't had a chance to spend any quality time working on it for a while now. Good luck with it all
Nonezumi is offline  
Old 2008-07-28, 04:10   Link #18
anime_layer
Senior Member
*Graphic Designer
 
 
Join Date: Feb 2003
Location: Zürich, Switzerland
Send a message via ICQ to anime_layer
@Discerptor
What happens if you disable ass subtitles? And what if you open the file in the command line with "-fontconfig"?
And what type of subtitle file is it? One with some kind of font/size definition or just the bare subtitles?

The rev2 is still here.

@Ryoujin
You have to first clear all errors before you can continue. The last command to copy the mplayer binary into the gui only works after all the steps above have worked.

MacPorts will install all necessary dependencies. So seeing packages getting installed that you didn't explicitly select is normal.

Try to go through "sudo port install name" name by name and see where it fails. Then try to uninstall the port that fails before trying to reinstall it using "sudo port uninstall name".
__________________
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 2008-07-28, 07:56   Link #19
Discerptor
ANIUE!111
 
 
Join Date: Oct 2006
Okay, I've figured out the problem. To answer the questions, though, removing ass in either the GUI or commandline mplayers would make the subtitles revert to their default font. It was a .ass file with the font size, among other details, specified. Anyway, when I have a default subtitle font actually selected in the GUI, it will use this even if a different font is specified in the subtitle file (though it does not have this problem for soft-coded subtitle tracks). This made my font display in Arial Bold, which is a LOT larger than the font I was actually using. Now here's the kicker. If I have the external subtitle file in the same folder as my MKV with the softsubs made from that file, when it's on the softsub track, some letters display the way they're supposed to while others display in the Arial. Weird! The fix for this was simply to have my default subtitle font set to "none." But... at times it won't switch out of Arial even if I set it to none, until I quit and restart MPlayer (perhaps something to do with the fonts cache?). If you'd like, I can send you the subtitle file. It's 60KB in size, and we may want to talk more about the specific subtitle file through private messages.

Last edited by Discerptor; 2008-07-28 at 08:09.
Discerptor is offline  
Old 2008-07-28, 17:49   Link #20
Ryoujin
What?
 
 
Join Date: Nov 2007
Location: The house besides yours
Age: 40
Of all the installs this is the one that seems that is giving issues, even uninstalling doesn't help, it keeps up:

Code:
Error: Target org.macports.activate returned: Image error: /opt/local/etc/fonts/conf.avail/10-autohint.conf already exists and does not belong to a registered port.  Unable to activate port fontconfig.
Error: Status 1 encountered during processing.
COMPUTER:~ USER$ sudo port uninstall fontconfig
--->  Uninstalling fontconfig 2.6.0_0+macosx
COMPUTER:~ USER$ sudo port install fontconfig
--->  Installing fontconfig 2.6.0_0+macosx
--->  Activating fontconfig 2.6.0_0+macosx
Error: Target org.macports.activate returned: Image error: /opt/local/etc/fonts/conf.avail/10-autohint.conf already exists and does not belong to a registered port.  Unable to activate port fontconfig.
Error: Status 1 encountered during processing.
Ryoujin is offline  
 

Tags
wiki candidate

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 14:36.


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