├── .gitignore ├── LICENSE ├── README.md ├── build-ffmpeg ├── compare.png ├── compare2.png ├── defish.sh ├── fishandstab.sh ├── fishcompare.sh ├── sidebyside.sh └── web-install.sh /.gitignore: -------------------------------------------------------------------------------- 1 | packages 2 | workspace 3 | .idea 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Bash script to build and install ffmpeg on Mac OSX and Linux 2 | ========== 3 | 4 | Enhanced version of https://github.com/rtgoodwin/ffmpeg-build-script-plus-frei0r-freetype and its source https://github.com/markus-perl/ffmpeg-build-script . 5 | 6 | The original build script provides an easy way to build ffmpeg on OSX and Linux with non-free codecs in addition to the frei0r plugins (for doing fisheye removal on cameras like GoPro, Mobius, etc.), Freetype (for doing text overlays) and fontconfig (plus dependency libxml2). 7 | 8 | This version also adds support for [avfoundation](https://www.ffmpeg.org/ffmpeg-devices.html#avfoundation), and continued updates to latest versions. 9 | 10 | ## Supported Codecs 11 | * x264: H.264 (MPEG-4 AVC) 12 | * x265: H.265 Video Codec 13 | * fdk_aac: Fraunhofer FDK AAC Codec 14 | * xvidcore: MPEG-4 video coding standard 15 | * webm: WebM is a video file format 16 | * mp3: MPEG-1 or MPEG-2 Audio Layer III 17 | * ogg: Free, open container format 18 | * vorbis: Lossy audio compression format 19 | * theora: Free lossy video compression format 20 | 21 | Requirements OSX 22 | ------------ 23 | 24 | * XCode 5.x or greater with command line tools installed. Use either the Xcode UI, or from the terminal: 25 | 26 | ```xcode-select --install``` 27 | 28 | Requirements Linux 29 | ------------ 30 | * Debian >= Wheezy, Ubuntu => Trusty, other Distros might work too 31 | * build-essentials installed: 32 | 33 | ``` 34 | # Debian and Ubuntu 35 | sudo apt-get install build-essential curl 36 | 37 | # Fedora 38 | sudo dnf install @development-tools 39 | ``` 40 | 41 | Installation 42 | ------------ 43 | 44 | ### Quick install and run 45 | 46 | Open your command line and run (needs curl to be installed): 47 | 48 | ``` 49 | bash <(curl -s https://raw.githubusercontent.com/zoharbabin/ffmpeg-build-macosx/master/web-install.sh?v1) 50 | ``` 51 | This command downloads the build script and automatically starts the build process. 52 | 53 | ### Common installation 54 | 55 | ``` 56 | git clone https://github.com/zoharbabin/ffmpeg-build-macosx.git 57 | cd ffmpeg-build-script 58 | ./ffmpeg-build-script --help 59 | ``` 60 | 61 | Usage 62 | ------ 63 | 64 | ``` 65 | ./build-ffmpeg --help Display usage information 66 | ./build-ffmpeg --build Starts the build process 67 | ./build-ffmpeg --cleanup Remove all working dirs 68 | ``` 69 | 70 | 71 | Contact 72 | ------- 73 | 74 | You can file an issue on this repo; or tweet @zohar; or E-Mail at z [dot] babin (@) gmail . 75 | 76 | If you'd like to contact the original creators: 77 | * Github: [http://www.github.com/markus-perl](http://www.github.com/markus-perl) 78 | * Github: [https://github.com/rtgoodwin](https://github.com/rtgoodwin) 79 | 80 | Tested on 81 | --------- 82 | 83 | * Mac OSX 10.11 64Bit XCode 7.* 84 | * Debian 8.3 85 | 86 | Example fisheye removal for GoPro/Mobius 87 | ------- 88 | * For Mobius lens "C": 89 | 90 | ```ffmpeg -i -vf frei0r=defish0r:0.8:y:0.6:0 -vcodec libx264 -pix_fmt yuv420p -acodec copy ``` 91 | 92 | ![Example of cleaned up image](https://github.com/rtgoodwin/ffmpeg-build-script-plus-frei0r-freetype/blob/master/compare.png) 93 | 94 | and another 95 | 96 | ![Example of cleaned up image](https://github.com/rtgoodwin/ffmpeg-build-script-plus-frei0r-freetype/blob/master/compare2.png) 97 | 98 | (Blur at edges is in the original video; keep those lenses clean, people! :) ) 99 | 100 | * For GoPro (or other cameras with less barrel distortion): 101 | 102 | ```ffmpeg -i -vf frei0r=defish0r:0.75:y:0.6:0 -vcodec libx264 -pix_fmt yuv420p -acodec copy ``` 103 | 104 | 105 | 106 | Example compilation output 107 | ------- 108 | 109 | ``` 110 | zohar.babin$ ./build-ffmpeg --build 111 | ffmpeg-build-script v 112 | ========================= 113 | 114 | Using 4 make jobs simultaneously. 115 | 116 | building nasm 117 | ======================= 118 | Downloading http://www.nasm.us/pub/nasm/releasebuilds/2.13.01/nasm-2.13.01.tar.gz... Done 119 | $ ./configure --prefix=/Users/zohar.babin/Downloads/ffmpeg-build/workspace 120 | $ make -j 4 121 | $ make install 122 | 123 | building yasm 124 | ======================= 125 | Downloading http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz... Done 126 | $ ./configure --prefix=/Users/zohar.babin/Downloads/ffmpeg-build/workspace 127 | $ make -j 4 128 | $ make install 129 | 130 | building opencore 131 | ======================= 132 | Downloading http://downloads.sourceforge.net/project/opencore-amr/opencore-amr/opencore-amr-0.1.5.tar.gz?r=http0X0P+00.0000000.000000sourceforge.net0.000000projects0.000000opencore-amr0.000000files0.000000opencore-amr0.000000&ts=1442256558&use_mirror=netassist 133 | Failed to download http://downloads.sourceforge.net/project/opencore-amr/opencore-amr/opencore-amr-0.1.5.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fopencore-amr%2Ffiles%2Fopencore-amr%2F&ts=1442256558&use_mirror=netassist. Exitcode 18. Retrying in 10 seconds 134 | ... Done 135 | $ ./configure --prefix=/Users/zohar.babin/Downloads/ffmpeg-build/workspace --disable-shared --enable-static 136 | $ make -j 4 137 | $ make install 138 | 139 | building libvpx 140 | ======================= 141 | Downloading https://github.com/webmproject/libvpx/archive/v1.5.0.tar.gz... Done 142 | sed: -i may not be used with stdin 143 | $ ./configure --prefix=/Users/zohar.babin/Downloads/ffmpeg-build/workspace --disable-unit-tests --disable-shared 144 | $ make -j 4 145 | $ make install 146 | 147 | building lame 148 | ======================= 149 | Downloading http://kent.dl.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz... Done 150 | $ ./configure --prefix=/Users/zohar.babin/Downloads/ffmpeg-build/workspace --disable-shared --enable-static 151 | $ make -j 4 152 | $ make install 153 | 154 | building xvidcore 155 | ======================= 156 | Downloading http://downloads.xvid.org/downloads/xvidcore-1.3.4.tar.gz... Done 157 | $ ./configure --prefix=/Users/zohar.babin/Downloads/ffmpeg-build/workspace --disable-shared --enable-static 158 | $ make -j 4 159 | $ make install 160 | $ rm /Users/zohar.babin/Downloads/ffmpeg-build/workspace/lib/libxvidcore.4.dylib 161 | 162 | building x264 163 | ======================= 164 | Downloading ftp://ftp.videolan.org/pub/x264/snapshots/x264-snapshot-20170328-2245.tar.bz2... Done 165 | $ ./configure --prefix=/Users/zohar.babin/Downloads/ffmpeg-build/workspace --disable-shared --enable-static 166 | $ make -j 4 167 | $ make install 168 | $ make install-lib-static 169 | 170 | building libogg 171 | ======================= 172 | Downloading http://downloads.xiph.org/releases/ogg/libogg-1.3.2.tar.gz... Done 173 | $ ./configure --prefix=/Users/zohar.babin/Downloads/ffmpeg-build/workspace --disable-shared --enable-static 174 | $ make -j 4 175 | $ make install 176 | 177 | building libvorbis 178 | ======================= 179 | Downloading http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.5.tar.gz... Done 180 | $ ./configure --prefix=/Users/zohar.babin/Downloads/ffmpeg-build/workspace --with-ogg-libraries=/Users/zohar.babin/Downloads/ffmpeg-build/workspace/lib --with-ogg-includes=/Users/zohar.babin/Downloads/ffmpeg-build/workspace/include/ --enable-static --disable-shared --disable-oggtest 181 | $ make -j 4 182 | $ make install 183 | 184 | building libtheora 185 | ======================= 186 | Downloading http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.gz... Done 187 | $ ./configure --prefix=/Users/zohar.babin/Downloads/ffmpeg-build/workspace --with-ogg-libraries=/Users/zohar.babin/Downloads/ffmpeg-build/workspace/lib --with-ogg-includes=/Users/zohar.babin/Downloads/ffmpeg-build/workspace/include/ --with-vorbis-libraries=/Users/zohar.babin/Downloads/ffmpeg-build/workspace/lib --with-vorbis-includes=/Users/zohar.babin/Downloads/ffmpeg-build/workspace/include/ --enable-static --disable-shared --disable-oggtest --disable-vorbistest --disable-examples --disable-asm 188 | $ make -j 4 189 | $ make install 190 | 191 | building pkg-config 192 | ======================= 193 | Downloading http://pkgconfig.freedesktop.org/releases/pkg-config-0.29.1.tar.gz... Done 194 | $ ./configure --silent --prefix=/Users/zohar.babin/Downloads/ffmpeg-build/workspace --with-pc-path=/Users/zohar.babin/Downloads/ffmpeg-build/workspace/lib/pkgconfig --with-internal-glib 195 | $ make -j 4 196 | $ make install 197 | 198 | building freetype 199 | ======================= 200 | Downloading http://download.savannah.gnu.org/releases/freetype/freetype-2.8.tar.gz... Done 201 | $ ./configure --silent --prefix=/Users/zohar.babin/Downloads/ffmpeg-build/workspace --with-pc-path=/Users/zohar.babin/Downloads/ffmpeg-build/workspace/lib/pkgconfig --disable-shared --enable-static 202 | $ make -j 4 203 | $ make install 204 | 205 | building fontconfig 206 | ======================= 207 | Downloading http://www.freedesktop.org/software/fontconfig/release/fontconfig-2.11.94.tar.gz... Done 208 | $ ./configure --silent --prefix=/Users/zohar.babin/Downloads/ffmpeg-build/workspace --with-pc-path=/Users/zohar.babin/Downloads/ffmpeg-build/workspace/lib/pkgconfig --disable-shared --enable-static 209 | $ make -j 4 210 | $ make install 211 | 212 | building cmake 213 | ======================= 214 | Downloading https://cmake.org/files/v3.5/cmake-3.5.2.tar.gz... Done 215 | $ ./configure --prefix=/Users/zohar.babin/Downloads/ffmpeg-build/workspace 216 | $ make -j 4 217 | $ make install 218 | 219 | building vid_stab 220 | ======================= 221 | Downloading https://codeload.github.com/georgmartius/vid.stab/legacy.tar.gz/release-0.98b... Done 222 | $ cmake -DCMAKE_INSTALL_PREFIX:PATH=/Users/zohar.babin/Downloads/ffmpeg-build/workspace . 223 | $ make install 224 | 225 | building x265 226 | ======================= 227 | Downloading https://bitbucket.org/multicoreware/x265/downloads/x265_2.3.tar.gz... Done 228 | $ cmake -DCMAKE_INSTALL_PREFIX:PATH=/Users/zohar.babin/Downloads/ffmpeg-build/workspace -DENABLE_SHARED:bool=off . 229 | $ make -j 4 230 | $ make install 231 | 232 | building fdk_aac 233 | ======================= 234 | Downloading http://downloads.sourceforge.net/project/opencore-amr/fdk-aac/fdk-aac-0.1.5.tar.gz?r=https0X0P+00.0000000.000000sourceforge.net0.000000projects0.000000opencore-amr0.000000files0.000000fdk-aac0.000000&ts=1457561564&use_mirror=kent... Done 235 | $ ./configure --prefix=/Users/zohar.babin/Downloads/ffmpeg-build/workspace --disable-shared --enable-static 236 | $ make -j 4 237 | $ make install 238 | 239 | building frei0r 240 | ======================= 241 | Downloading https://files.dyne.org/frei0r/releases/frei0r-plugins-1.6.1.tar.gz... Done 242 | $ cmake -DCMAKE_INSTALL_PREFIX:PATH=/Users/zohar.babin/Downloads/ffmpeg-build/workspace . 243 | $ make -s install 244 | 245 | building ffmpeg 246 | ======================= 247 | Downloading http://ffmpeg.org/releases/ffmpeg-3.3.4.tar.bz2... Done 248 | $ ./configure --arch=64 --prefix=/Users/zohar.babin/Downloads/ffmpeg-build/workspace --extra-cflags=-I/Users/zohar.babin/Downloads/ffmpeg-build/workspace/include --extra-cflags=-I/Users/zohar.babin/Downloads/ffmpeg-build/workspace/include/vorbis --extra-cflags=-I/Users/zohar.babin/Downloads/ffmpeg-build/workspace/include/freetype2 --extra-ldflags=-L/Users/zohar.babin/Downloads/ffmpeg-build/workspace/lib --extra-version=static --disable-debug --disable-shared --enable-static --enable-libopencore_amrwb --enable-libopencore_amrnb --extra-cflags=--static --disable-ffplay --disable-ffserver --disable-doc --enable-gpl --enable-version3 --enable-nonfree --enable-pthreads --enable-libvpx --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libx265 --enable-runtime-cpudetect --enable-libfdk-aac --enable-avfilter --enable-libopencore_amrwb --enable-libopencore_amrnb --enable-filters --enable-libvidstab --enable-frei0r --enable-indev=avfoundation 249 | $ make -j 4 250 | $ make install 251 | 252 | Building done. The binary can be found here: /Users/zohar.babin/Downloads/ffmpeg-build/workspace/bin/ffmpeg 253 | 254 | Install the binary to your /usr/local/bin folder? [Y/n] 255 | 256 | The frei0r plugins can be found here: /Users/zohar.babin/Downloads/ffmpeg-build/workspace/lib/ in a folder named "frei0r-1" 257 | 258 | Copy frei0r plugins to your /usr/local/lib/frei0r-1 folder [Y/n] 259 | ``` 260 | -------------------------------------------------------------------------------- /build-ffmpeg: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Enhanced version of https://github.com/rtgoodwin/ffmpeg-build-script-plus-frei0r-freetype and its source https://github.com/markus-perl/ffmpeg-build-script 4 | # Version 0.8zb2 5 | 6 | CWD=$(pwd) 7 | PACKAGES="$CWD/packages" 8 | WORKSPACE="$CWD/workspace" 9 | CC=clang 10 | LDFLAGS="-L${WORKSPACE}/lib -lm" 11 | CFLAGS="-I${WORKSPACE}/include" 12 | PKG_CONFIG_PATH="${WORKSPACE}/lib/pkgconfig" 13 | 14 | # Speed up the process 15 | # Env Var NUMJOBS overrides automatic detection 16 | if [[ -n $NUMJOBS ]]; then 17 | MJOBS=$NUMJOBS 18 | elif [[ -f /proc/cpuinfo ]]; then 19 | MJOBS=$(grep -c processor /proc/cpuinfo) 20 | elif [[ "$OSTYPE" == "darwin"* ]]; then 21 | MJOBS=$(sysctl -n machdep.cpu.thread_count) 22 | else 23 | MJOBS=4 24 | fi 25 | 26 | make_dir () { 27 | if [ ! -d $1 ]; then 28 | if ! mkdir $1; then 29 | printf "\n Failed to create dir %s" "$1"; 30 | exit 1 31 | fi 32 | fi 33 | } 34 | 35 | remove_dir () { 36 | if [ -d $1 ]; then 37 | rm -r "$1" 38 | fi 39 | 40 | } 41 | 42 | download () { 43 | if [ ! -f "$PACKAGES/$2" ]; then 44 | 45 | printf "Downloading $1" 46 | curl -L --silent -o "$PACKAGES/$2" "$1" 47 | 48 | EXITCODE=$? 49 | if [ $EXITCODE -ne 0 ]; then 50 | echo "" 51 | echo "Failed to download $1. Exitcode $EXITCODE. Retrying in 10 seconds"; 52 | sleep 10 53 | curl -L --silent -o "$PACKAGES/$2" "$1" 54 | fi 55 | 56 | EXITCODE=$? 57 | if [ $EXITCODE -ne 0 ]; then 58 | echo "" 59 | echo "Failed to download $1. Exitcode $EXITCODE"; 60 | exit 1 61 | fi 62 | 63 | echo "... Done" 64 | 65 | if ! tar -xvf "$PACKAGES/$2" -C "$PACKAGES" 2>/dev/null >/dev/null; then 66 | echo "Failed to extract $2"; 67 | exit 1 68 | fi 69 | 70 | fi 71 | } 72 | 73 | execute () { 74 | echo "$ $*" 75 | 76 | if [[ ! $VERBOSE == "yes" ]]; then 77 | OUTPUT="$($@ 2>&1)" 78 | else 79 | $@ 80 | fi 81 | 82 | if [ $? -ne 0 ]; then 83 | echo "$OUTPUT" 84 | echo "" 85 | echo "Failed to Execute $*" >&2 86 | exit 1 87 | fi 88 | 89 | } 90 | 91 | build () { 92 | 93 | echo "" 94 | echo "building $1" 95 | echo "=======================" 96 | 97 | if [ -f "$PACKAGES/$1.done" ]; then 98 | echo "$1 already built. Remove $PACKAGES/$1.done lockfile to rebuild it." 99 | return 1 100 | fi 101 | 102 | 103 | 104 | return 0 105 | } 106 | 107 | command_exists() { 108 | if ! [[ -x $(command -v "$1") ]]; then 109 | return 1 110 | fi 111 | 112 | return 0 113 | } 114 | 115 | build_done () { 116 | touch "$PACKAGES/$1.done" 117 | } 118 | 119 | echo "ffmpeg-build-script v$VERSION" 120 | echo "=========================" 121 | echo "" 122 | 123 | case "$1" in 124 | "--cleanup") 125 | remove_dir $PACKAGES 126 | remove_dir $WORKSPACE 127 | echo "Cleanup done." 128 | echo "" 129 | exit 0 130 | ;; 131 | "--build") 132 | 133 | ;; 134 | *) 135 | echo "Usage: $0" 136 | echo " --build: start building process" 137 | echo " --cleanup: remove all working dirs" 138 | echo " --help: show this help" 139 | exit 0 140 | ;; 141 | esac 142 | 143 | echo "Using $MJOBS make jobs simultaneously." 144 | 145 | 146 | make_dir $PACKAGES 147 | make_dir $WORKSPACE 148 | make_dir $CMPL 149 | 150 | export PATH=${WORKSPACE}/bin:$PATH 151 | 152 | if ! command_exists "make"; then 153 | echo "make not installed."; 154 | exit 1 155 | fi 156 | 157 | if ! command_exists "g++"; then 158 | echo "g++ not installed."; 159 | exit 1 160 | fi 161 | 162 | if ! command_exists "curl"; then 163 | echo "curl not installed."; 164 | exit 1 165 | fi 166 | 167 | if build "nasm"; then 168 | download "http://www.nasm.us/pub/nasm/releasebuilds/2.13.01/nasm-2.13.01.tar.gz" "nasm-2.13.01.tar.gz" 169 | cd $PACKAGES/nasm-2.13.01 || exit 170 | execute ./configure --prefix=${WORKSPACE} 171 | execute make -j $MJOBS 172 | execute make install 173 | build_done "nasm" 174 | fi 175 | 176 | if build "yasm"; then 177 | download "http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz" "yasm-1.3.0.tar.gz" 178 | cd $PACKAGES/yasm-1.3.0 || exit 179 | execute ./configure --prefix=${WORKSPACE} 180 | execute make -j $MJOBS 181 | execute make install 182 | build_done "yasm" 183 | fi 184 | 185 | 186 | if build "opencore"; then 187 | download "http://downloads.sourceforge.net/project/opencore-amr/opencore-amr/opencore-amr-0.1.5.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fopencore-amr%2Ffiles%2Fopencore-amr%2F&ts=1442256558&use_mirror=netassist" "opencore-amr-0.1.5.tar.gz" 188 | cd $PACKAGES/opencore-amr-0.1.5 || exit 189 | execute ./configure --prefix=${WORKSPACE} --disable-shared --enable-static 190 | execute make -j $MJOBS 191 | execute make install 192 | build_done "opencore" 193 | fi 194 | 195 | if build "libvpx"; then 196 | download "https://github.com/webmproject/libvpx/archive/v1.5.0.tar.gz" "libvpx-1.5.0.tar.gz" 197 | cd $PACKAGES/libvpx* || exit 198 | sed -e 's/cp -p/cp/' -i build/make/Makefile 199 | execute ./configure --prefix=${WORKSPACE} --disable-unit-tests --disable-shared 200 | execute make -j $MJOBS 201 | execute make install 202 | build_done "libvpx" 203 | fi 204 | 205 | if build "lame"; then 206 | download "http://kent.dl.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz" "lame-3.99.5.tar.gz" 207 | cd $PACKAGES/lame-3.99.5 || exit 208 | execute ./configure --prefix=${WORKSPACE} --disable-shared --enable-static 209 | execute make -j $MJOBS 210 | execute make install 211 | build_done "lame" 212 | fi 213 | 214 | if build "xvidcore"; then 215 | download "http://downloads.xvid.org/downloads/xvidcore-1.3.4.tar.gz" "xvidcore-1.3.4.tar.gz" 216 | cd $PACKAGES/xvidcore || exit 217 | cd build/generic || exit 218 | execute ./configure --prefix=${WORKSPACE} --disable-shared --enable-static 219 | execute make -j $MJOBS 220 | execute make install 221 | 222 | if [[ -f ${WORKSPACE}/lib/libxvidcore.4.dylib ]]; then 223 | execute rm "${WORKSPACE}/lib/libxvidcore.4.dylib" 224 | fi 225 | 226 | build_done "xvidcore" 227 | fi 228 | 229 | if build "x264"; then 230 | 231 | download "ftp://ftp.videolan.org/pub/x264/snapshots/x264-snapshot-20170328-2245.tar.bz2" "last_x264.tar.bz2" 232 | cd $PACKAGES/x264-snapshot-* || exit 233 | execute ./configure --prefix=${WORKSPACE} --disable-shared --enable-static 234 | execute make -j $MJOBS 235 | execute make install 236 | execute make install-lib-static 237 | build_done "x264" 238 | fi 239 | 240 | if build "libogg"; then 241 | download "http://downloads.xiph.org/releases/ogg/libogg-1.3.2.tar.gz" "libogg-1.3.2.tar.gz" 242 | cd $PACKAGES/libogg-1.3.2 || exit 243 | execute ./configure --prefix=${WORKSPACE} --disable-shared --enable-static 244 | execute make -j $MJOBS 245 | execute make install 246 | build_done "libogg" 247 | fi 248 | 249 | if build "libvorbis"; then 250 | download "http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.5.tar.gz" "libvorbis-1.3.5.tar.gz" 251 | cd $PACKAGES/libvorbis-1.3.5 || exit 252 | execute ./configure --prefix=${WORKSPACE} --with-ogg-libraries=${WORKSPACE}/lib --with-ogg-includes=${WORKSPACE}/include/ --enable-static --disable-shared --disable-oggtest 253 | execute make -j $MJOBS 254 | execute make install 255 | build_done "libvorbis" 256 | fi 257 | 258 | if build "libtheora"; then 259 | download "http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.gz" "libtheora-1.1.1.tar.bz" 260 | cd $PACKAGES/libtheora-1.1.1 || exit 261 | sed "s/-fforce-addr//g" configure > configure.patched 262 | chmod +x configure.patched 263 | mv configure.patched configure 264 | execute ./configure --prefix=${WORKSPACE} --with-ogg-libraries=${WORKSPACE}/lib --with-ogg-includes=${WORKSPACE}/include/ --with-vorbis-libraries=${WORKSPACE}/lib --with-vorbis-includes=${WORKSPACE}/include/ --enable-static --disable-shared --disable-oggtest --disable-vorbistest --disable-examples --disable-asm 265 | execute make -j $MJOBS 266 | execute make install 267 | build_done "libtheora" 268 | fi 269 | 270 | if build "pkg-config"; then 271 | download "http://pkgconfig.freedesktop.org/releases/pkg-config-0.29.1.tar.gz" "pkg-config-0.29.1.tar.gz" 272 | cd $PACKAGES/pkg-config-0.29.1 || exit 273 | execute ./configure --silent --prefix=${WORKSPACE} --with-pc-path=${WORKSPACE}/lib/pkgconfig --with-internal-glib 274 | execute make -j $MJOBS 275 | execute make install 276 | build_done "pkg-config" 277 | fi 278 | 279 | if build "freetype"; then 280 | download "http://download.savannah.gnu.org/releases/freetype/freetype-2.8.tar.gz" "freetype-2.8.tar.gz" 281 | cd $PACKAGES/freet* || exit 282 | execute ./configure --silent --prefix=${WORKSPACE} --with-pc-path=${WORKSPACE}/lib/pkgconfig --disable-shared --enable-static 283 | execute make -j $MJOBS 284 | execute make install 285 | build_done "freetype" 286 | fi 287 | 288 | if build "fontconfig"; then 289 | download "http://www.freedesktop.org/software/fontconfig/release/fontconfig-2.11.94.tar.gz" "fontconfig-2.11.94.tar.gz" 290 | cd $PACKAGES/fontc* || exit 291 | execute ./configure --silent --prefix=${WORKSPACE} --with-pc-path=${WORKSPACE}/lib/pkgconfig --disable-shared --enable-static 292 | execute make -j $MJOBS 293 | execute make install 294 | build_done "fontconfig" 295 | fi 296 | 297 | if build "cmake"; then 298 | download "https://cmake.org/files/v3.5/cmake-3.5.2.tar.gz" "cmake-3.5.2.tar.gz" 299 | cd $PACKAGES/cmake* || exit 300 | rm Modules/FindJava.cmake 301 | perl -p -i -e "s/get_filename_component.JNIPATH/#get_filename_component(JNIPATH/g" Tests/CMakeLists.txt 302 | perl -p -i -e "s/get_filename_component.JNIPATH/#get_filename_component(JNIPATH/g" Tests/CMakeLists.txt 303 | execute ./configure --prefix=${WORKSPACE} 304 | execute make -j $MJOBS 305 | execute make install 306 | build_done "cmake" 307 | fi 308 | 309 | if build "vid_stab"; then 310 | download "https://codeload.github.com/georgmartius/vid.stab/legacy.tar.gz/release-0.98b" "vid.stab-0.98b-transcode-1.1-binary-x86_64.tgz" 311 | cd $PACKAGES/georgmartius-vid* || exit 312 | perl -p -i -e "s/vidstab SHARED/vidstab STATIC/" CMakeLists.txt 313 | execute cmake -DCMAKE_INSTALL_PREFIX:PATH=${WORKSPACE} . 314 | execute make install 315 | build_done "vid_stab" 316 | fi 317 | 318 | if build "x265"; then 319 | download "https://bitbucket.org/multicoreware/x265/downloads/x265_2.3.tar.gz" "x265-2.3tar.gz" 320 | cd $PACKAGES/x265_* || exit 321 | cd source || exit 322 | execute cmake -DCMAKE_INSTALL_PREFIX:PATH=${WORKSPACE} -DENABLE_SHARED:bool=off . 323 | execute make -j $MJOBS 324 | execute make install 325 | sed "s/-lx265/-lx265 -lstdc++/g" "$WORKSPACE/lib/pkgconfig/x265.pc" > "$WORKSPACE/lib/pkgconfig/x265.pc.tmp" 326 | mv "$WORKSPACE/lib/pkgconfig/x265.pc.tmp" "$WORKSPACE/lib/pkgconfig/x265.pc" 327 | build_done "x265" 328 | fi 329 | 330 | if build "fdk_aac"; then 331 | download "http://downloads.sourceforge.net/project/opencore-amr/fdk-aac/fdk-aac-0.1.5.tar.gz?r=https%3A%2F%2Fsourceforge.net%2Fprojects%2Fopencore-amr%2Ffiles%2Ffdk-aac%2F&ts=1457561564&use_mirror=kent" "fdk-aac-0.1.5.tar.gz" 332 | cd $PACKAGES/fdk-aac* || exit 333 | execute ./configure --prefix=${WORKSPACE} --disable-shared --enable-static 334 | execute make -j $MJOBS 335 | execute make install 336 | build_done "fdk_aac" 337 | fi 338 | 339 | if build "frei0r"; then 340 | download "https://files.dyne.org/frei0r/releases/frei0r-plugins-1.6.1.tar.gz" "frei0r-plugins-1.6.1.tar.gz" 341 | cd $PACKAGES/frei0r* || exit 342 | perl -p -i -e "s/OpenCV\" OFF/OpenCV\" ON/" CMakeLists.txt 343 | execute cmake -DCMAKE_INSTALL_PREFIX:PATH=${WORKSPACE} . 344 | execute make -s install 345 | for file in ${WORKSPACE}/lib/frei0r-1/*.so ; do 346 | cp $file "${file%.*}.dylib" 347 | done 348 | build_done "frei0r" 349 | fi 350 | 351 | build "ffmpeg" 352 | download "http://ffmpeg.org/releases/ffmpeg-3.3.4.tar.bz2" "ffmpeg-3.3.4.tar.bz2" 353 | cd $PACKAGES/ffmpeg* || exit 354 | CFLAGS="-I$WORKSPACE/include `$WORKSPACE/bin/freetype-config --cflags` -I$WORKSPACE/include/vorbis" LDFLAGS="-L$WORKSPACE/lib `$WORKSPACE/bin/freetype-config --libs`" 355 | # CFLAGS="-I$WORKSPACE/include" LDFLAGS="-L$WORKSPACE/lib" 356 | 357 | execute ./configure --arch=64 --prefix=${WORKSPACE} \ 358 | --extra-cflags="-I$WORKSPACE/include" --extra-cflags="-I$WORKSPACE/include/vorbis" --extra-cflags="`$WORKSPACE/bin/freetype-config --cflags`" \ 359 | --extra-ldflags="-L$WORKSPACE/lib" --extra-version=static \ 360 | --disable-debug \ 361 | --disable-shared \ 362 | --enable-static \ 363 | --enable-libopencore_amrwb \ 364 | --enable-libopencore_amrnb \ 365 | --extra-cflags=--static \ 366 | --disable-ffplay \ 367 | --disable-ffserver \ 368 | --disable-doc \ 369 | --enable-gpl \ 370 | --enable-version3 \ 371 | --enable-nonfree \ 372 | --enable-pthreads \ 373 | --enable-libvpx \ 374 | --enable-libmp3lame \ 375 | --enable-libtheora \ 376 | --enable-libvorbis \ 377 | --enable-libx264 \ 378 | --enable-libx265 \ 379 | --enable-runtime-cpudetect \ 380 | --enable-libfdk-aac \ 381 | --enable-avfilter \ 382 | --enable-libopencore_amrwb \ 383 | --enable-libopencore_amrnb \ 384 | --enable-filters \ 385 | --enable-libvidstab \ 386 | --enable-frei0r \ 387 | --enable-indev=avfoundation 388 | # enable all filters 389 | # enable AAC de/encoding via libfdk-aac [no] 390 | # enable detecting cpu capabilities at runtime (smaller binary) 391 | # enable HEVC encoding via x265 [no] 392 | # enable H.264 encoding via x264 [no] 393 | # enable Vorbis en/decoding via libvorbis, native implementation exists [no] 394 | # enable Theora encoding via libtheora [no] 395 | # enable MP3 encoding via libmp3lame [no] 396 | # enable VP8 and VP9 de/encoding via libvpx [no] 397 | # enable pthreads [autodetect] 398 | # allow use of nonfree code, the resulting libs and binaries will be unredistributable [no] 399 | # upgrade (L)GPL to version 3 [no] 400 | # allow use of GPL code, the resulting libs and binaries will be under GPL [no] 401 | # do not build documentation 402 | # disable ffserver build 403 | # disable ffplay build 404 | # build static libraries [no] 405 | # disable debugging symbols 406 | # disable build shared libraries [no] 407 | 408 | execute make -j $MJOBS 409 | execute make install 410 | 411 | INSTALL_FOLDER="/usr/bin" 412 | if [[ "$OSTYPE" == "darwin"* ]]; then 413 | INSTALL_FOLDER="/usr/local/bin" 414 | fi 415 | 416 | echo "" 417 | echo "Building done. The binary can be found here: $WORKSPACE/bin/ffmpeg" 418 | echo "" 419 | 420 | if [[ ! $SKIPINSTALL == "yes" ]]; then 421 | if command_exists "sudo"; then 422 | 423 | read -r -p "Install the binary to your $INSTALL_FOLDER folder? [Y/n] " response 424 | 425 | case $response in 426 | [yY][eE][sS]|[yY]) 427 | sudo cp "$WORKSPACE/bin/ffmpeg" "$INSTALL_FOLDER/ffmpeg" 428 | sudo cp "$WORKSPACE/bin/ffprobe" "$INSTALL_FOLDER/ffprobe" 429 | echo "Done. ffmpeg is now installed to your system" 430 | ;; 431 | esac 432 | 433 | fi 434 | fi 435 | 436 | echo "" 437 | echo "The frei0r plugins can be found here: $WORKSPACE/lib/ in a folder named \"frei0r-1\"" 438 | echo "" 439 | read -r -p "Copy frei0r plugins to your /usr/local/lib/frei0r-1 folder [Y/n] " response 440 | 441 | case $response in 442 | [yY][eE][sS]|[yY]) 443 | sudo cp -Rv "$WORKSPACE/lib/frei0r-1" "/usr/local/lib/" 444 | echo "Done. frei0r plugins are now installed to your system" 445 | ;; 446 | esac 447 | -------------------------------------------------------------------------------- /compare.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoharbabin/ffmpeg-build-macosx/314520408ea5eec8383e68b5fb5b4b3a274a1b72/compare.png -------------------------------------------------------------------------------- /compare2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoharbabin/ffmpeg-build-macosx/314520408ea5eec8383e68b5fb5b4b3a274a1b72/compare2.png -------------------------------------------------------------------------------- /defish.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ffmpeg -i $1 -vf frei0r=defish0r:0.8:y:0.6:0 -vcodec libx264 -pix_fmt yuv420p -acodec copy $2 3 | -------------------------------------------------------------------------------- /fishandstab.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | rm dummy.mp4 3 | rm defished.mp4 4 | ffmpeg -i $1 -vf frei0r=defish0r:0.8:y:0.6:0 -vcodec libx264 -pix_fmt yuv420p -acodec copy defished.mp4 5 | ffmpeg -i defished.mp4 -vf vidstabdetect=accuracy=15:shakiness=10:result="mytransforms.trf" vidstabanalyzedummy.mp4 6 | ffmpeg -i defished.mp4 -vcodec libx264 -vf vidstabtransform=input="mytransforms.trf",unsharp=5:5:0.8:3:3:0.4 -pix_fmt yuv420p -acodec copy $2 7 | -------------------------------------------------------------------------------- /fishcompare.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | rm withfish.mp4 3 | rm nofish.mp4 4 | ffmpeg -i $1 -t 60 -vf frei0r=defish0r:0.8:y:0.6:0,drawtext="fontfile='Liberator.ttf':text='After:fontsize=200:fontcolor=red:x=100:y=100" -pix_fmt yuv420p -acodec copy nofish.mp4 5 | ffmpeg -i $1 -t 60 -vf drawtext="fontfile='Liberator.ttf':text='Before:fontsize=200:fontcolor=red:x=100:y=100" -pix_fmt yuv420p -acodec copy withfish.mp4 6 | #ffmpeg -i withfish.mp4 -i nofish.mp4 -filter_complex "[0:v]setpts=PTS-STARTPTS, pad=iw*2:ih[bg]; [1:v]setpts=PTS-STARTPTS[fg]; [bg][fg]overlay=w; amerge,pan=stereo:c0