Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

RossOliver

macrumors regular
Original poster
Nov 6, 2006
157
0
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.
 

CaptainZap

macrumors regular
Jan 17, 2007
170
0
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.
 

zippyfly

macrumors regular
Mar 22, 2008
141
0
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.
 

RossOliver

macrumors regular
Original poster
Nov 6, 2006
157
0
You can get Xcode free on your install DVD (OS X) or download from Apple iPhone SDK.

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...
 

ChrisA

macrumors G5
Jan 5, 2006
12,917
2,168
Redondo Beach, California
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...

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.
 

RossOliver

macrumors regular
Original poster
Nov 6, 2006
157
0
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.

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....
 

kainjow

Moderator emeritus
Jun 15, 2000
7,958
7
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.
 

RossOliver

macrumors regular
Original poster
Nov 6, 2006
157
0
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.

It's just a project right now, but if it does turn into something others might find useful I will bear that in mind :)
 

RossOliver

macrumors regular
Original poster
Nov 6, 2006
157
0
You can designate a target architecture in the configure file for ffmpeg.

Code:
configure --arch=ppc

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...
 

kainjow

Moderator emeritus
Jun 15, 2000
7,958
7
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.
 

Maury

macrumors 6502
Mar 25, 2008
458
26
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
 

CaptainZap

macrumors regular
Jan 17, 2007
170
0
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.
 

RossOliver

macrumors regular
Original poster
Nov 6, 2006
157
0
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

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:
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.