Request for PPC owner to compile ffmpeg

Discussion in 'Mac Programming' started by RossOliver, Mar 25, 2008.

  1. RossOliver macrumors regular

    Nov 6, 2006

    I need a universal binary of ffmpeg with lame support for a program I am writing. I have an intel version compiled, but I can't get a PPC version to compile on my intel mac.

    I'm looking for someone who has access to a PPC mac that wouldn't mind taking a few minutes to compile ffmpeg for me so I can join the two versions with lipo.

    You can grab ffmpeg here:

    And lame here:

    All I need is for lame to be compiled:

    cd to/lame/folder
    sudo make install
    Then ffmpeg with lame support:

    cd to/ffmpeg/folder
    ./configure --enable-libmp3lame --disable-vhook --enable-shared --disable-mmx
    <no need to make install>
    If you could then email the resulting ffmpeg folder in its entirety to mail at developersdigest dot org I would be grateful :)

    Thanks for your time.
  2. iSaint macrumors 603


    May 26, 2004
    South Mississippi y'all, near the water!
    If I had any idea of what you're talking about I might help you. Code is above my head, however.
  3. CaptainZap macrumors regular

    Jan 17, 2007
    If no one beats me to it or finds a way without a PPC, I'll do it for you tomorrow when I'm at school.
  4. RossOliver thread starter macrumors regular

    Nov 6, 2006
    Great, appreciate it :)
  5. zippyfly macrumors regular

    Mar 22, 2008
    Xcode can compile to PPC and x86 targets, no?

    You can get Xcode free on your install DVD (OS X) or download from Apple iPhone SDK.
  6. RossOliver thread starter macrumors regular

    Nov 6, 2006
    Yes XCode can cross-compile, but it doesn't seem to agree with FFMpeg - even compiling it for one architecture in XCode throws numerous errors for me...
  7. ChrisA macrumors G4

    Jan 5, 2006
    Redondo Beach, California
    I would not be at all surprized if ffmpeg was sensitive to the specific version of gcc used. I've got a later version of gcc installed (in addtion to the one that ships with xcode) just for this reason. I've got a Sun SPARC here at the office with three C compilers installed on it. Sounds stupid but with 500,000 lines of code, I'm not fixing it.
  8. RossOliver thread starter macrumors regular

    Nov 6, 2006
    I don't think the reason it doesn't compile in XCode is the GCC version - I compiled it successfully by manually using the same version of GCC that XCode uses... but I'm an XCode rookie so I wouldn't know how to sort XCode to compile it successfully....
  9. kainjow Moderator emeritus


    Jun 15, 2000
    I have compiled ffmpeg many times but my PPC is not working right now :(

    If you're going to be distributing ffmpeg inside another application, you will need to build ffmpeg so it's not using shared libraries of lame. So I think when you build lame you need to add in something like --disabled-shared and the same for ffmpeg. I did this when I installed libfaac and libfaad2 and I was able to successfully run ffmpeg on other computers.
  10. RossOliver thread starter macrumors regular

    Nov 6, 2006
    It's just a project right now, but if it does turn into something others might find useful I will bear that in mind :)
  11. CaptainZap macrumors regular

    Jan 17, 2007
    /sigh... Sorry mate, I can't use sudo since the account isn't an administrator.
  12. RossOliver thread starter macrumors regular

    Nov 6, 2006
    Ah, I feared that might be the case - never mind, thanks for giving it a go...
  13. SC68Cal macrumors 68000

    Feb 23, 2006
    There should be cross compiling options in the configuration files.
  14. RossOliver thread starter macrumors regular

    Nov 6, 2006
    While ffmpeg supports this flag, unfortunately lame doesn't. It does have --build and --host flags, but neither of these seem to support ppc as an option. I've also tried compiling ffmpeg without lame using the flags:

    --arch=ppc --extra-ldflags="-isysroot /Xcode2.5/SDKs/MacOSX10.4u.sdk -arch ppc" --extra-cflags="-isysroot /Xcode2.5/SDKs/MacOSX10.4u.sdk -arch ppc"
    But that just returns a load of errors...
  15. SC68Cal macrumors 68000

    Feb 23, 2006
    Yeah I didn't have much luck either. Total bummer.
  16. kainjow Moderator emeritus


    Jun 15, 2000
    I am able to get lame to compile for PPC using this method:

    1. Configure via
    export CFLAGS="-arch ppc"; ./configure --build=ppc 
    2. Edit the config.h file and change two lines:

    Old: /* #undef HAVE_NASM */
    New: #undef HAVE_NASM
    Old: #define HAVE_XMMINTRIN_H 1
    New: #undef HAVE_XMMINTRIN_H
    Save changes.

    3. Make normally via "make"

    It seems to do the trick. The editing of config.h is required because somehow when you tell it to build for PPC it still thinks NASM exists, which is the x86 assembler. --disable-nasm didn't work to disable that.

    If anyone has any tips to improve this, it'd be great.
  17. Maury macrumors 6502

    Mar 25, 2008
    Ross, I am curious how you are using ffmpeg within XCode. I have a small project that would make good use of ffmpeg, but I am finding it difficult to bring the code into a Cocoa application. Perhaps you have some pointers?

    I can build ffmpeg with ease from the command line, and have had some success using the instructions here:

    to built a x-platform version (I have no idea if it actually works though :) There are some modifications you have to make to the sequence, but nothing too annoying.

    Dragging avcodec, avformat and avutil into my Cocoa project seems to do something useful as well. I then brought in the same headers, but compiling causes complaints in the libavutil header that it wants more headers... which doesn't seem to make sense. Am I misunderstanding the dependancies here? What precisely did you have to include to bring the code into Cocoa?

    My real goal is to put the libraries into a framework, simply to make it easier to bring them into a Cocoa application. Have you had any success along these lines?

  18. CaptainZap macrumors regular

    Jan 17, 2007
    Dunno if this goes against the terms of iSquint or whatever but there is a ffmpeg in its resources that might be PPC but it might not have LAME.
  19. RossOliver thread starter macrumors regular

    Nov 6, 2006
    I think I'm going to give up on this project - falling at the first hurdle is a bit of a discouragement...

    As for getting FFMPEG into XCode, I also had some issues, but the process is:

    Compile FFMPEG (preferably as a universal binary or you will get errors, unless you set your project to be i386 only...)
    Create a new group in your project, something like 'FFMPEG', then right click on the group and add existing files.

    The files you want to add are (presuming you want to use static libs):


    Then you have two choices. The one I would take is to right click on FFMPEG group again and add existing files, navigate to /usr/local/include/ffmpeg and add all the headers.

    Alternatively, if you sudo make install ffmpeg on your machine, you can add a header path pointing to /usr/local/include and check the recursive chechbox.

    You can check it worked by importing avcodec.h into main.c and adding av_register_all(); to your main method. It should compile with one error moaning about not being able to find av_register_all() for PPC, which is expected... to get rid of the error go to your project properties and set the build architecture to i386 only...

    Hope that makes sense :confused:

Share This Page