Voodooalert+x264 Logo
US+UK Flagge DE+AT Flagge
Change language:

x264 benchmark compilation & installation guide for MacOS X on Intel

MacOS X Logo

System prerequisites

To compile and install the x264 benchmark on MacOS X, a set of basic software needs to be present first. This consists mainly of:

The most fundamental tool is XCode, which can be obtained from Apple for free. XCode provides an entire build toolchain including a C/C++ compiler, GNU autoconf and GNU make. The yasm assembler is required to build assembler code paths for Intel CPUs which speed up the code by several factors. yasm will be built from source. The remaining tools should already be there by default.

To get the yasm assembler to work, we will download it from [here], unpack, compile and install it, for this we already need XCode installed. The last command needs root privileges:

With this being successfully completed, the yasm assembler is installed and may be used for the compilation of ffmpeg and x264. What is still missing though is git, which will be used by the installation script for ffmpeg/x264. Since git is available as a MacOS X .dmg package, you can just download and install. Note that this is not necessary for MacOS X 10.9.2 with Apple Xcode 5.1 or any newer systems:

The benchmarking software itself on MacOS X 10.9.2 Mavericks and higher

Since at least MacOS X 10.9.2 with Xcode 5.1 we can compile the benchmarking software the standard way without having to rely on any special helper tools. First, we need to download the libav and x264 source code:

For simplicities sake we shall assume that the files are now in /Users/User/x264src/. Open a terminal and go to that directory, we'll start with libav. Unpack the archive like this: tar -xvf <filename.tar>. After this step, there will be some libav folder which we now change to. Then, run the following commands as root. Note that you may run most steps as a regular user if you're not comfortable running compiler and linker as root, but the last step will require root privileges for installation.

Now libav is installed, we can proceed with linking and compiling x264 itself. First, please unpack it with the command tar -xjvf last_x264.tar.bz2 and change to the newly created x264 subfolder. Before actually being able to start the build we will however need to remove a GCC compiler flag from the configure script, that the newer LLVM+CLANG compiler will not be able to handle. For that, please open the file configure in your favorite text editor and look for the following spot:

  CFLAGS="$CFLAGS -falign-loops=16"

Replace that with the following, effectively removing the -falign-loops=16 option:


After that modification we can go on with the actual build. For that please run the following commands, running at least the last one as root again:

After building x264, you would also need to download the benchmarking script itself and place it in e.g. /Users/User/x264benchmark/ together with the input video, for which you'll find download mirrors at the end of the [benchmark results list]. The script you can get here:

x264 is now installed and ready to work. For actual benchmark execution please skip the next part of the guide for older MacOS X systems and continue with the part "Execution".

The benchmarking software itself on older MacOS X systems

To compile install ffmpeg/ffms and x264 we will use an installation script, that will do most stuff for us automatically. The script for MacOS X can be downloaded here:

After downloading, the script needs to be made executable: chmod +x ./ffms+x264_macosx.sh, after that you can invoke it on the command line. The script will then guide you through the installation step by step, downloading, compiling and installing all required libraries and programs. After this we can prepare the benchmark itself, for instance in a folder /Users/User/x264benchmark, where we could also put the input video file elephantsdream_source.264 and the following script launchbenchmark.sh, which also requires chmod +x ~/x264benchmark/launchbenchmark.sh prior to invocation. Download:


So now the benchmark can be run, so we navigate to the proper directory in the command line, in our case /Users/User/x264benchmark and run the following command:

That might look somewhat like that (click to enlarge):

x264 benchmark on MacOS X
(screen shot is © by [FS03])

After completion, the result can be seen right next to the "Real" string.

Depending on the machine you're sitting on that might take several hours, in extreme cases days, so you'll need a bit of patience there.

[Return to the x264 benchmark results list]

[Comment on this guide]