Changes between Version 137 and Version 138 of CompilationGuide/Ubuntu


Ignore:
Timestamp:
Oct 30, 2017, 11:15:29 AM (19 months ago)
Author:
slhck
Comment:

update introductions, slightly re-structure / fix formatting to harmonize with CentOS guide, remove "recommendation" for assemblers (since they're used for some libs below), use Git to fetch latest versions, update LAME and Opus versions, remove notice about old ffmpeg versions Ubuntu releases, etc

Legend:

Unmodified
Added
Removed
Modified
  • CompilationGuide/Ubuntu

    v137 v138  
    33[[PageOutline(2, Contents)]]
    44
    5 This guide for supported releases of '''Ubuntu''', '''Debian''', and '''Linux Mint''' will provide a local install of the latest FFmpeg tools and libraries including several external encoding and decoding libraries (codecs). This will not interfere with repository packages.
    6 
    7 You may also refer to the [[GenericCompilationGuide|Generic FFmpeg Compilation Guide]] for additional information.
     5This guide for supported releases of '''Ubuntu''', '''Debian''', and '''Linux Mint''' and will provide a local, non-system installation of FFmpeg with support for several common external encoding libraries.
     6
     7You may also refer to the [[GenericCompilationGuide|Generic Compilation Guide]] for additional information about compiling software.
    88
    99Recent [http://ffmpeg.org/download.html#LinuxBuilds static builds] are also available for lazy people or those who are unable to compile. The static builds do not support non-free encoders.
    1010
    1111{{{
    12 #!div style="border: 1pt dotted; margin: 1em; background-color: #fffff9;"
    13 '''Note:''' FFmpeg has returned in Ubuntu 15.04 Vivid Vervet and can be installed via `apt-get install ffmpeg`. You may still wish to compile if you experience a bug or want to customize your build, and it will not interfere with the ''ffmpeg'' package in the repository.
    14 }}}
    15 
    16 ----
    17 
    18 == Get the Dependencies ==
    19 
    20 Copy and paste the whole code box for each step. First install the dependencies:
    21 
    22 {{{
    23 sudo apt-get update
    24 sudo apt-get -y install autoconf automake build-essential libass-dev libfreetype6-dev \
    25   libsdl2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libxcb1-dev libxcb-shm0-dev \
    26   libxcb-xfixes0-dev pkg-config texinfo wget zlib1g-dev
    27 }}}
    28 
    29 {{{
    30 #!div style="border: 1pt dotted; margin: 1em; background-color: #fffff9;"
    31 '''Note:''' Server users can omit the `ffplay` and x11grab dependencies: `libsdl2-dev libva-dev libvdpau-dev libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev`.
    32 }}}
    33 
    34 Now make a directory for the source files that will be downloaded later in this guide:
    35 
    36 {{{
    37 mkdir ~/ffmpeg_sources
    38 }}}
    39 
    40 ----
    41 
    42 == Compilation & Installation ==
    43 
    44 You can compile `ffmpeg` to your liking. If you do not require certain encoders you may skip the relevant section and then remove the appropriate `./configure` option in FFmpeg. For example, if libopus is not needed, then skip that section and then remove `--enable-libopus` from the [#ffmpeg Install FFmpeg] section.
     12#!div style="border: 1px solid #e5e5c7; margin: 1em; background-color: #ffd;"
     13'''Note:''' FFmpeg is part of the Ubuntu packages and can be installed via `apt-get install ffmpeg`. You may still wish to compile if you want the latest version, experience a bug, or want to customize your build, and it will not interfere with the `ffmpeg` package in the repository.
     14}}}
    4515
    4616This guide is designed to be non-intrusive and will create several directories in your home directory:
     
    5020* `bin` – Where the resulting binaries (`ffmpeg`, `ffplay`, `ffserver`, `x264`, `x265`) will be installed.
    5121
    52 You can easily undo any of this as shown in [#RevertingChangesMadebyThisGuide Reverting Changes Made by This Guide].
     22You can easily undo any of this as shown in [#RevertingChangesmadebythisGuide Reverting Changes Made by This Guide].
     23
     24
     25----
     26
     27== Get the Dependencies ==
     28
     29Get the dependencies. These are required for compiling, but you can remove them when you are done if you prefer:
     30{{{
     31sudo apt-get update -qq && apt-get -y install autoconf automake build-essential git libass-dev libfreetype6-dev \
     32  libsdl2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libxcb1-dev libxcb-shm0-dev \
     33  libxcb-xfixes0-dev pkg-config texinfo wget zlib1g-dev
     34}}}
     35
     36{{{
     37#!div style="border: 1px solid #e5e5c7; margin: 1em; background-color: #ffd;"
     38'''Note:''' Server users can omit the `ffplay` and x11grab dependencies: `libsdl2-dev libva-dev libvdpau-dev libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev`.
     39}}}
     40
     41In your home directory make a new directory to put all of the source code and binaries into:
     42{{{
     43mkdir ~/ffmpeg_sources ~/bin
     44}}}
     45
     46----
     47
     48== Compilation & Installation ==
     49
     50{{{
     51#!div style="border: 1px solid #c7e5c7; margin: 1em; background-color: #ddffdd;"
     52'''Tip:''' If you do not require certain encoders you may skip the relevant section and then remove the appropriate `./configure` option in FFmpeg. For example, if libvorbis is not needed, then skip that section and then remove `--enable-libvorbis` from the [#FFmpeg Install FFmpeg] section.
     53}}}
     54
     55=== NASM ===
     56
     57An assembler used by some libraries.
     58
     59{{{
     60cd ~/ffmpeg_sources
     61wget http://www.nasm.us/pub/nasm/releasebuilds/2.13.01/nasm-2.13.01.tar.bz2
     62tar xjvf nasm-2.13.01.tar.bz2
     63cd nasm-2.13.01
     64./autogen.sh
     65PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin"
     66make
     67make install
     68}}}
    5369
    5470=== Yasm ===
    5571
    56 An assembler for x86 optimizations used by x264 and FFmpeg. Highly recommended or your resulting build may be very slow.
     72An assembler used by some libraries.
    5773
    5874If your repository provides yasm version ≥ 1.2.0 then you can install that instead of compiling:
     
    7490}}}
    7591
    76 === nasm ===
    77 
    78 NASM assembler. Required for compilation of x264 and other tools.
    79 
    80 {{{
    81 cd ~/ffmpeg_sources
    82 wget http://www.nasm.us/pub/nasm/releasebuilds/2.13.01/nasm-2.13.01.tar.bz2
    83 tar xjvf nasm-2.13.01.tar.bz2
    84 cd nasm-2.13.01
    85 ./autogen.sh
    86 PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin"
    87 PATH="$HOME/bin:$PATH" make
    88 make install
    89 }}}
    90 
    9192=== libx264 ===
    9293
     
    105106{{{
    106107cd ~/ffmpeg_sources
    107 wget http://download.videolan.org/pub/x264/snapshots/last_x264.tar.bz2
    108 tar xjvf last_x264.tar.bz2
    109 cd x264-snapshot*
    110 PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --enable-static --disable-opencl
     108git clone --depth 1 http://git.videolan.org/git/x264
     109cd x264
     110PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --enable-static
    111111PATH="$HOME/bin:$PATH" make
    112112make install
     
    126126
    127127{{{
    128 sudo apt-get install cmake mercurial
     128sudo apt-get install -y cmake mercurial
    129129cd ~/ffmpeg_sources
    130130hg clone https://bitbucket.org/multicoreware/x265
    131131cd ~/ffmpeg_sources/x265/build/linux
    132132PATH="$HOME/bin:$PATH" cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$HOME/ffmpeg_build" -DENABLE_SHARED:bool=off ../../source
    133 make
     133PATH="$HOME/bin:$PATH" make
    134134make install
    135135}}}
     
    151151{{{
    152152cd ~/ffmpeg_sources
    153 wget -O fdk-aac.tar.gz https://github.com/mstorsjo/fdk-aac/tarball/master
    154 tar xzvf fdk-aac.tar.gz
    155 cd mstorsjo-fdk-aac*
     153git clone --depth 1 https://github.com/mstorsjo/fdk-aac
     154cd fdk-aac
    156155autoreconf -fiv
    157156./configure --prefix="$HOME/ffmpeg_build" --disable-shared
     
    176175{{{
    177176cd ~/ffmpeg_sources
    178 wget http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
    179 tar xzvf lame-3.99.5.tar.gz
    180 cd lame-3.99.5
    181 ./configure --prefix="$HOME/ffmpeg_build" --enable-nasm --disable-shared
    182 make
     177wget http://downloads.sourceforge.net/project/lame/lame/3.100/lame-3.100.tar.gz
     178tar xzvf lame-3.100.tar.gz
     179cd lame-3.100
     180PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --disable-shared --enable-nasm
     181PATH="$HOME/bin:$PATH" make
    183182make install
    184183}}}
     
    200199{{{
    201200cd ~/ffmpeg_sources
    202 wget https://archive.mozilla.org/pub/opus/opus-1.1.5.tar.gz
    203 tar xzvf opus-1.1.5.tar.gz
    204 cd opus-1.1.5
     201wget https://archive.mozilla.org/pub/opus/opus-1.2.tar.gz
     202tar xzvf opus-1.2.tar.gz
     203cd opus-1.2
    205204./configure --prefix="$HOME/ffmpeg_build" --disable-shared
    206205make
     
    223222
    224223{{{
    225 sudo apt-get install git
    226224cd ~/ffmpeg_sources
    227225git clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git
    228226cd libvpx
    229 PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth
    230 PATH="$HOME/bin:$PATH" make
    231 make install
    232 }}}
    233 
    234 === ffmpeg ===
     227PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm
     228PATH="$HOME/bin:$PATH" make
     229make install
     230}}}
     231
     232=== FFmpeg ===
    235233
    236234{{{
     
    244242  --extra-cflags="-I$HOME/ffmpeg_build/include" \
    245243  --extra-ldflags="-L$HOME/ffmpeg_build/lib" \
    246   --extra-libs=-lpthread \
     244  --extra-libs="-lpthread -lm" \
    247245  --bindir="$HOME/bin" \
    248246  --enable-gpl \
     
    263261}}}
    264262
    265 ----
    266 
    267 == Conclusion ==
    268 
    269 Installation is now complete and `ffmpeg` is now ready for use. Your newly compiled FFmpeg programs are in `~/bin`.
     263Compilation is now complete and `ffmpeg` (also `ffprobe`, `ffserver`, `lame`, and `x264`) should now be ready to use. The rest of this guide shows how to update or remove FFmpeg.
     264
     265{{{
     266#!div style="border: 1px solid #c7e5c7; margin: 1em; background-color: #ddffdd;"
     267'''Tip:''' Keep the `ffmpeg_sources` directory and all contents if you intend to [#Updating update] as shown below. Otherwise you can delete this directory.
     268}}}
    270269
    271270=== Usage ===
     
    274273
    275274* Navigate to `~/bin` and execute the binary: `cd ~/bin && ./ffmpeg -i ~/input.mp4 ~/videos/output.mkv` (notice the `./`)
    276 * Or use the full path to the binary: `/home/yourusername/bin/ffmpeg -i ../input.mp4 ../videos/output.mkv`
     275* Or use the full path to the binary: `~/bin/ffmpeg -i ../input.mp4 ../videos/output.mkv`
    277276
    278277If you want the `ffmpeg` command to just work from anywhere:
     
    282281
    283282{{{
    284 #!div style="border: 1pt dotted; margin: 1em; background-color: #fffff9;"
     283#!div style="border: 1px solid #e5e5c7; margin: 1em; background-color: #ffd;"
    285284'''Note:''' `~/bin` is included in the standard Ubuntu `$PATH` by default (via the `~/.profile` file), ''but only when the `~/bin` directory actually exists''. This is why you must log out then log in or run `source ~/.profile` if you just created `~/bin`. See [https://help.ubuntu.com/community/EnvironmentVariables#Persistent_environment_variables Ubuntu Wiki: Persistent Environment Variables] for more info.
    286285}}}
     
    300299You can also refer to the [https://ffmpeg.org/documentation.html online FFmpeg documentation], but remember that it is regenerated daily and is meant to be used with the most current `ffmpeg` (meaning an old build may not be compatible with the online docs).
    301300
    302 === Additional Notes ===
    303 
    304 * See the [[Encode/H.264|H.264 Encoding Guide]] for some encoding examples.
    305 * If you do not see `FFmpeg developers` in your ffmpeg console output then something went wrong and you're probably using the [http://stackoverflow.com/a/9477756/1109017 fake "ffmpeg"] from the repository (the counterfeit "`ffmpeg`" was eventually removed and the real `ffmpeg` returned in 15.04).
    306 * You can delete the `ffmpeg_sources` directory if you want to.
    307 
    308301----
    309302
     
    320313----
    321314
    322 == Reverting Changes Made by This Guide ==
    323 
    324 {{{
    325 rm -rf ~/ffmpeg_build ~/ffmpeg_sources ~/bin/{ffmpeg,ffprobe,ffplay,ffserver,x264,x265,nasm}
    326 sudo apt-get autoremove autoconf automake build-essential cmake libass-dev libfreetype6-dev \
     315== Reverting Changes made by this Guide ==
     316
     317{{{
     318rm -rf ~/ffmpeg_build ~/ffmpeg_sources ~/bin/{ffmpeg,ffprobe,ffplay,ffserver,x264,x265,nasm,vsyasm,yasm,ytasm}
     319sudo apt-get autoremove autoconf automake build-essential cmake git libass-dev libfreetype6-dev \
    327320  libmp3lame-dev libopus-dev libsdl2-dev libtheora-dev libtool libva-dev libvdpau-dev \
    328321  libvorbis-dev libvpx-dev libx264-dev libxcb1-dev libxcb-shm0-dev ibxcb-xfixes0-dev mercurial texinfo zlib1g-dev
     
    335328== If You Need Help ==
    336329
    337 Feel free to ask questions at the #ffmpeg IRC channel or the [http://ffmpeg.org/contact.html ffmpeg-user] mailing list.
     330Feel free to ask your questions at the #ffmpeg IRC channel or the [https://ffmpeg.org/contact.html ffmpeg-user] mailing list.
    338331
    339332----