Cheng Jaycee Jiang
Cheng Jaycee Jiang

Reputation: 137

How to install ffmpeg for ubuntu using command line?

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!!!

Upvotes: 7

Views: 25042

Answers (3)

wristbands
wristbands

Reputation: 1389

For me I needed to use the following command: apt-get update && apt-get install -y ffmpeg

Upvotes: 4

Obj3ctiv3_C_88
Obj3ctiv3_C_88

Reputation: 1528

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.

Upvotes: 11

Farhad Farahi
Farhad Farahi

Reputation: 39507

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.

Upvotes: 14

Related Questions