Compile ffmpeg and x264 with --enable-shared
<p>I am trying to compile ffmpeg with shared-library support, because when I compiled it statically it ended up making huge libraries, like <code>libavcodec.a</code> with 75MB in size. Any programs that I compiled against <code>libavcodec</code> was at least 50MB in size. This only happens on my RaspberryPi though, if I do</p>

<p><code>ls -lsth $(which ffmpeg)</code></p>

<p>on my RPI3 I get</p>

<p><code>15M -rwxr-xr-x 1 pi pi 15M Jul 29 21:49 /home/pi/camiocam/cam/binaries/bin//ffmpeg</code></p>

<p>While if I do the same on my macbook I get this output</p>

<p><code>488 -r-xr-xr-x  1 john  admin   242K Jul 26 19:34 /usr/local/Cellar/ffmpeg/3.1.1/bin/ffmpeg</code></p>

<p>To get shared library support I did the following</p>

<pre><code># download and install libx264
cd ~/ffmpeg_build
git clone git://git.videolan.org/x264.git
cd x264
PATH="$HOME/bin:$PATH" ./configure --host=arm-unknown-linux-gnueabi  --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --enable-shared --disable-opencl
# PATH="$HOME/bin:$PATH" make -j 8
# PATH="$HOME/bin:$PATH" make install
# ldconfig
</code></pre>

<p>and ...</p>

<pre><code># to install ffmpeg

cd ~/ffmpeg_sources
wget http://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2
tar xjvf ffmpeg-snapshot.tar.bz2
cd ffmpeg
PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" --arch=armel --target-os=linux --extra-cflags="-I$HOME/ffmpeg_build/include" --enable-pic  --extra-ldflags="-L$HOME/ffmpeg_build/lib" --bindir="$HOME/bin" --enable-gpl --enable-libx264 --enable-nonfree --enable-shared
PATH="$HOME/bin:$PATH" make -j 8
</code></pre>

<p>Which gives this output</p>

<pre><code>License: nonfree and unredistributable
Creating config.mak, config.h, and doc/config.texi...
config.h is unchanged
libavutil/avconfig.h is unchanged
libavcodec/bsf_list.c is unchanged
libavformat/protocol_list.c is unchanged
CC      libavcodec/libx264.o
POD     doc/ffprobe.pod
POD     doc/ffmpeg-all.pod
POD     doc/ffserver-all.pod
POD     doc/ffmpeg.pod
POD     doc/ffprobe-all.pod
POD     doc/ffserver.pod
MAN     doc/ffprobe.1
MAN     doc/ffmpeg.1
MAN     doc/ffserver.1
MAN     doc/ffmpeg-all.1
MAN     doc/ffprobe-all.1
MAN     doc/ffserver-all.1
GEN     libavcodec/libavcodec.ver
LD      libavcodec/libavcodec.so.57
AR      libavcodec/libavcodec.a
LD      libavformat/libavformat.so.57
LD      libavfilter/libavfilter.so.6
LD      libavdevice/libavdevice.so.57
library.mak:102: recipe for target 'libavdevice/libavdevice.so.57' failed
make: *** [libavdevice/libavdevice.so.57] Killed
make: *** Deleting file 'libavdevice/libavdevice.so.57'
</code></pre>

<p>I've tried to add the <code>--enable-pic</code> flag to the ffmpeg configure command but that made no difference.</p>