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:
http://ubuntuforums.org/showthread.php?t=786095 because it has some high level information.

https://www.centos.org/modules/newbb/vi ... c_id=27171 has info on Mingw32.

http://wiki.centos.org/AdditionalResources/Repositories has information on EPEL.

My build environment is CentOS.

Install EPEL:
rpm -Uvh http://download.fedora.redhat.com/pub/e ... 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
fi

# User specific aliases and functions
PATH=$PATH:/opt/ffmpegbuildarea/mingw-w64-x86_64/bin
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://source.ffmpeg.org/ffmpeg

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 \
--disable-dxva2

Then:
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:
http://ffmpeg.arrozcru.org/forum/viewto ... f=1&t=1596

I do see that you have a nice build in your builds location:
http://ffmpeg.zeranoe.com/builds/

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
http://www.bzip.org
wget http://www.bzip.org/1.0.6/bzip2-1.0.6.tar.gz

rei0r 1.3 http://frei0r.dyne.org/
git clone git://code.dyne.org/frei0r.git

opencore-amr 0.1.2 http://sourceforge.net/projects/opencore-amr/
wget http://downloads.sourceforge.net/projec ... 1.1.tar.gz

FreeType 2.4.6 http://sourceforge.net/projects/freetyp ... freetype2/
wget http://downloads.sourceforge.net/projec ... 4.6.tar.gz

gsm 1.0.13-3 http://libgsm.sourcearchive.com/
wget http://libgsm.sourcearchive.com/downloa ... rig.tar.gz

LAME 3.98.4 http://sourceforge.net/projects/lame/files/lame/
wget http://downloads.sourceforge.net/projec ... 8.4.tar.gz

Libfaac http://www.audiocoding.com/
http://www.audiocoding.com/downloads.html

OpenJPEG 1.4 http://code.google.com/p/openjpeg/downloads/list
wget http://openjpeg.googlecode.com/files/op ... 1_3.tar.gz

RTMP git-60218d0a http://rtmpdump.mplayerhq.hu/
git clone git://git.ffmpeg.org/rtmpdump

Schroedinger 1.0.10 http://diracvideo.org/
git clone git://diracvideo.org/git/schroedinger.git

Speex 1.2rc1 http://www.speex.org/
wget http://downloads.xiph.org/releases/spee ... rc1.tar.gz

Theora 1.1.1 http://www.theora.org/
wget http://downloads.xiph.org/releases/theo ... .1.tar.bz2

Vorbis 1.3.2 http://www.vorbis.com/
http://xiph.org/downloads/
wget http://downloads.xiph.org/releases/ogg/ ... 3.0.tar.gz
wget http://downloads.xiph.org/releases/vorb ... 3.2.tar.gz

libvpx 0.9.7 http://www.webmproject.org/code/
git clone http://git.chromium.org/webm/libvpx.git

XAVS r54 http://xavs.sourceforge.net/
http://sourceforge.net/projects/xavs/develop
svn co https://xavs.svn.sourceforge.net/svnroot/xavs xavs

Xvid 1.3.2 http://www.xvid.org/
wget http://downloads.xvid.org/downloads/xvi ... 3.2.tar.gz

zlib 1.2.5 http://zlib.net/
wget http://zlib.net/zlib-1.2.5.tar.gz

========================================

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
/opt/ffmpegbuildarea
[[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 envbuild.sh
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.