PDA

View Full Version : Compiling FFmpeg on Mac OS X?


exousir
2008-02-27, 21:35
This is slightly off thread but it regards how you guys have managed to build FFmpeg (trunk) on OS X.

With XCode 3.0 on OS X 10.5.1, I get the dreaded:

i386/cavsdsp_mmx.c:447: error: can't find a register in class
'GENERAL_REGS' while reloading 'asm'
make[1]: *** [i386/cavsdsp_mmx.o] Error 1
make: *** [lib] Error 2

From looking at SVN, I can see you have the ffmpeg libraries precompiled and checked in. I assume this is because you needed to use a different tool chain?

I assume you haven't configured without mmx... Any help would be appreciated!

d4rk
2008-02-28, 07:19
ffmpeg source is checked in here (https://xbmc.svn.sourceforge.net/svnroot/xbmc/branches/linuxport/sources/dvdplayer/ffmpeg). We don't use trunk ffmpeg, but do frequent updates. On OSX, Elan compiled it, not sure if he made changes to get it to compile.

d4rk
2008-02-28, 07:51
This works for me, with trunk ffmpeg (in a terminal, not Xcode)

./configure --prefix=/opt/local/ --enable-liba52 --enable-swscaler --enable-avfilter --disable-mmx --enable-libmp3lame --enable-gpl --extra-cflags="-I/opt/local/include" --extra-ldflags="-L/opt/local/lib"

assuming of course you have all the required dependencies (ports).

exousir
2008-02-28, 18:19
I have been able to compile if I disable mmx, which isn't ideal :sad:

I had a look at the makefile from the XBMC OS X sources and it appears that they are being built with mmx enabled.

I'll keep trying. Any further hints from yourself or Elan would be appreciated.

d4rk
2008-02-28, 19:16
Which Makefile?

Maybe Elan will chip in since he's the one who actually compiled it. I don't know if MMX is enabled or not. Based on r11434, it's possible that it is.

B4tm4n
2008-02-28, 19:20
I used this guide.

http://stephenjungels.com/jungels.net/articles/ffmpeg-howto.html

exousir
2008-02-28, 20:27
Thanks B4tm4n, unfortunately, the guide also disables mmx.

Sorry, I meant the config.mak (referenced by the Makefile) in
linuxport/docs/sources/dvdplayer/ffmpeg/ffmpeg (after untarring) has the following set:

ARCH_X86=yes
ARCH_X86_32=yes
HAVE_MMX=yes
HAVE_SSSE3=yes

Which seems to agree with the following line in the build_xbmc.sh file:

./configure --extra-cflags=-D_XBOX --enable-shared --enable-pp --enable-memalign-hack --enable-gpl --disable-static --disable-vhook --disable-en
coders --enable-swscaler

I have made some progress, in building the object files but build_xbmc.sh can't seem to build the shared library. Although, that might not be too much of a problem, since I'm after static libraries... I'll keep at it.

d4rk
2008-02-28, 20:39
build_xbmc.sh is used for compiling it under Linux, Elan hasn't checked in any ffmpeg source, so he's probably using vanilla trunk with the cabac patch and compiling it with the ./configure script. That config.mak doesn't mean anything for OSX.

P.S. - the cabac patch is purely for optimizing h264 performance and has nothing to do with getting it to compile.

elan
2008-02-28, 20:42
I'm using trunk (or at least close to trunk), with assembly turned on, the cabac patch and the xbmc subtitles patch. I used the Perian project as a starter for how to build the ffmpeg libraries. Building statically was the key.

-elan

dizziness
2008-04-11, 20:40
Xcode 3.1 from the iPhone SDK, static libraries and we have successful ASM finally on 10.5 using SVN-r12787.

I installed all the libraries following loosely: http://devblog.rorcraft.com/2007/8/18/how-to-compile-ffmpeg-on-mac-and-linux (the patches aren't needed. if you bet compiler errors, trying converting text format using pico)

./configure --prefix=/usr --disable-vhook --enable-pthreads --enable-gpl --enable-libfaac --enable-libfaad --enable-libx264 --enable-libmp3lame --enable-libfaac --enable-libfaad --enable-liba52 --enable-libxvid

I successfully built a 64-bit binary too using:
./configure --extra-cflags=-m64 --extra-ldflags=-m64 --arch=x86_64 --prefix=/usr

(The 64-bit version is useless at the moment until I get it to use 32-bit liba52 binaries. I did manage a x264 64-bit library build using "--host=x86_64-darwin" but again, no A52 decoding makes it moot.)

Whoo hoo! A quick benchmark using a h.264/ac3 MKV rip yielded the following benchmark (/usr/bin/ffmpeg -benchmark -i /Volumes/HD/Film/Cars.mkv -f null -an /dev/null):

w/o MMX/SSE: 80 fps
w/ MMX/SSE: 154 fps

This was on a Mac Pro 8x2.8 Xeon.

Good luck!