Skip to content

Instantly share code, notes, and snippets.

@uupaa
Last active April 30, 2022 04:25
Show Gist options
  • Save uupaa/b54712c8d0f82372c4e8549a0cb85721 to your computer and use it in GitHub Desktop.
Save uupaa/b54712c8d0f82372c4e8549a0cb85721 to your computer and use it in GitHub Desktop.
install ffmpeg, brew and self build

Install ffmpeg

ffmpeg をインストールする幾つかの方法を紹介します。

brew install ffmpeg

brew install ffmpeg でおすすめ設定のffmpeg をインストールできます。ビルド時の設定は ffmpeg -buildconf で確認できます。

brew install ffmpeg

> Downloading https://homebrew.bintray.com/bottles/ffmpeg-3.2.4.el_capitan.bottle.tar.gz

which ffmpeg

> /usr/local/bin/ffmpeg

ffmpeg

> ffmpeg version 3.2.4 Copyright (c) 2000-2017 the FFmpeg developers
>   built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
>   configuration: --prefix=/usr/local/Cellar/ffmpeg/3.2.4 --enable-shared --enable-pthreads --enable-gpl --enable-version3 \
>   --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= \
>   --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
>   libavutil      55. 34.101 / 55. 34.101
>   libavcodec     57. 64.101 / 57. 64.101
>   libavformat    57. 56.101 / 57. 56.101
>   libavdevice    57.  1.100 / 57.  1.100
>   libavfilter     6. 65.100 /  6. 65.100
>   libavresample   3.  1.  0 /  3.  1.  0
>   libswscale      4.  2.100 /  4.  2.100
>   libswresample   2.  3.100 /  2.  3.100
>   libpostproc    54.  1.100 / 54.  1.100

brew install ffmpeg --with-xxx

brew install ffmpeg --with-xxx とすることで特定の機能を有効にした ffmpeg をインストールできます。

この例では、video filte (frei0r) を有効にした状態でビルドしインストールします。

brew install ffmpeg --with-frei0r

> Downloading https://ffmpeg.org/releases/ffmpeg-3.2.4.tar.bz2
> make install
> 🍺  /usr/local/Cellar/ffmpeg/3.2.4: 239 files, 50.4M, built in 4 minutes 47 seconds

which ffmpeg

> /usr/local/bin/ffmpeg

ffmpeg

> ffmpeg version 3.2.4 Copyright (c) 2000-2017 the FFmpeg developers
>   built with Apple LLVM version 8.0.0 (clang-800.0.38)
>   configuration: --prefix=/usr/local/Cellar/ffmpeg/3.2.4 --enable-shared --enable-pthreads --enable-gpl --enable-version3 \
>   --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= \
>   --enable-frei0r \
>   --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
>   libavutil      55. 34.101 / 55. 34.101
>   libavcodec     57. 64.101 / 57. 64.101
>   libavformat    57. 56.101 / 57. 56.101
>   libavdevice    57.  1.100 / 57.  1.100
>   libavfilter     6. 65.100 /  6. 65.100
>   libavresample   3.  1.  0 /  3.  1.  0
>   libswscale      4.  2.100 /  4.  2.100
>   libswresample   2.  3.100 /  2.  3.100
>   libpostproc    54.  1.100 / 54.  1.100

ffmpeg install without brew

自分で ffmpeg をソースからビルドします。ここでは OpenCV 2.x (最新は3.2.x), frei0r 1.4.0 (最新は1.5.0) でビルドします。

.profile を追加し適用します。

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
$ source ~/.profile

https://ffmpeg.org/download.html#releases から ffmpeg 3.2.4 の tar を download し、適当な場所に ffmpeg-3.2.4 として展開します。

brew install automake fdk-aac git lame libass libtool libvorbis libvpx opus sdl shtool texi2html theora wget x264 xvid yasm
brew install opencv
brew install frei0r --with-cairo --with-opencv
cd ffmpeg-3.2.4
./configure --prefix=/usr/local --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda --enable-frei0r
make
make install

ffmpeg
> ffmpeg version 3.2.4 Copyright (c) 2000-2017 the FFmpeg developers
>   built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
>   configuration: --prefix=/usr/local --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda --enable-frei0r
>   libavutil      55. 34.101 / 55. 34.101
>   libavcodec     57. 64.101 / 57. 64.101
>   libavformat    57. 56.101 / 57. 56.101
>   libavdevice    57.  1.100 / 57.  1.100
>   libavfilter     6. 65.100 /  6. 65.100
>   libavresample   3.  1.  0 /  3.  1.  0
>   libswscale      4.  2.100 /  4.  2.100
>   libswresample   2.  3.100 /  2.  3.100
>   libpostproc    54.  1.100 / 54.  1.100

which ffmpeg

> /usr/local/bin/ffmpeg

make uninstall でアンインストールできます。

@qz267
Copy link

qz267 commented Apr 30, 2022

nice job

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment