Skip to content

Instantly share code, notes, and snippets.

@felipecsl
Last active December 19, 2024 13:45
Show Gist options
  • Save felipecsl/cecfece3075312174e92592d4231e971 to your computer and use it in GitHub Desktop.
Save felipecsl/cecfece3075312174e92592d4231e971 to your computer and use it in GitHub Desktop.
sudo yum install autoconf automake bzip2 bzip2-devel cmake freetype-devel gcc gcc-c++ git libtool make mercurial pkgconfig zlib-devel -y
mkdir ~/ffmpeg_sources
# nasm
cd ~/ffmpeg_sources
curl -O -L https://www.nasm.us/pub/nasm/releasebuilds/2.14.02/nasm-2.14.02.tar.bz2
tar xjvf nasm-2.14.02.tar.bz2
cd nasm-2.14.02
./autogen.sh
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin"
make
make install
# yasm
cd ~/ffmpeg_sources
curl -O -L http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
tar xzvf yasm-1.3.0.tar.gz
cd yasm-1.3.0
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin"
make
make install
# libxh264
cd ~/ffmpeg_sources
git clone --depth 1 https://code.videolan.org/videolan/x264
cd x264
PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --enable-static
make
make install
# libx265
cd ~/ffmpeg_sources
git clone https://github.com/videolan/x265
cd ~/ffmpeg_sources/x265/build/linux
cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$HOME/ffmpeg_build" -DENABLE_SHARED:bool=off ../../source
make
make install
# libfdk_aac
cd ~/ffmpeg_sources
git clone --depth 1 https://github.com/mstorsjo/fdk-aac
cd fdk-aac
autoreconf -fiv
./configure --prefix="$HOME/ffmpeg_build" --disable-shared
make
make install
# libmp3lame
cd ~/ffmpeg_sources
curl -O -L https://downloads.sourceforge.net/project/lame/lame/3.100/lame-3.100.tar.gz
tar xzvf lame-3.100.tar.gz
cd lame-3.100
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --disable-shared --enable-nasm
make
make install
# libopus
cd ~/ffmpeg_sources
curl -O -L https://archive.mozilla.org/pub/opus/opus-1.3.tar.gz
tar xzvf opus-1.3.tar.gz
cd opus-1.3
./configure --prefix="$HOME/ffmpeg_build" --disable-shared
make
make install
# libvpx
cd ~/ffmpeg_sources
git clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git
cd libvpx
./configure --prefix="$HOME/ffmpeg_build" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm
make
make install
# ffmpeg
cd ~/ffmpeg_sources
curl -O -L https://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" \
--extra-libs=-lpthread \
--extra-libs=-lm \
--bindir="$HOME/bin" \
--enable-gpl \
--enable-libfdk-aac \
--enable-libfreetype \
--enable-libmp3lame \
--enable-libopus \
--enable-libvpx \
--enable-libx264 \
--enable-libx265 \
--enable-nonfree
make
make install
hash -d ffmpeg
@gmontemayor1987
Copy link

Hi Felipe, thank you for this. It really helped me a lot!

Only a small detail. I tried to run the command
ffmpeg -y -i /mypath/Test.mp3 -c:a libfdk_aac -b:a 64k /mypath/Test-encoded.m4a

but i had the error: Unknown encoder 'libfdk_aac'

then, reviewed the documentation for fdk-aac (https://www.ffmpeg.org/ffmpeg-all.html#toc-libfdk_005faac) and seems that it needs to be enabled with --enable-libfdk-aac instead --enable-libfdk_aac. So I recompiled with the correct parameter and now the command works as expected.

@felipecsl
Copy link
Author

thank you @gmontemayor1987, I've updated the gist to reflect that!

@chrisfinne
Copy link

@felipecsl
Copy link
Author

updated, thanks!

@vishal-sampath
Copy link

Hey
https://bitbucket.org/multicoreware/x265 doesn't seem to be the right URL?

@vishal-sampath
Copy link

https://github.com/videolan/x265 - Check if this works. Have to git clone it.

@felipecsl
Copy link
Author

Instructions updated, thanks!

@joaolori
Copy link

joaolori commented Oct 29, 2020

Hey @felipecsl
This script looks great!
I tried and I getting the following:

image

Can you help me?
I run the script like this sudo bash ffmpeginstall.sh

@samimiashkan
Copy link

Hi Guys.. How do I create the shared libraries (.so)?

@lbjay
Copy link

lbjay commented Oct 9, 2024

libvpx wants to have diffutils installed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment