I finally installed Mac OS X Snow Leopard and managed to do a 64bit compilation using Uoti’s mplayer fork build scripts. I hope this will be useful for anyone running Snow Leopard (note that some of the chunks of this post are taken from my previous one about building on Leopard).
This has been tested on a clean slate install of SL, if you upgraded from Leopard you should reinstall MacPorts and all the ports or install the ports as universal binaries to include the x86_64 version.
1) First you need to install a couple of dependencies. MacPorts automates the building process for the dependencies. Make sure your MacPorts directories are at the start of your path and that you exported the PKG_CONFIG variable correctly. To achieve this your .bash_profile file should look something like this:
export PATH=/opt/local/bin:/opt/local/sbin:${PATH}
export PKG_CONFIG_PATH="/opt/local/lib/pkgconfig"
Install those dependencies:
sudo port install git-core autoconf automake libtool pkgconfig freetype fontconfig libiconv ncurses zlib lzo2
2) Download the build scripts from the git repository:
git clone git://repo.or.cz/mplayer-build.git
To launch the build script you do not use the usual ./configure && make && make install, read the README for more information on how the scripts work.
Download the source code for ffmpeg, libass and mplayer (this is done with the ./init command), and enable multithreading in ffmpeg:
cd mplayer-build ./enable-mt ./init
3) Edit the configuration files.
“common_options”:
--cc=gcc-4.2
“ffmpeg_options”:
--cpu=core2 --arch=x86_64
“mplayer_options”:
--disable-x11 --disable-gl --disable-mencoder --enable-macosx-bundle --enable-macosx-finder --target=x86_64-Darwin
4) Compile using
make
The build script will take care of compiling ffmpeg, libass, mplayer and then linking them together.
After you are done you should find your mplayer executable in the mplayer subdirectory.
5) To use your newly compiled mplayer with the MPlayerOSX Extended GUI:
cd mplayer sudo cp mplayer /Applications/MPlayer\ OSX\ Extended.app/Contents/Resources/External_Binaries/mplayer.app/Contents/MacOS/mplayer
Enjoy your bleeding edge mplayer!
Note that at the moment it is not possible to embed mplayer in the GUI Window; in Preferences->Display you need to choose “As separate window (CoreVideo)” as your video output.
EDIT (26/9/2009): Removed the source code fix from this article, since it has been added on the repository.
EDIT (10/10/2009): As of current release video embed works again.
Jesse said
Hello,
I’m curious why I have this problem on final linking stage:
“_sws_scale_ordered”, referenced from:
_scale in vf_scale.o
_scale in vf_scale.o
_scale in vf_scale.o
_draw_slice in vf_screenshot.o
_put_image in vf_screenshot.o
“_av_fifo_reset”, referenced from:
_reset in ao_coreaudio.o
“_av_fifo_alloc”, referenced from:
_init in ao_coreaudio.o
_init in ao_coreaudio.o
“_av_free_packet”, referenced from:
_demux_lavf_fill_buffer in demux_lavf.o
_demux_lavf_fill_buffer in demux_lavf.o
“_avcodec_decode_video2″, referenced from:
_decode in vd_ffmpeg.o
ld: symbol(s) not found
While I was able to build the mplayer manually without using your python script. But, it’s not using ffmpeg-mt.
It also has the ability to play the video integrated with the GUI.
pigoz said
edit: as you found out you get that linking error when linking against a different version of ffmpeg. To find ffmpeg libraries that might get in the way do a “mdfind libpostproc.a” (you need to do the same with libavcodec, libswscale, etc.) in the Terminal, then you can proceed to delete any ffmpeg libraries outside of the mplayer-build path and the related header files.
Jesse said
Nevermind, it’s because I did installed ffmpeg from MacPorts. It’s caused by linking to the wrong libs.
This is what I used in mplayer_options (other options are the same):
–target=x86_64-Darwin
–disable-x11
–disable-gl
–disable-openal
–disable-mencoder
–enable-apple-remote
–enable-macosx-bundle
–enable-macosx-finder
I’m disabling openal only because I think it would not be used by me.
Besides, if I had to fix something related to sdl, I got build error caused by undeclared SDLK_SLASH.
I’m using MacBook4,1, with:
System Version: Mac OS X 10.6.1 (10B504)
Kernel Version: Darwin 10.0.0
64-bit Kernel and Extensions: No
It’s not booting into 64-bit kernel, because I’m using a MacBook. But, that’s not related to whether I could run 64-bit software or not. My build arch is x86_64.
It’s an upgrade from Leopard.
Thanks for your effort to write those scripts.
Jesse said
*Typo, the options should start with –
Jesse said
Sorry, it seems double dash is not displayed correctly here.
Jesse said
Well, until I figured out why your build is different from manual build. I may have to stick with the manual build. Because, it works with integrated window using CoreVideo.
I’m also using your git repo for manual build. I disabled sdl, openal, liba52, and mp3lib.
I also did not use your patch osx_common.c in this case.
Cavin G. said
It would be super helpful if you to include a how-to on what to do with the source code for ffmpeg, libass and mplayer, and enable multithreading in ffmpeg.Are your instructions all that is needed for them to be installed? Where do you get those source code packages? Do they need to be installed or are they fine in the folder you specified?
Also,it would be helpful for there to be a link to the things you refer to, such as the mplayer compilation readme. http://www.mplayerhq.hu/DOCS/README
Cavin G. said
Oh, also, does one need to download the extended GUI from the link you gave? Or do we just try (and then fail) to use to sudo cp command with nothing else?
You gave really really helpful instructions. But they would be even better if you could be as specific and elementary as possible. :)
Cavin G. said
I decided also, that it might be better using the readme and another source, that on Snow Leopard this might be the best way to use ./configure on SL:
./configure –enable-gui –target=x86_64-Darwin
That is if and only if you’re on a Core 2 Duo Mac or higher, of course.
Cavin G. said
ohohoh! I kind of just got it. You did in fact give a place to dl/install ffmpeg, etc… I was not expecting the ./init to do that. Sorry! Thanks! :D
charmedguy18 said
http://pastebin.com/m336c07a3 :(
Jesse said
You should type – -disable-gl not g”one”
It supposed to mean disabling OpenGL.
charmedguy18 said
Thank you! :D
Jesse said
I’m not sure why his previous post about this works better on my machine than using these build scripts.
There are several sources on mplayer-build that might not be necessary.
Anyway Cavin, you only need MPlayer OS X Extended if you want to use the app to play it. Command line is fine too.
I’m also planning to fork and update the MPlayer OS X Extended, the sources are not up to date, and it’s not utilizing the latest API in SL.
charmedguy18 said
Well I just don’t know how to do subtitles without the GUI.
It turns out, if I don’t run the command to copy the compiled mplayer, then it works perfectly. Otherwise, it gives me an error when I try to open anything. :\
charmedguy18 said
It being OSX Extended
pigoz said
As I wrote at the moment embedding in the window fails. You need to use an external CoreVideo window.
These build scripts are better because they use use the newest libass: if you by chance watch fansubbed anime the newest libass renders subtitles (almost) as good as VSFilter on Windows; this is not true for the libass that comes with mplayer’s source.
To use libass with the CLI just activate it in the config file. My “.mplayer/config” looks like this:
# Write your default config options here
# 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=1:threads=2
charmedguy18 said
Oh I see. Thanks :)
pigoz said
I wouldn’t mind working on a clean GUI using the newest technologies when it makes sense, and objective-c 2.
If you start working on something let me know please. :)
Jesse said
Definitely,
I’m okay with my own build of mplayer for playing most files. ASS works, subtitle works, integrated window with corevideo works.
I’m a bit clueless with mplayer intricacies, so I’ll leave that to you.
I’ll work on MPlayer OS X Extended instead.
charmedguy18 said
Okay so I did that, and I still get an error. :\
http://pastebin.com/m65ee3be
pigoz said
Go to MPlayer OSX Extended Preferences->Audio and disable the bs2b filter, I would need to Google around to find out how to compile mplayer with bs2b support.
charmedguy18 said
Oh okay. Thanks so much for your help it works now. :D
Jesse said
Anyway, I don’t know why they named it as ‘OSX’ instead of OS X just like Mac OS X.
Is it a typo ? Not sure.
charmedguy18 said
Do either of you know if I would be able to make the corevideo window stay on top? When that option is checked in mplayer, it doesn’t apply to the external window.
Also, and this is not a big deal, but if I try to resize the window (which I do often when I’m chatting/watching something) the video stops until I let it go, and then speeds up to the point it would be at had it not stopped.
:)
Jesse said
Sorry, didn’t happened to me.
My player works smoothly. Try the latest version.
charmedguy18 said
I did try the latest version? I mean, I used everything I got here^^. Do I need an updated… something? If so, will you link me? :) Thx
Jesse said
Sorry, I think it doesn’t have anything to do with the extended.
There might have been a difference between my mplayer and yours, which affects the GUI.
I’m uploading my mplayer binary to Dropbox. It will be there soon.
charmedguy18 said
Hey thanks I appreciate it!
Jesse said
http://dl.getdropbox.com/u/1992190/mplayer
There’s no guarantee that it will work on your machine :-)
charmedguy18 said
http://pastebin.com/m5c80f4f0
charmedguy18 said
Do I have to have something extra to play DVDs? Sorry I did say I was new at this, right? haha
charmedguy18 said
Mmk. When I just use the version from the blog entry, I try to run the mplayer command and it says this:
charmedguy18 said
Crap sorry… It says this:
Cavin$ mplayer
-bash: mplayer: command not found
charmedguy18 said
Asked someone, they told me a fix for the command not found thanks. :)
charmedguy18 said
Nevermind I fix it by adding something to the directions above. I did make and then mplayer command wouldn’t work. So then I did sudo make install and it did this:
MacBook-Pro:mplayer-build Cavin$ sudo make install
Password:
make -C mplayer install
if test ! -d /usr/local/bin ; then install -d /usr/local/bin ; fi
if test ! -d /usr/local/etc/mplayer ; then install -d /usr/local/etc/mplayer ; fi
if test ! -d /usr/local/lib ; then install -d /usr/local/lib ; fi
install -m 755 -s mplayer /usr/local/bin
if test ! -d /usr/local/share/man/man1 ; then install -d /usr/local/share/man/man1 ; fi
install -m 644 DOCS/man/en/mplayer.1 /usr/local/share/man/man1/
And now it works! :D
Jesse said
Command not found means that your path to mplayer is not recognized to the environment.
If you want to use my binary, you just have to install aalib from macports.
You can also install other things which is required. Run this to found out:
otool -L /path/to/mplayer
GreenSkye said
what do i do with step 3) edit the configuration files. I type –cc=gcc-4.2
and press enter and it says command not found. I’ve been following this guide by copy/pasting everytime it gives me a prompt. Is there something else I need to do?
This is what I did:
HAL9000:mplayer-build Blue$ –cc=gcc-4.2
-bash: –cc=gcc-4.2: command not found
is there a place I put the config commands?
pigoz said
You have to edit the text files with a text editor (TextEdit is good enough, as well TextMate, vim or emacs) and add the lines I mentioned.
GreenSkye said
text files? how do i open/edit these? sorry I’ve never done command line before
pigoz said
they are files containing text, you will find them in your mplayer-build directory, just right click and open with textedit.
GreenSkye said
I got it to work! Thanks! One quick thing tho. You say that it only works with the “seperate window” option enabled, but in mine it works with both. I installed the .dmg version of Mplayer osx extended before compiling this version, would that make a difference?
pigoz said
Thanks for reporting it; it seems the problem was fixed with the merge of the svnupdate 4 days ago: will update the article accordingly.
rezzo said
Somebody can upload the mplayer ready to use? I want use mkv this Ordered Chapters. thx!
pigoz said
Check the most recent article on this blog :)
rezzo said
Awesome! thanks for the fast reply (=