Changes between Version 19 and Version 20 of MacOSXCompilationGuide
- Timestamp:
- 02/24/2013 12:10:49 PM (3 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
MacOSXCompilationGuide
v19 v20 1 Compiling on Mac OS X is as easy as any other *nix machine, there are just a few caveats. 1 Compiling 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 3 You 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. 2 4 3 5 [[BR]][[BR]] 4 6 5 == XCode==7 == Prerequisites and Dependencies == 6 8 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 === 8 10 9 The general procedure is {{{./configure <flags>; make && sudo make install}}}, but some use a different configuration scheme, or none at all. 11 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]. 10 12 11 [[BR]][[BR]] 13 === Homebrew === 12 14 13 == Compiling on OSX using Homebrew for the dependencies == 15 To get FFmpeg for OS X, you first have to install [http://mxcl.github.com/homebrew/ Homebrew]. 14 16 15 First install [http://mxcl.github.com/homebrew/ homebrew] and some dependencies:16 17 {{{ 17 # install homebrew18 18 ruby <(curl -fsSkL raw.github.com/mxcl/homebrew/go) 19 # install dependencies 19 }}} 20 21 At 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 25 First, we need to install a few dependencies. 26 27 {{{ 20 28 brew install automake celt faac fdk-aac git lame libass libtool libvorbis libvpx \ 21 29 libvo-aacenc opencore-amr openjpeg opus sdl schroedinger shtool speex texi2html \ … … 23 31 }}} 24 32 33 Install {{{libaacplus}}} (at the moment, there is no Homebrew formula for it): 25 34 26 Install libaacplus (atm. there is no recipe for it):27 35 {{{ 28 36 wget http://217.20.164.161/~tipok/aacplus/libaacplus-2.0.2.tar.gz … … 36 44 }}} 37 45 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: 46 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: 47 39 48 {{{ 40 49 configure.ac:8: error: 'AM_CONFIG_HEADER': this macro is obsolete. … … 44 53 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` 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. 45 54 46 Install ffmpeg 55 56 [[BR]][[BR]] 57 58 == Compile FFmpeg == 59 60 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: 61 47 62 {{{ 48 63 git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg … … 56 71 }}} 57 72 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: 73 Finally 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 59 75 {{{ 60 76 make tools/qt-faststart 61 77 }}} 62 78 79 You can use it like this: 80 81 {{{ 82 qt-faststart input.mp4 output.mp4 83 }}} 84 63 85 [[BR]][[BR]] 64 86 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 == 71 88 72 89 === Pkg-config & GLib === … … 83 100 Yasm 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}}} 84 101 85 [[BR]][[BR]] 86 87 == Additional libraries == 102 === Additional libraries === 88 103 89 104 These are just some examples. Run {{{.configure --help}}} for all available options. 90 105 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.


