Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install ffmpeg in a docker container

Tags:

docker

ffmpeg

I'm using aeneas python module which uses ffmpeg. I install ffmpeg in the dockerfile as follows:

RUN apt-get update && apt-get install -y ffmpeg

Now when I run the program, it fails with: aeneas.ffprobewrapper.FFPROBEPathError: Unable to call the 'ffprobe' ffprobe executable : [Errno 2] No such file or directory: 'ffprobe' and aeneas.audiofile.AudioFileProbeError: Unable to call ffprobe executable. So my question is, how can I successfully use ffmpeg in a docker container? I'm running Ubuntu 16.04.

like image 735
T.Poe Avatar asked Dec 27 '18 11:12

T.Poe


People also ask

How do I install FFmpeg and Ffprobe?

# Download ffmpeg and ffprobe binaries to your /opt folder. # Untar the downloaded file. Symlink FFmpeg and ffprobe to /usr/bin to make the commands accessible to the ftrack user. Replace the part between <> with the specific version installed.

Where do I put FFmpeg binary?

Add the FFmpeg binary directory to the path. Click the New button to open a new blank line below the bottom-most path. Type C:\ffmpeg\bin . Or, if you placed the FFmpeg folder on a different drive or in a different folder, replace this path with that location instead (remember to leave \bin at the end). Click OK.


1 Answers

Install fresh ffmpeg version from sources in docker container on Debian 9/10/Ubuntu.

You can replace 4.2.2 version to any other available on https://ffmpeg.org/releases/

# Compile and install fresh ffmpeg from sources:
# See: https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu
RUN apt-get update -qq && apt-get -y install \
      autoconf \
      automake \
      build-essential \
      cmake \
      git-core \
      libass-dev \
      libfreetype6-dev \
      libsdl2-dev \
      libtool \
      libva-dev \
      libvdpau-dev \
      libvorbis-dev \
      libxcb1-dev \
      libxcb-shm0-dev \
      libxcb-xfixes0-dev \
      pkg-config \
      texinfo \
      wget \
      zlib1g-dev \
      nasm \
      yasm \
      libx265-dev \
      libnuma-dev \
      libvpx-dev \
      libmp3lame-dev \
      libopus-dev \
      libx264-dev \
      libfdk-aac-dev
RUN mkdir -p ~/ffmpeg_sources ~/bin && cd ~/ffmpeg_sources && \
    wget -O ffmpeg-4.2.2.tar.bz2 https://ffmpeg.org/releases/ffmpeg-4.2.2.tar.bz2 && \
    tar xjvf ffmpeg-4.2.2.tar.bz2 && \
    cd ffmpeg-4.2.2 && \
    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 -lm" \
      --bindir="$HOME/bin" \
      --enable-libfdk-aac \
      --enable-gpl \
      --enable-libass \
      --enable-libfreetype \
      --enable-libmp3lame \
      --enable-libopus \
      --enable-libvorbis \
      --enable-libvpx \
      --enable-libx264 \
      --enable-libx265 \
      --enable-nonfree && \
    PATH="$HOME/bin:$PATH" make -j8 && \
    make install -j8 && \
    hash -r
RUN mv ~/bin/ffmpeg /usr/local/bin && mv ~/bin/ffprobe /usr/local/bin && mv ~/bin/ffplay /usr/local/bin
like image 160
James Bond Avatar answered Oct 27 '22 18:10

James Bond