Page 1 of 1

Linking FFMPEG to external libraries

Posted: Thu Dec 22, 2011 4:07 am
by navilor
Note. I have been able to successfully create the basic FFMPEG build using your build environment that you provide via your script on your blog.

I have read the following: because it has some high level information. ... c_id=27171 has info on Mingw32. has information on EPEL.

My build environment is CentOS.

Install EPEL:
rpm -Uvh ... noarch.rpm

Install dependencies (one ore more of these required access to EPEL):
yum install bison flex yasm gcc-c++

I ran your install script from the /opt/ffmpegbuildarea directory

Options that I chose during the install of the build environment:
64bit only
Binutils 2.22
GCC 4.6.2
No static build
Disable NLS
Use C and C++ only
Use all cores

I added the install location of mingw32 to my .bashrc startup script so I could do my build.

[[email protected] ~]$ cat .bashrc
# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc

# User specific aliases and functions
export PATH

After I added that to my .bashrc script I logged out of shell and back in again.

I then did a git for the ffmpeg source:
cd /opt/ffmpegbulidarea/
git clone git://

When that finished up I did the following:
mkdir /opt/ffmpegbuildarea/source
cd /opt/ffmpegbuildarea/source/

I then ran the following:
../ffmpeg/configure \
--enable-gpl \
--enable-version3 \
--enable-nonfree \
--enable-runtime-cpudetect \
--arch=x86 \
--prefix=/opt/ffmpegbuildarea/ffmpeg \
--target-os=mingw32 \
--cross-prefix=x86_64-w64-mingw32- \
--enable-w32threads \
--enable-postproc \

make -j4

Where j4 is the number of CPU cores I chose to use. As I am using VirtualBox I chose to use all four cores it could see.

I now have a basic build of the 64bit FFMPEG and have tested it by making a basic AVI file from an MP4 file that conforms to the MPEG-4 Part 10 (AVC) specification (libx264 and libfaac inside) that I created with an ancient build from here: ... f=1&t=1596

I do see that you have a nice build in your builds location:

But I hope to build it myself.

I have been reading the associated README files but they are not making a lot of sense for me at this time.

Can you please help me to demystify how I can add the following libraries? I have links to each of their locations. I may have some that are unnecessary and may also be missing a few. You will notice that this list looks almost identical to yours with the addition of libfaac

bzip2 1.0.6

rei0r 1.3
git clone git://

opencore-amr 0.1.2
wget ... 1.1.tar.gz

FreeType 2.4.6 ... freetype2/
wget ... 4.6.tar.gz

gsm 1.0.13-3
wget ... rig.tar.gz

LAME 3.98.4
wget ... 8.4.tar.gz


OpenJPEG 1.4
wget ... 1_3.tar.gz

RTMP git-60218d0a
git clone git://

Schroedinger 1.0.10
git clone git://

Speex 1.2rc1
wget ... rc1.tar.gz

Theora 1.1.1
wget ... .1.tar.bz2

Vorbis 1.3.2
wget ... 3.0.tar.gz
wget ... 3.2.tar.gz

libvpx 0.9.7
git clone

XAVS r54
svn co xavs

Xvid 1.3.2
wget ... 3.2.tar.gz

zlib 1.2.5


I have downloaded all of those (and are backed up in a 7zipped tarball) but have less than a clue on how to create the libraries so that FFMPEG can link to them. My working directory currently looks like this:

Code: Select all

[[email protected] ffmpegbuildarea]$ pwd
[[email protected] ffmpegbuildarea]$ ls -al
total 65884
drwxrwxr-x  6 kevin kevin     4096 Dec 21 19:47 .
drwxrwxrwx  4 kevin kevin     4096 Dec 20 19:38 ..
-rwxrwxrwx  1 kevin kevin    23242 Dec 20 19:40
drwxr-xr-x 18 kevin kevin     4096 Dec 21 19:03 ffmpeg
drwxrwxr-x 22 kevin kevin     4096 Dec 21 18:27 libs
-rw-rw-r--  1 kevin kevin 67334891 Dec 21 18:32 libs.tar.7z
drwxrwxr-x  9 kevin kevin     4096 Dec 20 20:57 mingw-w64-x86_64
drwxrwxr-x 10 kevin kevin     4096 Dec 20 21:11 source
[[email protected] ffmpegbuildarea]$ 

Please direct me to any documentation that I have missed so that I do not waste your time.

Re: Linking FFMPEG to external libraries

Posted: Thu Jan 19, 2012 5:05 am
by Zeranoe
You need to compile the libs with the cross toolchain (MinGW-w64).

Run ./configure --help on each of the packages, and make mingw-w64 the --host.

Include --disable-shared --enable-static unless you want to include .dll files for every one of the libs in the final FFmpeg build.

Each package has a little different ./configure or way to compile, so ask questions on specific things.