Install FFmpeg on Ubuntu 18.04 Bionic Beaver Linux - LinuxConfig.org

The objective is to Install FFmpeg on Ubuntu 18.04 Bionic Beaver Linux. This guide will provide you with an information on how to install FFmpeg on Ubuntu 18.04 from a standard Ubuntu repository as well as how to install latest FFmpeg by compiling it from a source.
This is a companion discussion topic for the original entry at https://linuxconfig.org/install-ffmpeg-on-ubuntu-18-04-bionic-beaver-linux

Hi, thanks for your guide, i was trying to install ffmpeg via apt on a Ubuntu 18.04 fresh install but i get the following error:
$ sudo apt install ffmpeg
Reading package lists… Done
Building dependency tree
Reading state information… Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 ffmpeg : Depends: libavcodec-ffmpeg56 (>= 7:2.7) but it is not going to be installed or
                   libavcodec-ffmpeg-extra56 (>= 7:2.7) but it is not going to be installed
          Depends: libavdevice-ffmpeg56 (>= 7:2.6) but it is not going to be installed
          Depends: libavfilter-ffmpeg5 (>= 7:2.4) but it is not going to be installed
          Depends: libavformat-ffmpeg56 (>= 7:2.6) but it is not going to be installed
          Depends: libswresample-ffmpeg1 (>= 7:2.4) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

If i run
sudo apt-mark showhold
i see no packages hold.
Is it some ffmpeg bug or Ubuntu bug?

Hi Rafael Herrero,

Welcome to our forums.

Since you say you would like to install ffmpeg on a fresh install of Ubuntu, I’d advise to update it to the latest packages first, before installing anything. Solves a lot of problems, since repositories tend to provide many versions of a package, but your fresh install may not be able to install the most current until updating the system.

Thanks sandmann,
I did update before trying, but still gave the error described above.

I managed to fix my problem with the following command:
sudo apt install ffmpeg libavcodec-ffmpeg56 libavdevice-ffmpeg56 libavfilter-ffmpeg5 libavformat-ffmpeg56 libswresample-ffmpeg1 libsoxr0 libgomp1 gcc-5-base=5.4.0-6ubuntu1~16.04.10

The issue was on the version of gcc-5-base by default it was going to install one newer than the required by ffmpeg.
Thanks.

Found the real problem, i had done do-release-upgrade and my /etc/apt/sources.list were a mess, i replaced them with the right ones and that fixed the problem!

Hi Rafael Herrero,

That would mean if this is a fresh install of 18.04 you downgraded your source list somehow to 16…?

Hi. I was able to complete each process without a problem but this $ ffmpeg -version, returns this:

Command ‘ffmpeg’ not found, but can be installed with:

sudo apt install ffmpeg

All processes were completed without errors. So, what now?

I’m following these steps for a 18.04 system I have. I’m getting errors and missing files.

I get to the line where I do this:

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-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree && PATH=“$HOME/bin:$PATH” make && make install

and the result is this:

me@boots:~/ffmpeg/ffmpeg$ 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-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree && PATH=“$HOME/bin:$PATH” make && make install

install prefix /home/vsi/ffmpeg_build
source path .
C compiler gcc
C library glibc
ARCH x86 (generic)
big-endian no
runtime cpu detection yes
standalone assembly yes
x86 assembler yasm
MMX enabled yes
MMXEXT enabled yes
3DNow! enabled yes
3DNow! extended enabled yes
SSE enabled yes
SSSE3 enabled yes
AESNI enabled yes
AVX enabled yes
AVX2 enabled yes
AVX-512 enabled yes
XOP enabled yes
FMA3 enabled yes
FMA4 enabled yes
i686 features enabled yes
CMOV is fast yes
EBX available yes
EBP available yes
debug symbols yes
strip symbols yes
optimize for size no
optimizations yes
static yes
shared no
postprocessing support yes
network support yes
threading support pthreads
safe bitstream reader yes
texi2html enabled no
perl enabled yes
pod2man enabled yes
makeinfo enabled yes
makeinfo supports HTML yes

… other info on libs, decoders, encoders, etc… all looks good – AND THEN I GET THIS – note the Error 2 – what is wrong? Thanks in advance.

License: nonfree and unredistributable
config.h is unchanged
config.asm is unchanged
libavutil/avconfig.h is unchanged
libavfilter/filter_list.c is unchanged
libavcodec/codec_list.c is unchanged
libavcodec/parser_list.c is unchanged
libavcodec/bsf_list.c is unchanged
libavformat/demuxer_list.c is unchanged
libavformat/muxer_list.c is unchanged
libavdevice/indev_list.c is unchanged
libavdevice/outdev_list.c is unchanged
libavformat/protocol_list.c is unchanged
ffbuild/config.sh is unchanged
GEN libavdevice/libavdevice.pc
./ffbuild/pkgconfig_generate.sh: 21: .: Can’t open libavfilter/libavfilter.version
ffbuild/library.mak:102: recipe for target ‘libavdevice/libavdevice.pc’ failed
make: *** [libavdevice/libavdevice.pc] Error 2
me@boots:~/ffmpeg/ffmpeg$

Hi GR99,

Welcome to our forums.

This line of the output:

Suggests you may be missing libavfilter. Try installing it before the make procedure:

$ sudo apt-get install libavfilter6

The package is in the default Ubuntu 18.04 repositories.