Compiling FFmpeg with high-performance H.264 (libx264) and VP8/VP9 (libvpx) encoding support on CentOS 6 often encounters dependency version collisions and compilation errors if older library packages remain installed on the host.
1. Removing Conflicting RPM Packages
Before compiling from source, remove older distribution codec libraries to prevent undefined reference linker errors like libx264.c: undefined reference to 'x264_encoder_open_130':
yum remove libvpx libogg libvorbis libtheora libx264 x264 x264-devel x264-libs ffmpeg -y
2. Patching and Compiling faac 1.28
If building the faac AAC encoder, a syntax error occurs in mpeg4ip.h: error: new declaration 'char* strcasestr(const char*, const char*)'. Remove line 126 from ./common/mp4v2/mpeg4ip.h before building:
sed -i '/strcasestr/d' common/mp4v2/mpeg4ip.h
./configure && make && make install
3. Compiling x264 and libvpx
# Build x264
cd x264
./configure --enable-static --enable-shared
make && make install
# Build libvpx
git clone https://chromium.googlesource.com/webm/libvpx
cd libvpx
./configure
make && make install
ldconfig
Once libraries are installed into /usr/local, configure FFmpeg with --enable-gpl --enable-libx264 --enable-libvpx for a fully modern encoding stack.