Changes between Version 19 and Version 20 of CompilationGuide/MacOSX


Ignore:
Timestamp:
Feb 24, 2013, 1:10:49 PM (6 years ago)
Author:
slhck
Comment:

removed duplicate info, and restructured; formatting

Legend:

Unmodified
Added
Removed
Modified
  • CompilationGuide/MacOSX

    v19 v20  
    1 Compiling on Mac OS X is as easy as any other *nix machine, there are just a few caveats. 
     1Compiling on Mac OS X is as easy as any other *nix machine, there are just a few caveats. The general procedure is {{{./configure <flags>; make && sudo make install}}}, but some use a different configuration scheme, or none at all.  
     2 
     3You can also install the latest stable version of FFmpeg without the need to compile it yourself, which saves you a bit of time. Just follow this guide. 
    24 
    35[[BR]][[BR]] 
    46 
    5 == XCode == 
     7== Prerequisites and Dependencies == 
    68 
    7 Starting with Lion 10.7, Xcode is available for free from the Mac App Store and is required to compile anything on your Mac. Make sure you install the Command Line Tools from Preferences > Downloads > Components. Older versions are still available with an AppleID and free Developer account at [http://developer.apple.com developer.apple.com]  
     9=== XCode  === 
    810 
    9 The general procedure is {{{./configure <flags>; make && sudo make install}}}, but some use a different configuration scheme, or none at all.  
     11Starting with Lion 10.7, Xcode is available for free from the Mac App Store and is required to compile anything on your Mac. Make sure you install the Command Line Tools from Preferences > Downloads > Components. Older versions are still available with an AppleID and free Developer account at [http://developer.apple.com developer.apple.com]. 
    1012 
    11 [[BR]][[BR]] 
     13=== Homebrew === 
    1214 
    13 == Compiling on OSX using Homebrew for the dependencies == 
     15To get FFmpeg for OS X, you first have to install [http://mxcl.github.com/homebrew/ Homebrew]. 
    1416 
    15 First install [http://mxcl.github.com/homebrew/ homebrew] and some dependencies: 
    1617{{{ 
    17 # install homebrew 
    1818ruby <(curl -fsSkL raw.github.com/mxcl/homebrew/go) 
    19 # install dependencies 
     19}}} 
     20 
     21At this point, you could already run {{{brew install ffmpeg}}} to get the latest stable version. This version is packaged as a Homebrew Formula and will take care of all the dependencies and installation. Run {{{brew info ffmpeg}}} to see additional configuration options. If instead you want to manually compile the latest Git version of FFmpeg, continue with this guide. 
     22 
     23=== Remaining Dependencies === 
     24 
     25First, we need to install a few dependencies. 
     26 
     27{{{ 
    2028brew install automake celt faac fdk-aac git lame libass libtool libvorbis libvpx \ 
    2129libvo-aacenc opencore-amr openjpeg opus sdl schroedinger shtool speex texi2html \ 
     
    2331}}} 
    2432 
     33Install {{{libaacplus}}} (at the moment, there is no Homebrew formula for it): 
    2534 
    26 Install libaacplus (atm. there is no recipe for it): 
    2735{{{ 
    2836wget http://217.20.164.161/~tipok/aacplus/libaacplus-2.0.2.tar.gz 
     
    3644}}} 
    3745 
    38 The new version of autoconf requires that you replace AM_CONFIG_HEADER in configure.ac at line 8 with AC_CONFIG_HEADERS. If you don't make this change you will see the following error message in the terminal: 
     46The new version of autoconf requires that you replace {{{AM_CONFIG_HEADER}}} in {{{configure.ac}}} at line 8 with {{{AC_CONFIG_HEADERS}}}. If you don't make this change you will see the following error message in the terminal: 
     47 
    3948{{{ 
    4049configure.ac:8: error: 'AM_CONFIG_HEADER': this macro is obsolete. 
     
    4453Mac OS X Lion comes with Freetype already installed (older versions may need 'X11' selected during installation), but in an atypical location: /usr/X11. Running freetype-config in Terminal can give the locations of the individual folders, like headers, and libraries, so be prepared to add lines like {{{CFLAGS=`freetype-config --cflags` LDFLAGS=`freetype-config --libs` PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig:/usr/lib/pkgconfig:/usr/X11/lib/pkgconfig }}} before {{{./configure}}} or add them to your $HOME/.profile file. 
    4554 
    46 Install ffmpeg 
     55 
     56[[BR]][[BR]] 
     57 
     58== Compile FFmpeg == 
     59 
     60Once you have compiled all of the codecs/libraries you want, you can now download the FFmpeg source either with Git or the from release tarball links on the website. Study the output of {{{./configure --help}}} and make sure you've enabled all the features you want, remembering that --enable-nonfree and --enable-gpl will be necessary for some of the dependencies above. A sample command is: 
     61 
    4762{{{ 
    4863git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg 
     
    5671}}} 
    5772 
    58 Finally install qt-faststart. This is a useful tool if you're showing your H.264 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. Code:  
     73Finally install {{{qt-faststart}}}. This is a useful tool if you're showing your H.264 MP4 videos on the web. It relocates the [http://www.adobe.com/devnet/video/articles/mp4_movie_atom.html MOOV atom] in the video to allow playback to begin before the file is completely downloaded.  
     74 
    5975{{{ 
    6076make tools/qt-faststart 
    6177}}} 
    6278 
     79You can use it like this:  
     80 
     81{{{ 
     82qt-faststart input.mp4 output.mp4 
     83}}} 
     84 
    6385[[BR]][[BR]] 
    6486 
    65 == Manual install of the dependencies  == 
    66  
    67 === Freetype  === 
    68  
    69 Mac OS X Lion comes with Freetype already installed (older versions may need 'X11' selected during installation), but in an atypical location: /usr/X11. Running freetype-config in Terminal can give the locations of the individual folders, like headers, and libraries, so be prepared to add lines like {{{CFLAGS=`freetype-config --cflags` LDFLAGS=`freetype-config --libs`}}} before {{{./configure}}} when configuring packages that require freetype like gd and png.  
    70  
     87== Manual install of the dependencies without Homebrew  == 
    7188 
    7289=== Pkg-config & GLib  === 
     
    83100Yasm is available from [http://yasm.tortall.net/Download.html tortall.net] and is necessary for compiling C code that contains machine-independent Assembler code. To compile, run {{{./configure --enable-python; make && sudo make install}}}  
    84101 
    85 [[BR]][[BR]] 
    86  
    87 == Additional libraries  == 
     102=== Additional libraries  === 
    88103 
    89104These are just some examples. Run {{{.configure --help}}} for all available options. 
    90105 
    91 FAAC (AAC) is available at [http://www.audiocoding.com audiocoding.com]. Enabling support in ffmpeg requires the `--enable-libfaac --enable-nonfree` configure options.  
    92  
    93 Lame (MP3) is available at [http://sourceforge.net/projects/lame/files/lame/], and adds MP3 encoding to FFmpeg. Enabling support in ffmpeg requires `--enable-libmp3lame`.  
    94  
    95 Libass (Subtitle) is available at [http://code.google.com/p/libass/]. In order to compile with `--enable-libass` you need Freetype installed.  
    96  
    97 OpenJPEG (Jpeg 2000) is available at [http://code.google.com/p/openjpeg/downloads/list] . Compile with --enable-libopenjpeg . 
    98  
    99 Schroedinger, which adds Dirac codec support, is available from [http://diracvideo.org/ diracvideo.org]. To compile schroedinger, you need ORC, available from [http://code.entropywave.com/download/orc/ entropywave.com]. Compile orc with the standard procedure, making sure you delete the "testsuite" folder, which won't compile. When compiling schroedinger, make sure pkg-config and yasm are already installed.  
    100  
    101 Speex is available at [http://downloads.xiph.org/releases/speex/ xiph.org]. Compile with --enable-libspeex . 
    102  
    103 Theora, Ogg and Vorbis  are available at [http://theora.org/ theora.org]. Compile with --enable-libtheora . 
    104  
    105 VPX is available at [http://code.google.com/p/webm/downloads/list]. Compile with --enable-libvpx . 
    106  
    107 x264 is available at [http://www.videolan.org/developers/x264.html]. FFmpeg depends on x264 when compiled with --enable-libx264 and x264 depends on FFmpeg when compiled with --enable-lavf-input . The best way to handle it is to install x264 first without --enable-lavf-input then compile FFmpeg with --enable-libx264 and finally compile x264 again with --enable-lavf-input .  
    108  
    109 XVid is available from [http://www.xvid.org xvid.org]. Compile with --enable-libxvid .  
    110  
    111 [[BR]][[BR]] 
    112  
    113 == Compiling  == 
    114  
    115 Once you have compiled all of the codecs/libraries you want, you can now download the FFmpeg source either with git or the from release tarball links on the website. Study the output of ./configure --help and make sure you've enabled all the features you want, remembering that --enable-nonfree and --enable-gpl will be necessary for some of the dependencies above. A sample command is:  
    116  
    117 {{{ 
    118 ./configure --enable-nonfree --enable-libcdio --enable-libschroedinger --enable-libfaac --enable-libfreetype --enable-libmp3lame --enable-libopenjpeg --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-openssl --enable-zlib --enable-gpl 
    119  
    120 make 
    121 make install 
    122 }}}  
    123  
    124  
    125  
    126 === Install qt-faststart (optional)  === 
    127  
    128 This is a useful tool if you're showing your H.264 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. Code:  
    129  
    130 {{{ 
    131 make tools/qt-faststart 
    132 }}} 
     106* FAAC (AAC) is available at [http://www.audiocoding.com audiocoding.com]. Enabling support in ffmpeg requires the `--enable-libfaac --enable-nonfree` configure options.  
     107* Lame (MP3) is available at [http://sourceforge.net/projects/lame/files/lame/], and adds MP3 encoding to FFmpeg. Enabling support in ffmpeg requires `--enable-libmp3lame`.  
     108* Libass (Subtitle) is available at [http://code.google.com/p/libass/]. In order to compile with `--enable-libass` you need Freetype installed.  
     109* OpenJPEG (Jpeg 2000) is available at [http://code.google.com/p/openjpeg/downloads/list] . Compile with `--enable-libopenjpeg`. 
     110* Schroedinger, which adds Dirac codec support, is available from [http://diracvideo.org/ diracvideo.org]. To compile schroedinger, you need ORC, available from [http://code.entropywave.com/download/orc/ entropywave.com]. Compile orc with the standard procedure, making sure you delete the "testsuite" folder, which won't compile. When compiling schroedinger, make sure pkg-config and yasm are already installed.  
     111* Speex is available at [http://downloads.xiph.org/releases/speex/ xiph.org]. Compile with `--enable-libspeex`. 
     112* Theora, Ogg and Vorbis  are available at [http://theora.org/ theora.org]. Compile with `--enable-libtheora`. 
     113* VPX is available at [http://code.google.com/p/webm/downloads/list]. Compile with `--enable-libvpx`. 
     114* x264 is available at [http://www.videolan.org/developers/x264.html]. FFmpeg depends on x264 when compiled with `--enable-libx264` and x264 depends on FFmpeg when compiled with `--enable-lavf-input`. The best way to handle it is to install x264 first without `--enable-lavf-input`, then compile FFmpeg with `--enable-libx264` and finally compile x264 again with `--enable-lavf-input`. 
     115* XviD is available from [http://www.xvid.org xvid.org]. Compile with --enable-libxvid.