How to install ffmpeg for ubuntu using command line?
Asked Answered
S

3

7

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

Sclerotomy answered 3/3, 2017 at 23:1 Comment(0)
V
14

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.

Vermicide answered 4/3, 2017 at 4:57 Comment(1)
I get: #7 0.346 E: Unable to locate package software-properties-commonMarileemarilin
T
11

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.

Treasury answered 1/9, 2017 at 17:19 Comment(4)
--enable-nonfree for ffmpeg is only required if including additional components that require it. See EXTERNAL_LIBRARY_NONFREE_LIST in configure for an up to date listForbore
Wow. 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 failed CC compilations. Lots of red ink. Error message I see is Error: Video codec libx264 is not available ... sigh.Rugged
definitely recommend this over some RANDOM ass, eventually unmaintained repository.Reinforcement
What does --extra-cflags=-I/usr/local/include mean, and is that assuming that my system is already set up in a certain way?Eddington
M
4

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

Myriad answered 13/12, 2022 at 17:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.