Script instalare ffmpeg pe Ubuntu 12.04 si 14.04

Acest script te va ajuta sa-ti instalezi cea mai noua versiune de ffmpeg cu toate dependintele necesare. In plus vei avea suport pentru encodare h264 si aac. Instalarea, daca pot sa-i spun asa, se face foarte simplu.


Eu folosesc vim ca si editor, daca nu esti familiarizat cu el, poti folosi orice alt editor ca nano, vi sau gedit daca pui scriptul pe o masina cu interfata grafica. Se face paste la cod in fisierul deschis.


# Bash script to install latest version of ffmpeg and its dependencies on Ubuntu 12.04 or 14.04
# Inspired from

# Remove any existing packages:
sudo apt-get -y remove ffmpeg x264 libav-tools libvpx-dev libx264-dev

# Get the dependencies (Ubuntu Server or headless users):
sudo apt-get update
sudo apt-get -y install build-essential checkinstall git libfaac-dev libgpac-dev \
  libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev librtmp-dev libtheora-dev \
    libvorbis-dev pkg-config texi2html yasm zlib1g-dev

# Install x264
sudo apt-get -y install libx264-dev
git clone --depth 1 git://
cd x264
./configure --enable-static
sudo checkinstall --pkgname=x264 --pkgversion="3:$(./ | \
  awk -F'[" ]' '/POINT/{print $4"+git"$5}')" --backup=no --deldoc=yes \
    --fstrans=no --default

# Install AAC audio decoder
tar xzvf fdk-aac-0.1.0.tar.gz
cd fdk-aac-0.1.0
sudo checkinstall --pkgname=fdk-aac --pkgversion="0.1.0" --backup=no \
  --deldoc=yes --fstrans=no --default

# Install VP8 video encoder and decoder.
git clone --depth 1 
cd libvpx
sudo checkinstall --pkgname=libvpx --pkgversion="1:$(date +%Y%m%d%H%M)-git" --backup=no \
  --deldoc=yes --fstrans=no --default

# Add lavf support to x264
# This allows x264 to accept just about any input that FFmpeg can handle and is useful if you want to use x264 directly. See a more detailed explanation of what this means.
cd ~/x264
make distclean
./configure --enable-static
sudo checkinstall --pkgname=x264 --pkgversion="3:$(./ | \
  awk -F'[" ]' '/POINT/{print $4"+git"$5}')" --backup=no --deldoc=yes \
  --fstrans=no --default

# Installing FFmpeg
git clone --depth 1 git://
cd ffmpeg
./configure --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb \
  --enable-libopencore-amrwb --enable-librtmp --enable-libtheora --enable-libvorbis \
    --enable-libvpx --enable-libx264 --enable-nonfree --enable-version3 
sudo checkinstall --pkgname=ffmpeg --pkgversion="5:$(date +%Y%m%d%H%M)-git" --backup=no \
  --deldoc=yes --fstrans=no --default
  hash x264 ffmpeg ffplay ffprobe

# Optional: install qt-faststart
# This is a useful tool if you're showing your H.264 in MP4 videos on the web. It relocates some data in the video to allow playback to begin before the file is completely downloaded. Usage: qt-faststart input.mp4 output.mp4.
cd ~/ffmpeg
make tools/qt-faststart
sudo checkinstall --pkgname=qt-faststart --pkgversion="$(date +%Y%m%d%H%M)-git" --backup=no \
  --deldoc=yes --fstrans=no --default install -Dm755 tools/qt-faststart \



Apoi trebuie facut executabil.

chmod +x

Dupa asta putem executa scriptul.


Poti sa-ti iei o ceasca de cafea, dureaza cam 15 -20 min, depinde si de configuratia pe care se instaleaza.

Dupa terminarea instalarii poti verifica daca totul este in regula, ruland ffmpeg.

root@black:/# ffmpeg
ffmpeg version git-2015-06-24-041aa80 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04)
  configuration: --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-version3
  libavutil      54. 27.100 / 54. 27.100
  libavcodec     56. 44.101 / 56. 44.101
  libavformat    56. 38.101 / 56. 38.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 17.100 /  5. 17.100
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.100 /  1.  2.100
  libpostproc    53.  3.100 / 53.  3.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

Use -h to get full help or, even better, run 'man ffmpeg'

Daca raspunsul arata ca mai sus, inseamna ca e ok.


Sursa scriptului o gasesti aici, unde mai poti gasi si alte comentarii.

Leave a Reply

Your email address will not be published.