Last active
June 27, 2024 21:04
-
-
Save rafaelbiriba/7f2d7c6f6c3d6ae2a5cb to your computer and use it in GitHub Desktop.
Install FFmpeg with libfdk_aac support (For Ubuntu)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Criando um script .sh para executar todos os comandos: | |
#root@servidor:~# vi script.sh | |
#root@servidor:~# chmod +x script.sh | |
#root@servidor:~# ./script.sh | |
apt-get update | |
apt-get -y install autoconf automake build-essential git-core libass-dev libgpac-dev libsdl1.2-dev libtheora-dev libtool libvdpau-dev libvorbis-dev libx11-dev libxext-dev libxfixes-dev pkg-config texi2html zlib1g-dev libmp3lame-dev nasm gcc yasm && true | |
mkdir ~/ffmpeg_sources | |
cd ~/ffmpeg_sources | |
git clone --depth 1 git://github.com/mstorsjo/fdk-aac.git | |
cd fdk-aac | |
autoreconf -fiv | |
./configure --prefix="$HOME/ffmpeg_build" --disable-shared | |
make -j8 | |
make install | |
make distclean | |
cd ~/ffmpeg_sources | |
wget https://sourceforge.net/projects/lame/files/lame/3.99/lame-3.99.5.tar.gz | |
tar xzvf lame-3.99.5.tar.gz | |
cd lame-3.99.5 | |
./configure --prefix="$HOME/ffmpeg_build" --enable-nasm --disable-shared | |
make -j8 | |
make install | |
make distclean | |
cd ~/ffmpeg_sources | |
wget https://ffmpeg.org/releases/ffmpeg-4.2.1.tar.gz | |
tar xzvf ffmpeg-4.2.1.tar.gz | |
cd ffmpeg-4.2.1 | |
PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" | |
export PKG_CONFIG_PATH | |
./configure --prefix="$HOME/ffmpeg_build" \ | |
--extra-cflags="-I$HOME/ffmpeg_build/include" --extra-ldflags="-L$HOME/ffmpeg_build/lib" \ | |
--bindir="$HOME/bin" --extra-libs="-ldl" --enable-gpl --enable-libass --enable-libfdk-aac \ | |
--enable-libmp3lame --enable-nonfree | |
make -j8 | |
make install | |
cp ffmpeg /usr/bin/ | |
make distclean | |
hash -r | |
ffmpeg 2>&1 | head -n1 |
@CRC-Mismatch thanks for the detailed analysis.
This script was originally intended to be used for myself, I used a couple of times in 2019 and has been deprecated by me since then.
Feel free to take over and make a smarter version out of it. 🤞
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@rafaelbiriba this happens if you run the script without root permissions in a copy-paste multi-line command (at least in my zsh setup it did), since for multi-line commands it behaves as if split by
;
and doesn't quit at the first failure...For that, I'd recommend adding a
set -e
before everything else, since that should make most current shells quit after the first failed command (but that would still lead to problems with themkdir
commands when trying again after the first attempt).About the problem @drscotthawley mentions, I think I faced it myself here... I'm not one to vouch for sudo usage "for everyone", but I would certainly recommend (in this specific case) to prefix all
apt-get
,make install
andcp ffmpeg /usr/bin/
commands withsudo
if one's willing to try it without root access, since (together with the aforementioned problem) the script tries to move on with undefined results even if any of the dependencies' installations fails...But I'd guess the right way forward would be to work on a CMake (or something alike) script, that handles dependencies Git (sub)modules cloning (compilation and installation, if required) altogether, also properly handling errors (and by saying that, I think I know why you left this gist as-was 😏 )