ffmpeg with libmp3lame & H.264 encoder support
Published on Apr 02, 2017 by Sachin.
How to manually install ffmpeg
with libmp3lame
& H.264 encoder support.
Clone ffmpeg
git clone https://git.ffmpeg.org/ffmpeg.git
Note: You need to install nasm
to compile lame & libx264. On Fedora install using
dnf install nasm -y
For OpenSUSE 15.2
$ sudo zypper install nasm libmp3lame-devel libvpx-devel
Lame encoder
1: BUILD_DIR="$HOME/ffmpeg/ffmpeg_build" 2: cd ffmpeg/ 3: curl -O -L https://downloads.sourceforge.net/project/lame/lame/3.100/lame-3.100.tar.gz 4: tar xzvf lame-3.100.tar.gz 5: cd lame-3.100 6: ./configure --prefix="$BUILD_DIR" --bindir="$HOME/bin" --disable-shared --enable-nasm 7: make 8: make install 9: cd ..
H.264 Encoder
1: git clone --depth 1 https://code.videolan.org/videolan/x264 2: cd x264 3: PKG_CONFIG_PATH="$BUILD_DIR/lib/pkgconfig" ./configure --prefix="$BUILD_DIR" --bindir="$HOME/bin" --enable-static 4: make 5: make install 6: cd ..
Compile and Install ffmpeg
1: PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$BUILD_DIR/lib/pkgconfig" ./configure \ 2: --prefix="$BUILD_DIR" \ 3: --pkg-config-flags="--static" \ 4: --extra-cflags="-I$BUILD_DIR/include" \ 5: --extra-ldflags="-L$BUILD_DIR/lib" \ 6: --extra-libs=-lpthread \ 7: --extra-libs=-lm \ 8: --bindir="$HOME/bin" \ 9: --enable-gpl \ 10: --enable-libmp3lame \ 11: --enable-libx264 \ 12: --enable-nonfree 13: 14: make 15: make install
Here’s the complete script
mkdir -p $HOME/source/ git clone https://git.ffmpeg.org/ffmpeg.git $HOME/source/ffmpeg # cleanup make clean make distclean BUILD_DIR="$HOME/source/ffmpeg/build" curl -O -L https://downloads.sourceforge.net/project/lame/lame/3.100/lame-3.100.tar.gz tar xzvf lame-3.100.tar.gz pushd lame-3.100/ ./configure --prefix="$BUILD_DIR" --bindir="$HOME/bin" --disable-shared --enable-nasm make make install popd -1 git clone --depth 1 https://code.videolan.org/videolan/x264 pushd x264/ PKG_CONFIG_PATH="$BUILD_DIR/lib/pkgconfig" ./configure --prefix="$BUILD_DIR" --bindir="$HOME/bin" --enable-static make make install popd -1 # -------------------------------------------------- # libx264: MP4 encoder # libvpx: WEBM encoder # libfreetype: Text overlay # -------------------------------------------------- PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$BUILD_DIR/lib/pkgconfig" ./configure \ --prefix="$BUILD_DIR" \ --pkg-config-flags="--static" \ --extra-cflags="-I$BUILD_DIR/include" \ --extra-ldflags="-L$BUILD_DIR/lib" \ --extra-libs=-lpthread \ --extra-libs=-lm \ --bindir="$HOME/bin" \ --enable-gpl \ --enable-libmp3lame \ --enable-libx264 \ --enable-libvpx \ --enable-nonfree \ --enable-libfreetype \ --enable-ffplay make make install