works like this:

# tested with
uname -a
Linux debian 3.16.0-4-686-pae #1 SMP Debian 3.16.7-ckt25-2+deb8u3 (2016-07-02) i686 GNU/Linux
cat /etc/debian_version
8.5

# compile ffmpeg from source
apt-get -y install autoconf automake build-essential libass-dev libfreetype6-dev libsdl1.2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev pkg-config texinfo zlib1g-dev yasm;

mkdir -p /software/ffmpeg/src; # create directorfy for sources

cd /software/ffmpeg/src;

apt-get -y install libfdk-aac-dev; # if you need aac support
apt-get -y install libmp3lame-dev; # if you need lame mp3 encoding support (usually: YES! :-D)
apt-get -y install libx264-dev; # if you need h264 support
apt-get -y install libopus-dev; # ogg support?
apt-get -y install libvpx-dev; # if you need VP8 and VP9 video codec support

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" \
  --pkg-config-flags="--static" \
  --extra-cflags="-I$HOME/ffmpeg_build/include" \
  --extra-ldflags="-L$HOME/ffmpeg_build/lib" \
  --bindir="$HOME/bin" \
  --enable-gpl \
  --enable-libass \
  --enable-libfdk-aac \
  --enable-libfreetype \
  --enable-libmp3lame \
  --enable-libopus \
  --enable-libtheora \
  --enable-libvorbis \
  --enable-libvpx \
  --enable-libx264 \
  --enable-nonfree;

# left out:   --enable-libx265 \

PATH="$HOME/bin:$PATH";
make; # and wait
make install; # install the compiled binaries to the folders they belong
make distclean;
hash -r;
admin