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

x264 benchmark compilation & installation for FreeBSD 9.x

FreeBSD logo

System prerequisites

To be able to compile the x264 benchmark on FreeBSD 9.x a set of basic software needs to be present on the system. To install the required packages we will be using the BSD package manager. Please install the following packages as root as shown below:

Now to the interesting part:

The benchmarking software itself

To be able to use x264, we need the decoder filters from libavcodec (in short libav) and of course the x264 encoder itself, which will be linked against libav during the course of configuration and compilation. Additionally, we need the benchmark input video, download mirrors for that are available at the bottom of the x264 [benchmark results list]. If you like, you may also use ffmpeg/ffms as a replacement for libav.

For simplicities sake, we shall assume, that the files are now placed in /usr/home/user/x264src/. So on the terminal we switch to that directory and start with libav. Please unpack the archive like tar -xzvf <filename.tgz>, after which you will see a new libav subfolder. Change to that new folder, so that you can begin to set the necessary environment variables, for which we shall take the bash shell as a given:

The shell in which you have set those environment variables should stay open from now on. If you do close it accidentally or on purpose, you will need to re-set those variables in a newly opened shell. After that we can continue with modifying the libav configuration script. So we shall open the file configure that you can find in the folder libav has been extracted to with a text editor like nano. The following parts require modification:


Modify those two lines like this:


Additionally to that all calls of sed are to be replaced with gsed and all calls of awk need to be similarily replaced with gawk! After that we can launch the configuration script:

The bzlib and zlib libraries are switched off here as linking x264 against a libav enabled in such a way will not work on FreeBSD 9.x. Those libraries are used for MKV (Matroska container) header compression, which we can just safely forget about. Now we may compile and install:

With that done, we have installed libav and can carry on with x264.

First, let's unpack x264, again in folder /usr/home/user/x264src like: tar -xjvf <x264 archive> and change to the newly created x264 subfolder right afterwards.

Now we need to apply a small trick for x264 which will affect the configure and version.sh scripts. The two have a shebang line pointing at the bash shell, which sits in a different path on FreeBSD though. A simple solution is to just set a system-wide link to the bash, so we don't have to modify the scripts.

Additionally to that we need to modify the configure script to tell it to use the new GCC 4.9 compiler, just like we did for libav before. Search and replace:


Change that line to::


Additionally to that we need to replace all calls of sed with gsed and all calls of awk with gawk, just like for libav, but in all the following scripts: version.sh, config.guess, config.sub, configure!

After that we can configure the source tree and compile as well as install the whole thing:

Now x264 is installed and ready for operation, which may be verified by running x264 --version. If that works and if the binary shows as being linked against libswscale and libavformat, then everything should be in perfect order. Now please download the benchmark script:

Copy the file launchbenchmark.sh into a subfolder dedicated to the benchmark, if you do not have one yet, just create it: mkdir -p /usr/home/user/x264benchmark. Also, you should put the input video elephantsdream_source.264 into that folder.

Now you're ready for launch. Just enter the following command while sitting in the folder /usr/home/user/x264benchmark, having verified that the benchmark script is executable (chmod +x ./launchbenchmark.sh):

That might look like the following screenshot (click for enlargement), the result can be read from the terminal window after completion, just pay attention to the "real" value after it's done:

FreeBSD screenshot
(Wallpaper is © 2002 by Billy Nolen)

Depending on the machine this may take hours, in extreme cases even days, weeks or months. If you have any further questions about building the x264 benchmark on PC-BSD, please do not hesitate to ask in the [corresponding forum thread]. The forum may be german, but if you ask in english, you should still get a response.

[Back to the x264 benchmark results list]

[Comment on this guide]