summaryrefslogtreecommitdiff
path: root/creator/build-ffmpeg
blob: cf4a07ebe00fd4ddd8e334aa451948ad3469f45a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/bin/bash -e
# This script builds a version of ffmpeg that is compatible with
# create-testfiles (support for all relevant codecs, current
# version).

FFMPEGDIR="`mktemp -d /tmp/ffmpegbuildXXXXXX`"
if [ -z "$FFMPEGDIR" ]; then
	echo "If you care about predictable symlink attacks, you should really install mktemp" 1>&2
	FFMPEGDIR="/tmp/ffmpegbuild.$$"
	mkdir -p "$FFMPEGDIR"
fi

SRCDIR="`dirname $0`"
[ "$SRCDIR" = "." ] && SRCDIR="`pwd`"

cd "$FFMPEGDIR"
git clone git://review.webmproject.org/libvpx.git
git clone git://git.videolan.org/x264.git
wget http://downloads.xiph.org/releases/ogg/libogg-1.2.2.tar.gz
wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.2.tar.gz
wget http://downloads.xiph.org/releases/theora/libtheora-1.2.0alpha1.tar.xz
wget http://switch.dl.sourceforge.net/project/lame/lame/3.98.4/lame-3.98.4.tar.gz
wget http://ignum.dl.sourceforge.net/project/faac/faac-src/faac-1.28/faac-1.28.tar.bz2
wget http://garr.dl.sourceforge.net/project/flac/flac-src/flac-1.2.1-src/flac-1.2.1.tar.gz
wget http://ffmpeg.org/releases/ffmpeg-0.8.tar.bz2
tar xf libogg-1.2.2.tar.gz
tar xf libvorbis-1.3.2.tar.gz
tar xf libtheora-1.2.0alpha1.tar.xz
tar xf lame-3.98.4.tar.gz
tar xf faac-1.28.tar.bz2
tar xf flac-1.2.1.tar.gz
tar xf ffmpeg-0.8.tar.bz2

CPUS=`getconf _NPROCESSORS_ONLN`
[ -z "$CPUS" ] && CPUS=`cat /proc/cpuinfo |grep processor |wc -l`
[ -z "$CPUS" ] && CPUS=2

export CFLAGS="-O2 -fomit-frame-pointer -fweb -frename-registers -ffast-math -Wl,-O2 -I\"$FFMPEGDIR\"/include -L\"$FFMPEGDIR\"/lib"
export CXXFLAGS="$CFLAGS"
export LDFLAGS="$CFLAGS"
export PKG_CONFIG_PATH="$FFMPEGDIR"/lib/pkgconfig:"$PKG_CONFIG_PATH"

for i in libvpx x264 libvorbis libogg libtheora lame faac flac; do
	echo $i
	cd $i*
	if [ -d "$SRCDIR"/patches/$i ]; then
		for j in "$SRCDIR"/patches/$i/*; do
			patch -p1 <$j
		done
	fi
	if [ "$i" = "libvpx" ]; then
		FLAGS="--disable-shared"
	elif [ "$i" = "libtheora" ]; then
		FLAGS="--enable-static --disable-shared --disable-spec"
	else
		FLAGS="--enable-static --disable-shared"
	fi
	./configure --prefix="$FFMPEGDIR" $FLAGS
	make -j$CPUS
	make install
	cd ..
done

cd ffmpeg-*
./configure \
	--prefix="$FFMPEGDIR" \
	--enable-static \
	--enable-pthreads \
	--enable-gpl \
	--enable-nonfree \
	--enable-avfilter \
	--enable-libtheora \
	--enable-libvpx \
	--enable-libx264 \
	--enable-libvorbis \
	--enable-libfaac \
	--enable-libmp3lame \
	--extra-cflags="$CFLAGS" \
	--extra-ldflags="$CFLAGS"
make -j$CPUS
make install
cd ..

echo
echo Use
echo FFMPEG=\""$FFMPEGDIR"/bin/ffmpeg\" \""$SRCDIR/create-testfiles"\" YourContent.mp4