Request for PPC owner to compile ffmpeg

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

  1. macrumors regular

    Joined:
    Nov 6, 2006
    #1
    Hey,

    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:

    http://ffmpeg.mplayerhq.hu/ffmpeg-checkout-snapshot.tar.bz2

    And lame here:

    http://sourceforge.net/project/down...=surfnet&filename=lame-3.98b6.tar.gz&30044240

    All I need is for lame to be compiled:

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

    Code:
    cd to/ffmpeg/folder
    ./configure --enable-libmp3lame --disable-vhook --enable-shared --disable-mmx
    make
    <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. macrumors 603

    iSaint

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

    Joined:
    Jan 17, 2007
    #3
    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. thread starter macrumors regular

    Joined:
    Nov 6, 2006
    #4
    Great, appreciate it :)
     
  5. macrumors regular

    Joined:
    Mar 22, 2008
    #5
    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. thread starter macrumors regular

    Joined:
    Nov 6, 2006
    #6
    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. macrumors G4

    Joined:
    Jan 5, 2006
    Location:
    Redondo Beach, California
    #7
    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. thread starter macrumors regular

    Joined:
    Nov 6, 2006
    #8
    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. Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #9
    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. thread starter macrumors regular

    Joined:
    Nov 6, 2006
    #10
    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. macrumors regular

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

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

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

    Joined:
    Nov 6, 2006
    #14
    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:

    Code:
    --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. macrumors 68000

    Joined:
    Feb 23, 2006
    #15
    Yeah I didn't have much luck either. Total bummer.
     
  16. Moderator emeritus

    kainjow

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

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

    Code:
    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. macrumors 6502

    Joined:
    Mar 25, 2008
    #17
    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:

    http://developer.apple.com/opensource/buildingopensourceuniversal.html

    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?

    Maury
     
  18. macrumors regular

    Joined:
    Jan 17, 2007
    #18
    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. thread starter macrumors regular

    Joined:
    Nov 6, 2006
    #19
    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):

    ffmpeg/libavcodec/libavcodec.a
    ffmpeg/libavformat/libavformat.a
    ffmpeg/libavutil/libavutil.a

    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