3

Hello Serverfault friends,

I am about two days into attempting to install FFMPEG with dependencies on an AWS EC2 instance running the Amazon Linux AMI. I've installed FFMPEG on Ubuntu and Fedora systems with no problems in the past, and have read reportedly successful instructions on installing on Red Hat/Fedora. I have followed a number of tutorials and forum articles to do so, but have had no luck yet. As far as I can tell, the main problems are as followed:

  1. The amazon linux (Most similar to red-hat/centos) yum repositories don't have ffmpeg available. I have found instructions to update the repositories to include the required packages, but adding these repositories cause yum to fail in updating packages. (Also, I've read some cautionary tales about adding redhat/centos repositories to amazon linux that lead me to believe it may be a bad idea)

(https://forums.aws.amazon.com/thread.jspa?messageID=229166)

  1. I have tried a more complicated method of downloading the source tarball, compiling, and installing, but this always fails due to missing dependencies and other errors.

On to my question: Has anyone successfully installed FFMPEG on Amazon Linux? Is there a fundamental incompatibility? If anyone could share specific instructions on installing ffmpeg on amazon linux I would be greatly appreciative. Any other insights/experiences would also be appreciated.

Thanks in advance, Oliver

4 Answers 4

3

Well, the direct answer is no, but the correct answer is I can.

When you have missing dependencies during compile, you just need to hunt those down and compile them, then try again. If you're feeling really fancy, you can make your own package out of all those dependencies.

There is no fundamental incompatibility about it, just a bit of hard experience.

3
  • Thanks Jeff. I will continue my efforts and report back. Mar 29, 2012 at 17:22
  • @OliverHolmberg Way back in the day, I used to do this: linuxfromscratch.org Mar 29, 2012 at 17:29
  • So in the end, you were entirely correct, it was really just a matter of patiently tracking down and installing those dependencies, most of which were available in the yum repo for amazon linux. Thanks again. Mar 30, 2012 at 0:38
3

On Fedora or RHEL I use ATRPMS to install ffmpeg. I'm not sure how well that'll work for Amazon Linux. Worst case is you'd pull down all the RPMs manually and then rebuild them locally which should be simpler than trying to build all the ffmpeg deps yourself. And you'd have RPMs you can put in your local repo or whatever.

In regards to the yum package update problem you will want to only include ffmpeg and the packages it depends on in the .repo file. This will keep yum from pulling in other packages from that repo. You can also set yum priorities as well.

1
  • Thanks! (Especially for the insights regarding management of repositories, my understanding in that area is a little weak) None the less, it seems as though with Amazon Linux screwing with repos is more trouble than building from source. Mar 29, 2012 at 18:03
0

easiest for me was to install a static build from http://johnvansickle.com/ffmpeg/

Just unpack and run ./ffmpeg

0

FWIW, here was my experience with trying to compile ffmpeg from source when I had to try it recently.

General ffmpeg compilation guidelines came from https://trac.ffmpeg.org/wiki/CompilationGuide/Centos

Enhanced with infos from https://developer.nvidia.com/ffmpeg for NVENC support and also https://www.linode.com/docs/platform/linode-gpu/getting-started-with-gpu/ for CUDA toolkit installation help.

For initial compilation, I believe you need to downgrade to CUDA toolkit 10.1 (at least as of 2020-04-08), download from https://developer.nvidia.com/cuda-toolkit-archive - go to the download page and use the instructions when selecting Linux/x84_64/CentOS/8/runfile (local) to install. But then for running ffmpeg you'll need to upgrade back to 10.2 (or at least upgrade the driver, I didn't try this though), otherwise when encoding using NVENC you'll get an error like:

[h264_nvenc @ 0x41d4080] Driver does not support the required nvenc API version. Required: 9.1 Found: 9.0
[h264_nvenc @ 0x41d4080] The minimum required Nvidia driver for nvenc is 435.21 or newer
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

Install dependencies (some of these are already there)

sudo yum install autoconf automake bzip2 bzip2-devel cmake \
  freetype-devel gcc gcc-c++ git libtool make mercurial pkgconfig zlib-devel

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 https://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

NV Codec headers, required for NVENC

cd ~/ffmpeg_sources && \
  git clone https://git.videolan.org/git/ffmpeg/nv-codec-headers.git && \
  cd nv-codec-headers && \
  sudo make install

libx264

cd ~/ffmpeg_sources && \
  git clone --depth 1 https://code.videolan.org/videolan/x264.git && \
  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 && 
  hg clone https://bitbucket.org/multicoreware/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.1.tar.gz && \
  tar xzvf opus-1.3.1.tar.gz && \
  cd opus-1.3.1 && \
  ./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 itself

cd ~/ffmpeg_sources && \
  curl -O -L https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2 && \
  tar xjvf ffmpeg-snapshot.tar.bz2 && \
  cd ffmpeg && \
  # Extra pkgconfig path comes from https://superuser.com/questions/1299064/error-cuvid-requested-but-not-all-dependencies-are-satisfied-cuda-ffnvcodec \
  PATH="$HOME/bin:$PATH" \
  PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig:/usr/local/lib/pkgconfig/" \
  ./configure \
    --prefix="$HOME/ffmpeg_build" \
    --pkg-config-flags="--static" \
    --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 \
    --enable-libfdk_aac \
    --enable-libmp3lame \
    --enable-libopus \
    --enable-libvpx \
    --enable-cuda-nvcc \
    --enable-cuvid \
    --enable-nvenc \
    --enable-libnpp \
    --extra-cflags="-I$HOME/ffmpeg_build/include -I/usr/local/cuda/include" \
    --extra-ldflags="-L$HOME/ffmpeg_build/lib -L/usr/local/cuda/lib64" && \
  make -j 10 && \
  make install && \
  hash -d ./ffmpeg

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .