Changes between Version 142 and Version 143 of CompilationGuide/Ubuntu


Ignore:
Timestamp:
Nov 8, 2017, 6:09:50 PM (18 months ago)
Author:
slhck
Comment:

update commands to use chaining and auto-update for repos; move vpx up; more explanations; add hint about parallel compilation

Legend:

Unmodified
Added
Removed
Modified
  • CompilationGuide/Ubuntu

    v142 v143  
    3030{{{
    3131#!sh
    32 sudo apt-get update -qq && apt-get -y install autoconf automake build-essential git libass-dev libfreetype6-dev \
    33   libsdl2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libxcb1-dev libxcb-shm0-dev \
    34   libxcb-xfixes0-dev pkg-config texinfo wget zlib1g-dev
     32apt-get update -qq && apt-get -y install \
     33  autoconf \
     34  automake \
     35  build-essential \
     36  cmake \
     37  git \
     38  libass-dev \
     39  libfreetype6-dev \
     40  libsdl2-dev \
     41  libtheora-dev \
     42  libtool \
     43  libva-dev \
     44  libvdpau-dev \
     45  libvorbis-dev \
     46  libxcb1-dev \
     47  libxcb-shm0-dev \
     48  libxcb-xfixes0-dev \
     49  mercurial \
     50  pkg-config \
     51  texinfo \
     52  wget \
     53  zlib1g-dev
    3554}}}
    3655
     
    4362{{{
    4463#!sh
    45 mkdir ~/ffmpeg_sources ~/bin
     64mkdir -p ~/ffmpeg_sources ~/bin
    4665}}}
    4766
     
    5069== Compilation & Installation ==
    5170
     71This guide assumes that you want to install some of the most common third-party libraries. Each section provides you with the commands needed to install that library.
     72
     73For each section, copy-paste the entire code-block into your shell.
     74
     75If you do not require certain features, you may skip the relevant section (if it is not required) and then remove the appropriate `./configure` option in FFmpeg. For example, if libvorbis is not needed, skip that section and then remove `--enable-libvorbis` from the [#FFmpeg Install FFmpeg] section.
     76
    5277{{{
    5378#!div style="border: 1px solid #c7e5c7; margin: 1em; background-color: #ddffdd;"
    54 '''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.
     79'''Tip:''' To significantly speed up the compilation process on systems with multiple cores, you can type `MAKEFLAGS="-j4"` into your shell before executing the below commands.
    5580}}}
    5681
     
    6186{{{
    6287#!sh
    63 cd ~/ffmpeg_sources
    64 wget http://www.nasm.us/pub/nasm/releasebuilds/2.13.01/nasm-2.13.01.tar.bz2
    65 tar xjvf nasm-2.13.01.tar.bz2
    66 cd nasm-2.13.01
    67 ./autogen.sh
    68 PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin"
    69 make
     88cd ~/ffmpeg_sources && \
     89wget http://www.nasm.us/pub/nasm/releasebuilds/2.13.01/nasm-2.13.01.tar.bz2 && \
     90tar xjvf nasm-2.13.01.tar.bz2 && \
     91cd nasm-2.13.01 && \
     92./autogen.sh && \
     93PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" && \
     94make && \
    7095make install
    7196}}}
     
    86111{{{
    87112#!sh
    88 cd ~/ffmpeg_sources
    89 wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
    90 tar xzvf yasm-1.3.0.tar.gz
    91 cd yasm-1.3.0
    92 ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin"
    93 make
     113cd ~/ffmpeg_sources && \
     114wget -O yasm-1.3.0.tar.gz http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz && \
     115tar xzvf yasm-1.3.0.tar.gz && \
     116cd yasm-1.3.0 && \
     117./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" && \
     118make && \
    94119make install
    95120}}}
     
    112137{{{
    113138#!sh
    114 cd ~/ffmpeg_sources
    115 git clone --depth 1 http://git.videolan.org/git/x264
    116 cd x264
    117 PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --enable-static
    118 PATH="$HOME/bin:$PATH" make
     139cd ~/ffmpeg_sources && \
     140git -C x264 pull 2> /dev/null || git clone --depth 1 http://git.videolan.org/git/x264 && \
     141cd x264 && \
     142PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --enable-static && \
     143PATH="$HOME/bin:$PATH" make && \
    119144make install
    120145}}}
     
    135160{{{
    136161#!sh
    137 sudo apt-get install -y cmake mercurial
    138 cd ~/ffmpeg_sources
    139 hg clone https://bitbucket.org/multicoreware/x265
    140 cd ~/ffmpeg_sources/x265/build/linux
    141 PATH="$HOME/bin:$PATH" cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$HOME/ffmpeg_build" -DENABLE_SHARED:bool=off ../../source
    142 PATH="$HOME/bin:$PATH" make
     162cd ~/ffmpeg_sources && \
     163if cd x265 2> /dev/null; then hg pull && hg update; else hg clone https://bitbucket.org/multicoreware/x265; fi && \
     164cd x265/build/linux && \
     165PATH="$HOME/bin:$PATH" cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$HOME/ffmpeg_build" -DENABLE_SHARED:bool=off ../../source && \
     166PATH="$HOME/bin:$PATH" make && \
     167make install
     168}}}
     169
     170=== libvpx ===
     171
     172VP8/VP9 video encoder and decoder. See the [[Encode/VP9|VP9 Video Encoding Guide]] for more information and usage examples.
     173
     174Requires `ffmpeg` to be configured with `--enable-libvpx`.
     175
     176If your repository provides `libvpx-dev` version ≥ 0.9.7 then you can install that instead of compiling:
     177
     178{{{
     179#!sh
     180sudo apt-get install libvpx-dev
     181}}}
     182
     183Otherwise you can compile:
     184
     185{{{
     186#!sh
     187cd ~/ffmpeg_sources && \
     188git -C libvpx pull 2> /dev/null || git clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git && \
     189cd libvpx && \
     190PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm && \
     191PATH="$HOME/bin:$PATH" make && \
    143192make install
    144193}}}
     
    161210{{{
    162211#!sh
    163 cd ~/ffmpeg_sources
    164 git clone --depth 1 https://github.com/mstorsjo/fdk-aac
    165 cd fdk-aac
    166 autoreconf -fiv
    167 ./configure --prefix="$HOME/ffmpeg_build" --disable-shared
    168 make
     212cd ~/ffmpeg_sources && \
     213git -C fdk-aac pull 2> /dev/null || git clone --depth 1 https://github.com/mstorsjo/fdk-aac && \
     214cd fdk-aac && \
     215autoreconf -fiv && \
     216./configure --prefix="$HOME/ffmpeg_build" --disable-shared && \
     217make && \
    169218make install
    170219}}}
     
    187236{{{
    188237#!sh
    189 cd ~/ffmpeg_sources
    190 wget http://downloads.sourceforge.net/project/lame/lame/3.100/lame-3.100.tar.gz
    191 tar xzvf lame-3.100.tar.gz
    192 cd lame-3.100
    193 PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --disable-shared --enable-nasm
    194 PATH="$HOME/bin:$PATH" make
     238cd ~/ffmpeg_sources && \
     239wget -O lame-3.100.tar.gz http://downloads.sourceforge.net/project/lame/lame/3.100/lame-3.100.tar.gz && \
     240tar xzvf lame-3.100.tar.gz && \
     241cd lame-3.100 && \
     242PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --disable-shared --enable-nasm && \
     243PATH="$HOME/bin:$PATH" make && \
    195244make install
    196245}}}
     
    213262{{{
    214263#!sh
    215 cd ~/ffmpeg_sources
    216 wget https://archive.mozilla.org/pub/opus/opus-1.2.tar.gz
    217 tar xzvf opus-1.2.tar.gz
    218 cd opus-1.2
    219 ./configure --prefix="$HOME/ffmpeg_build" --disable-shared
    220 make
    221 make install
    222 }}}
    223 
    224 === libvpx ===
    225 
    226 VP8/VP9 video encoder and decoder. See the [[Encode/VP9|VP9 Video Encoding Guide]] for more information and usage examples.
    227 
    228 Requires `ffmpeg` to be configured with `--enable-libvpx`.
    229 
    230 If your repository provides `libvpx-dev` version ≥ 0.9.7 then you can install that instead of compiling:
    231 
    232 {{{
    233 #!sh
    234 sudo apt-get install libvpx-dev
    235 }}}
    236 
    237 Otherwise you can compile:
    238 
    239 {{{
    240 #!sh
    241 cd ~/ffmpeg_sources
    242 git clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git
    243 cd libvpx
    244 PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm
    245 PATH="$HOME/bin:$PATH" make
     264cd ~/ffmpeg_sources && \
     265git -C opus pull 2> /dev/null || git clone --depth 1 https://github.com/xiph/opus.git && \
     266cd opus && \
     267./autogen.sh && \
     268./configure --prefix="$HOME/ffmpeg_build" --disable-shared && \
     269make && \
    246270make install
    247271}}}
     
    251275{{{
    252276#!sh
    253 cd ~/ffmpeg_sources
    254 wget http://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2
    255 tar xjvf ffmpeg-snapshot.tar.bz2
    256 cd ffmpeg
     277cd ~/ffmpeg_sources && \
     278wget -O ffmpeg-snapshot.tar.bz2 http://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2 && \
     279tar xjvf ffmpeg-snapshot.tar.bz2 && \
     280cd ffmpeg && \
    257281PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure \
    258282  --prefix="$HOME/ffmpeg_build" \
     
    273297  --enable-libx264 \
    274298  --enable-libx265 \
    275   --enable-nonfree
    276 PATH="$HOME/bin:$PATH" make
     299  --enable-nonfree && \
     300PATH="$HOME/bin:$PATH" make && \
    277301make install
    278302hash -r
     
    321345{{{
    322346#!sh
    323 rm -rf ~/ffmpeg_build ~/ffmpeg_sources ~/bin/{ffmpeg,ffprobe,ffplay,ffserver,x264,x265}
    324 }}}
    325 
    326 Now just follow the guide from the beginning.
     347rm -rf ~/ffmpeg_build ~/bin/{ffmpeg,ffprobe,ffplay,ffserver,x264,x265}
     348}}}
     349
     350Now can just follow the guide from the beginning.
    327351
    328352----
     
    330354== Reverting Changes made by this Guide ==
    331355
     356Remove the build and source files as well as the binaries:
     357
    332358{{{
    333359#!sh
    334360rm -rf ~/ffmpeg_build ~/ffmpeg_sources ~/bin/{ffmpeg,ffprobe,ffplay,ffserver,x264,x265,nasm,vsyasm,yasm,ytasm}
    335 sudo apt-get autoremove autoconf automake build-essential cmake git libass-dev libfreetype6-dev \
    336   libmp3lame-dev libopus-dev libsdl2-dev libtheora-dev libtool libva-dev libvdpau-dev \
    337   libvorbis-dev libvpx-dev libx264-dev libxcb1-dev libxcb-shm0-dev ibxcb-xfixes0-dev mercurial texinfo zlib1g-dev
    338361sed -i '/ffmpeg_build/d' ~/.manpath
    339362hash -r
     363}}}
     364
     365You may also remove packages that have been installed from this guide:
     366
     367{{{
     368#!sh
     369sudo apt-get autoremove autoconf automake build-essential cmake git libass-dev libfreetype6-dev   libmp3lame-dev libopus-dev libsdl2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libvpx-dev libx264-dev libx265-dev libxcb1-dev libxcb-shm0-dev ibxcb-xfixes0-dev mercurial texinfo wget zlib1g-dev
    340370}}}
    341371