Changes between Version 88 and Version 89 of CompilationGuide/Ubuntu


Ignore:
Timestamp:
Feb 13, 2014, 4:59:49 AM (6 years ago)
Author:
llogan
Comment:

use snapshots instead of git; make man pages work; use PATH for yasm; simplify updating; fancy note boxes

Legend:

Unmodified
Added
Removed
Modified
  • CompilationGuide/Ubuntu

    v88 v89  
    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 provide a "local installation" instead of a system installation and therefore will not interfere with repository packages.
     5This 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.
    66
    77You may also refer to the [[GenericCompilationGuide|Generic FFmpeg Compilation Guide]] for additional information.
     
    1717{{{
    1818sudo apt-get update
    19 sudo apt-get -y install autoconf automake build-essential git libass-dev libgpac-dev \
     19sudo apt-get -y install autoconf automake build-essential libass-dev libgpac-dev \
    2020  libsdl1.2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libx11-dev \
    2121  libxext-dev libxfixes-dev pkg-config texi2html zlib1g-dev
     
    2424
    2525{{{
    26 #!div style="border: 1pt dotted; margin: 1em"
    27 * Server users can omit the ffplay and x11 dependencies: `libsdl1.2-dev libva-dev libvdpau-dev libx11-dev libxext-dev libxfixes-dev`.
    28 * Ubuntu 10.04 Lucid users will need to install the `git-core` package instead of the `git` package. Lucid lacks the package `libva-dev`. This can be ignored.
    29 }}}
    30 
    31 
     26#!div style="border: 1pt dotted; margin: 1em; background-color: #fffff9;"
     27* Server users can omit the `ffplay` and x11 dependencies: `libsdl1.2-dev libva-dev libvdpau-dev libx11-dev libxext-dev libxfixes-dev`.
     28* Lucid lacks the package `libva-dev`. This can be ignored.
     29}}}
    3230
    3331----
     
    3533== Compilation & Installation ==
    3634
    37 One advantage to compiling is that you can build 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.
     35You 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.
     36
     37This guide will create several directories in your home directory:
     38
     39* `ffmpeg_sources` – Where the source files will be downloaded.
     40* `ffmpeg_build` – Where the files will be built and libraries installed.
     41* `bin` – Where the resulting binaries (`ffmpeg`, `ffplay`, `ffserver`, `x264`, and `yasm`) will be installed.
     42
     43You can easily undo any of this as shown in [#RevertingChangesMadebyThisGuide Reverting Changes Made by This Guide].
    3844
    3945=== Yasm ===
    4046
    41 Yasm is an assembler used by x264 and FFmpeg.
    42 
    43 Ubuntu 13.10, Ubuntu 13.04, and Mint 15 users can alternatively install the `yasm` package from the repository instead of compiling.
     47The first step is to compile Yasm which is an assembler used by x264 and FFmpeg. Ubuntu 13.10, Ubuntu 13.04, and Mint 15 users can alternatively install the `yasm` package from the repository instead of compiling.
    4448
    4549{{{
     
    5256make install
    5357make distclean
    54 . ~/.profile
     58export "PATH=$PATH:$HOME/bin"
    5559}}}
    5660
    5761=== x264 ===
    5862
    59 H.264 video encoder. See the [[x264EncodingGuide|x264 Encoding Guide]] for more information and examples.
    60 
    61 {{{
    62 cd ~/ffmpeg_sources
    63 git clone --depth 1 git://git.videolan.org/x264.git
    64 cd x264
     63H.264 video encoder. See the [[x264EncodingGuide|x264 Encoding Guide]] for more information and usage examples.
     64
     65{{{
     66cd ~/ffmpeg_sources
     67wget http://download.videolan.org/pub/x264/snapshots/last_x264.tar.bz2
     68tar xjvf last_x264.tar.bz2
     69cd x264-snapshot*
    6570./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --enable-static
    6671make
     
    6974}}}
    7075
    71 {{{
    72 #!div style="border: 1pt dotted; margin: 1em"
    73 '''Note:''' You can download the nightly [ftp://ftp.videolan.org/pub/x264/snapshots/last_x264.tar.bz2 x264 source snapshot] as an alternative to using `git`.
    74 }}}
    75 
    7676=== fdk-aac ===
    7777
    78 AAC audio encoder. See the [[AACEncodingGuide|AAC Encoding Guide]] for more information and examples.
    79 
    80 {{{
    81 cd ~/ffmpeg_sources
    82 git clone --depth 1 git://git.code.sf.net/p/opencore-amr/fdk-aac
    83 cd fdk-aac
     78AAC audio encoder. See the [[AACEncodingGuide|AAC Encoding Guide]] for more information and usage examples.
     79
     80{{{
     81cd ~/ffmpeg_sources
     82wget -O fdk-aac.zip https://github.com/mstorsjo/fdk-aac/zipball/master
     83unzip fdk-aac.zip
     84cd mstorsjo-fdk-aac*
    8485autoreconf -fiv
    8586./configure --prefix="$HOME/ffmpeg_build" --disable-shared
     
    8788make install
    8889make distclean
    89 }}}
    90 
    91 {{{
    92 #!div style="border: 1pt dotted; margin: 1em"
    93 '''Note:''' You can download a [https://github.com/mstorsjo/fdk-aac/zipball/master fdk-aac source snapshot] as an alternative to using `git`.
    9490}}}
    9591
     
    122118Opus audio decoder and encoder.
    123119
    124 Ubuntu 13.10, Ubuntu 13.04, and Mint 15 users can alternatively install the `libopus-dev` package from the repository instead of compiling.
    125 
    126120{{{
    127121cd ~/ffmpeg_sources
     
    137131=== libvpx ===
    138132
    139 VP8/VP9 video encoder and decoder. See the [[vpxEncodingGuide|vpx (WebM) Encoding Guide]] for more information and examples.
    140 
    141 Ubuntu 13.10, Ubuntu 13.04, and Mint 15 users can alternatively install the `libvpx-dev` package from the repository instead of compiling.
    142 
    143 {{{
    144 cd ~/ffmpeg_sources
    145 git clone --depth 1 http://git.chromium.org/webm/libvpx.git
    146 cd libvpx
     133VP8/VP9 video encoder and decoder. See the [[vpxEncodingGuide|vpx (WebM) Encoding Guide]] for more information and usage examples.
     134
     135{{{
     136cd ~/ffmpeg_sources
     137wget http://webm.googlecode.com/files/libvpx-v1.3.0.tar.bz2
     138tar xjvf libvpx-v1.3.0.tar.bz2
     139cd libvpx-v1.3.0
    147140./configure --prefix="$HOME/ffmpeg_build" --disable-examples
    148141make
     
    151144}}}
    152145
    153 {{{
    154 #!div style="border: 1pt dotted; margin: 1em"
    155 '''Note:''' You can download a [http://code.google.com/p/webm/downloads/list libvpx source snapshot] as an alternative to using `git`.
    156 }}}
    157 
    158146=== ffmpeg ===
    159147
    160148{{{
    161 #!div style="border: 1pt dotted; margin: 1em"
    162 '''Note:''' Server users should remove `--enable-x11grab` from the following command:
    163 }}}
    164 
    165 {{{
    166 cd ~/ffmpeg_sources
    167 git clone --depth 1 git://source.ffmpeg.org/ffmpeg
     149#!div style="border: 1pt dotted; margin: 1em; background-color: #fffff9;"
     150'''Note:''' Server users should remove `--enable-x11grab`.
     151}}}
     152
     153{{{
     154cd ~/ffmpeg_sources
     155wget http://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2
     156tar xjvf ffmpeg-snapshot.tar.bz2
    168157cd ffmpeg
    169158PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig"
    170159export PKG_CONFIG_PATH
    171 ./configure --prefix="$HOME/ffmpeg_build" \
     160./configure --prefix="$HOME/ffmpeg_build" --mandir="$HOME/bin" \
    172161  --extra-cflags="-I$HOME/ffmpeg_build/include" --extra-ldflags="-L$HOME/ffmpeg_build/lib" \
    173   --bindir="$HOME/bin" --extra-libs="-ldl" --enable-gpl --enable-libass --enable-libfdk-aac \
     162  --bindir="$HOME/bin" --extra-libs=-ldl --enable-gpl --enable-libass --enable-libfdk-aac \
    174163  --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx \
    175164  --enable-libx264 --enable-nonfree --enable-x11grab
     
    178167make distclean
    179168hash -r
     169}}}
     170
     171----
     172
     173== Conclusion ==
     174
     175Installation is now complete and `ffmpeg` is now ready for use. Your newly compiled FFmpeg programs are in `~/bin`. To use it:
     176
     177* Navigate to `~/bin` and execute the binary: `cd ~/bin && ./ffmpeg -i ~/input.mp4 ~/videos/output.mkv` (notice the `./`)
     178* Or you can use the full path to the binary: `/home/yourusername/bin/ffmpeg -i ../input.mp4 ../videos/output.mkv`
     179* Or if you simply want to just issue the `ffmpeg` command and have your shell use your compiled binary see the Persistent Environment Variables section below.
     180
     181=== Persistent Environment Variables ===
     182
     183You can tell your shell (assuming you're using Bash) to persistantly use your new `ffmpeg` in `~/bin`. The first command will allow you to simply run `man ffmpeg` to get the FFmpeg man pages. The second command will source `~/.profile` which will add `~/bin` to your `$PATH`. In short, the following commands will allow you to simply type `ffmpeg` and `man ffmpeg` in your terminal and they will "just work":
     184
     185{{{
     186echo "MANPATH_MAP $HOME/bin $HOME/ffmpeg_build/share/man" >> ~/.manpath
    180187. ~/.profile
    181188}}}
    182189
    183190{{{
    184 #!div style="border: 1pt dotted; margin: 1em"
    185 '''Note:''' You can download the nightly [http://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2 FFmpeg source snapshot] as an alternative to using `git`.
    186 }}}
    187 
    188 ----
    189 
    190 == Finish ==
    191 
    192 * Installation is now complete and ffmpeg is now ready for use. See the [[x264EncodingGuide|x264 Encoding Guide]] for examples.
     191#!div style="border: 1pt dotted; margin: 1em; background-color: #fffff9;"
     192'''Note:'''
     193* This may reset custom variables in the current shell session.
     194* This assumes you are using the default `~/.profile` (and therefore `~/.bashrc`).
     195* This assumes you are using Bash shell.
     196* Sourcing the default `~/.profile` will also source `~/.bashrc`.
     197* You may have to log out and then log in for `man ffmpeg` to work.
     198* Don't worry: you can undo any of this as shown in [#RevertingChangesMadebyThisGuide Reverting Changes Made by This Guide].
     199}}}
     200
     201See [https://help.ubuntu.com/community/EnvironmentVariables#Persistent_environment_variables Ubuntu Wiki: Persistent Environment Variables] for more info.
     202
     203=== Additional Notes ===
     204
     205* See the [[x264EncodingGuide|x264 Encoding Guide]] for some encoding examples.
    193206* 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.
    194207* HTML formatted documentation is available in `~/ffmpeg_build/share/doc/ffmpeg`.
     
    199212== Updating FFmpeg ==#update
    200213
    201 Development of FFmpeg is active and an occasional update can give you new features and bug fixes. First, remove (or move) the old files and then update the dependencies:
    202 
    203 {{{
    204 rm -rf ~/ffmpeg_build ~/bin/{ffmpeg,ffprobe,ffserver,vsyasm,x264,yasm,ytasm}
    205 sudo apt-get update
    206 sudo apt-get -y install autoconf automake build-essential git libass-dev libgpac-dev \
    207   libsdl1.2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libx11-dev \
    208   libxext-dev libxfixes-dev pkg-config texi2html zlib1g-dev
    209 }}}
    210 
    211 {{{
    212 #!div style="border: 1pt dotted; margin: 1em"
    213 '''Note:''' Server users can omit: `libsdl1.2-dev libva-dev libvdpau-dev libx11-dev libxext-dev libxfixes-dev`.
    214 }}}
    215 
    216 === x264 ===
    217 
    218 {{{
    219 cd ~/ffmpeg_sources/x264
    220 make distclean
    221 git pull
    222 }}}
    223 
    224 Now run `./configure`, `make`, and `make install` as shown in the [#x264 Install x264] section.
    225 
    226 === fdk-aac ===
    227 
    228 {{{
    229 cd ~/ffmpeg_sources/fdk-aac
    230 make distclean
    231 git pull
    232 }}}
    233 
    234 Now run `./configure`, `make`, and `make install` as shown in the [#fdk-aac Install fdk-aac] section.
    235 
    236 === libvpx ===
    237 
    238 {{{
    239 cd ~/ffmpeg_sources/libvpx
    240 make clean
    241 git pull
    242 }}}
    243 
    244 Now run `./configure`, `make`, and `make install` as shown in the [#libvpx Install libvpx] section.
    245 
    246 === ffmpeg ===
    247 
    248 {{{
    249 cd ~/ffmpeg_sources/ffmpeg
    250 make distclean
    251 git pull
    252 }}}
    253 
    254 Now run `./configure`, `make`, and `make install` as shown in the [#ffmpeg Install FFmpeg] section.
     214Development of FFmpeg is active and an occasional update can give you new features and bug fixes. First you need to delete (or move) the old files:
     215
     216{{{
     217rm -rf ~/ffmpeg_build ~/ffmpeg_sources ~/bin/{ffmpeg,ffprobe,ffserver,vsyasm,x264,yasm,ytasm}
     218}}}
     219
     220Now just follow the guide from the beginning.
    255221
    256222----
     
    258224== Reverting Changes Made by This Guide ==
    259225
    260 To remove ffmpeg, x264, and dependencies installed for this guide:
    261226{{{
    262227rm -rf ~/ffmpeg_build ~/ffmpeg_sources ~/bin/{ffmpeg,ffprobe,ffserver,vsyasm,x264,yasm,ytasm}
    263 sudo apt-get autoremove autoconf automake build-essential git libass-dev libgpac-dev \
     228sudo apt-get autoremove autoconf automake build-essential libass-dev libgpac-dev \
    264229  libmp3lame-dev libopus-dev libsdl1.2-dev libtheora-dev libtool libva-dev libvdpau-dev \
    265230  libvorbis-dev libvpx-dev libx11-dev libxext-dev libxfixes-dev texi2html zlib1g-dev
     231sed -i '/ffmpeg_build/c\' ~/.manpath
    266232hash -r
    267233}}}
     
    279245* [[x264EncodingGuide|x264 Encoding Guide]]
    280246* [[AACEncodingGuide|AAC Encoding Guide]]
    281 
    282 {{{#!comment
    283 * Make man pages actually work
    284 * Make datadir location (the presets, etc) less useless
    285 }}}