Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 568
Cheng Jaycee Jiang Avatar asked Mar 03 '17 23:03

Cheng Jaycee Jiang


2 Answers

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.

like image 117
Farhad Farahi Avatar answered Sep 21 '22 18:09

Farhad Farahi


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.

like image 44
Obj3ctiv3_C_88 Avatar answered Sep 23 '22 18:09

Obj3ctiv3_C_88