How to install ffmpeg for ubuntu using command line?
Solution 1
To use the add-apt-repository
command you need to:
apt-get install software-properties-common
This is valid for Ubuntu 14.04
and 16.04
.
sudo add-apt-repository ppa:mc3man/trusty-media
sudo apt-get update
sudo apt-get install ffmpeg
Or you can use latest official static builds from here.
Solution 2
I know this is a little late but the original answer isn't going to work with Docker.
I made an image that has ffmpeg included that should get you what you want. However, if you've already got a base image in mind you can add this
RUN apt-get -y update && apt-get install -y wget nano git build-essential yasm pkg-config
# Compile and install ffmpeg from source
RUN git clone https://github.com/FFmpeg/FFmpeg /root/ffmpeg && \
cd /root/ffmpeg && \
./configure --enable-nonfree --disable-shared --extra-cflags=-I/usr/local/include && \
make -j8 && make install -j8
# If you want to add some content to this image because the above takes a LONGGG time to build
ARG CACHEBREAK=1
That installs ffmpeg from source. If you go this route I would STRONGLY recommend you make a base image which contains this because the image size is over a GB and takes around 5 minutes to build.
Cheng Jaycee Jiang
Updated on June 18, 2022Comments
-
Cheng Jaycee Jiang almost 2 years
A lit background... This is a piece of code in my Dockerfile. I want to deploy my app to google app engine. Somehow I couldn't install ffmpeg.
ENV VIRTUAL_ENV /env ENV PATH /env/bin:$PATH RUN apt-get install ffmpeg
This is error log:
E: Unable to locate package ffmpeg The command '/bin/sh -c apt-get install ffmpeg' returned a non-zero code: 100 ERROR ERROR: build step "gcr.io/cloud-builders/docker@sha256:ef2e6744a171cfb0e8a0ef27f9b9a34970341bfc0c3d401afdeedca72292cf73" failed: exit status 100
I found this but it didn't work for me. It complained about add-apt-repository is not valid command. https://askubuntu.com/questions/691109/how-do-i-install-ffmpeg-and-codecs
Anyone can help me with this? Thanks!!!
-
llogan over 6 years
--enable-nonfree
forffmpeg
is only required if including additional components that require it. SeeEXTERNAL_LIBRARY_NONFREE_LIST
inconfigure
for an up to date list -
zipzit almost 6 yearsWow. I really appreciate the shared content here. The content
RUN apt-get...
info posted here was a fail for me.. There were a number of failedCC
compilations. Lots of red ink. Error message I see isError: Video codec libx264 is not available
... sigh. -
Derek Adair over 5 yearsdefinitely recommend this over some RANDOM ass, eventually unmaintained repository.
-
Ryan about 4 yearsWhat does
--extra-cflags=-I/usr/local/include
mean, and is that assuming that my system is already set up in a certain way? -
Ludo Schmidt over 2 yearsI get: #7 0.346 E: Unable to locate package software-properties-common