Thursday, September 25, 2008

Compiling x264 with MP4 support on OS X

I've been wanting to futz around with the internals of a modern video codec, and since H.264 seems like a pretty happening codec, and the x264 project seems pretty awesome, I downloaded their source and tried compiling it on my Mac. I hit a few roadbumps, so here are instructions for anyone else who wants to compile x264 on OS X:

open gpac # lazy-man's untar
git clone git:// x264
cd gpac
find . -name os_net.c | xargs perl -pi -e 's/u_long/unsigned long/g'
make lib
make install-lib

cd ../x264
./configure --enable-mp4-output

Then, to test that everything worked, run this:

./x264 -v -q 20 -o foreman.mp4 foreman_part_qcif.yuv 176x144
open foreman.mp4

If you don't have git installed, you can find a nightly tarball of the x264 source code at Hope this helps someone!


Alex Rudnick said...

The deep question -- what do you think and how do you feel about video codecs? Do you have a particular project in mind?

Graham said...

That's cool, what do you plan to do?

Compression methods and transformation methods go hand in hand.

Mark Luffel said...

I'd like to take two pieces of video and mix the key frames from one with the motion prediction of the other. A sort of separation of declaration and definition ;)