Changes between Version 137 and Version 138 of CompilationGuide/Ubuntu
- Timestamp:
- Oct 30, 2017, 9:15:29 AM (9 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
CompilationGuide/Ubuntu
v137 v138 3 3 [[PageOutline(2, Contents)]] 4 4 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.5 This 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 7 You may also refer to the [[GenericCompilationGuide|Generic Compilation Guide]] for additional information about compiling software. 8 8 9 9 Recent [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. 10 10 11 11 {{{ 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 }}} 45 15 46 16 This guide is designed to be non-intrusive and will create several directories in your home directory: … … 50 20 * `bin` – Where the resulting binaries (`ffmpeg`, `ffplay`, `ffserver`, `x264`, `x265`) will be installed. 51 21 52 You can easily undo any of this as shown in [#RevertingChangesMadebyThisGuide Reverting Changes Made by This Guide]. 22 You 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 29 Get the dependencies. These are required for compiling, but you can remove them when you are done if you prefer: 30 {{{ 31 sudo 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 41 In your home directory make a new directory to put all of the source code and binaries into: 42 {{{ 43 mkdir ~/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 57 An assembler used by some libraries. 58 59 {{{ 60 cd ~/ffmpeg_sources 61 wget http://www.nasm.us/pub/nasm/releasebuilds/2.13.01/nasm-2.13.01.tar.bz2 62 tar xjvf nasm-2.13.01.tar.bz2 63 cd nasm-2.13.01 64 ./autogen.sh 65 PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" 66 make 67 make install 68 }}} 53 69 54 70 === Yasm === 55 71 56 An assembler for x86 optimizations used by x264 and FFmpeg. Highly recommended or your resulting build may be very slow.72 An assembler used by some libraries. 57 73 58 74 If your repository provides yasm version ≥ 1.2.0 then you can install that instead of compiling: … … 74 90 }}} 75 91 76 === nasm ===77 78 NASM assembler. Required for compilation of x264 and other tools.79 80 {{{81 cd ~/ffmpeg_sources82 wget http://www.nasm.us/pub/nasm/releasebuilds/2.13.01/nasm-2.13.01.tar.bz283 tar xjvf nasm-2.13.01.tar.bz284 cd nasm-2.13.0185 ./autogen.sh86 PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin"87 PATH="$HOME/bin:$PATH" make88 make install89 }}}90 91 92 === libx264 === 92 93 … … 105 106 {{{ 106 107 cd ~/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 108 git clone --depth 1 http://git.videolan.org/git/x264 109 cd x264 110 PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --enable-static 111 111 PATH="$HOME/bin:$PATH" make 112 112 make install … … 126 126 127 127 {{{ 128 sudo apt-get install cmake mercurial128 sudo apt-get install -y cmake mercurial 129 129 cd ~/ffmpeg_sources 130 130 hg clone https://bitbucket.org/multicoreware/x265 131 131 cd ~/ffmpeg_sources/x265/build/linux 132 132 PATH="$HOME/bin:$PATH" cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$HOME/ffmpeg_build" -DENABLE_SHARED:bool=off ../../source 133 make133 PATH="$HOME/bin:$PATH" make 134 134 make install 135 135 }}} … … 151 151 {{{ 152 152 cd ~/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* 153 git clone --depth 1 https://github.com/mstorsjo/fdk-aac 154 cd fdk-aac 156 155 autoreconf -fiv 157 156 ./configure --prefix="$HOME/ffmpeg_build" --disable-shared … … 176 175 {{{ 177 176 cd ~/ffmpeg_sources 178 wget http://downloads.sourceforge.net/project/lame/lame/3. 99/lame-3.99.5.tar.gz179 tar xzvf lame-3. 99.5.tar.gz180 cd lame-3. 99.5181 ./configure --prefix="$HOME/ffmpeg_build" --enable-nasm --disable-shared 182 make177 wget http://downloads.sourceforge.net/project/lame/lame/3.100/lame-3.100.tar.gz 178 tar xzvf lame-3.100.tar.gz 179 cd lame-3.100 180 PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --disable-shared --enable-nasm 181 PATH="$HOME/bin:$PATH" make 183 182 make install 184 183 }}} … … 200 199 {{{ 201 200 cd ~/ffmpeg_sources 202 wget https://archive.mozilla.org/pub/opus/opus-1. 1.5.tar.gz203 tar xzvf opus-1. 1.5.tar.gz204 cd opus-1. 1.5201 wget https://archive.mozilla.org/pub/opus/opus-1.2.tar.gz 202 tar xzvf opus-1.2.tar.gz 203 cd opus-1.2 205 204 ./configure --prefix="$HOME/ffmpeg_build" --disable-shared 206 205 make … … 223 222 224 223 {{{ 225 sudo apt-get install git226 224 cd ~/ffmpeg_sources 227 225 git clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git 228 226 cd 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 ===227 PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm 228 PATH="$HOME/bin:$PATH" make 229 make install 230 }}} 231 232 === FFmpeg === 235 233 236 234 {{{ … … 244 242 --extra-cflags="-I$HOME/ffmpeg_build/include" \ 245 243 --extra-ldflags="-L$HOME/ffmpeg_build/lib" \ 246 --extra-libs= -lpthread\244 --extra-libs="-lpthread -lm" \ 247 245 --bindir="$HOME/bin" \ 248 246 --enable-gpl \ … … 263 261 }}} 264 262 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`. 263 Compilation 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 }}} 270 269 271 270 === Usage === … … 274 273 275 274 * 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` 277 276 278 277 If you want the `ffmpeg` command to just work from anywhere: … … 282 281 283 282 {{{ 284 #!div style="border: 1p t dotted; margin: 1em; background-color: #fffff9;"283 #!div style="border: 1px solid #e5e5c7; margin: 1em; background-color: #ffd;" 285 284 '''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. 286 285 }}} … … 300 299 You 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). 301 300 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 308 301 ---- 309 302 … … 320 313 ---- 321 314 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 {{{ 318 rm -rf ~/ffmpeg_build ~/ffmpeg_sources ~/bin/{ffmpeg,ffprobe,ffplay,ffserver,x264,x265,nasm,vsyasm,yasm,ytasm} 319 sudo apt-get autoremove autoconf automake build-essential cmake git libass-dev libfreetype6-dev \ 327 320 libmp3lame-dev libopus-dev libsdl2-dev libtheora-dev libtool libva-dev libvdpau-dev \ 328 321 libvorbis-dev libvpx-dev libx264-dev libxcb1-dev libxcb-shm0-dev ibxcb-xfixes0-dev mercurial texinfo zlib1g-dev … … 335 328 == If You Need Help == 336 329 337 Feel free to ask questions at the #ffmpeg IRC channel or the [http://ffmpeg.org/contact.html ffmpeg-user] mailing list.330 Feel free to ask your questions at the #ffmpeg IRC channel or the [https://ffmpeg.org/contact.html ffmpeg-user] mailing list. 338 331 339 332 ----
