ffmpeg-windows-build-helpersの使い方

スポンサーリンク
スポンサーリンク
エンコード

Windows用のFFmpegをビルドするためのスクリプトです。

スポンサーリンク
スポンサーリンク

Windows Subsystem for Linuxのインストール

こちらの記事を参考にしてください。

Ubuntu 18.04 LTSで説明します。

ffmpeg-windows-build-helpersのダウンロード

Ubuntuを起動して以下のコマンドを実行します。

git clone https://github.com/rdp/ffmpeg-windows-build-helpers.git
cd ffmpeg-windows-build-helpers

必要なパッケージのインストール

スクリプトを実行します。

./cross_compile_ffmpeg.sh

以下のようなメッセージが表示されます。

Could not find the following execs (svn is actually package subversion, makeinfo is actually package texinfo, hg is actually package mercurial if you're missing them): libtoolize cmake python clang meson autogen gperf nasm unzip pax hg g++ makeinfo bison flex cvs yasm automake autoconf gcc svn make pkg-config ragel
Install the missing packages before running this script.
for ubuntu:
$ sudo apt-get update
 $ sudo apt-get install subversion ragel curl texinfo g++ bison flex cvs yasm automake libtool autoconf gcc cmake git make pkg-config zlib1g-dev mercurial unzip pax nasm gperf autogen bzip2 autoconf-archive p7zip-full meson clang python3-distutils -y

sudoの行をコピーして実行します。

sudo apt-get update
sudo apt-get install subversion ragel curl texinfo g++ bison flex cvs yasm automake libtool autoconf gcc cmake git make pkg-config zlib1g-dev mercurial unzip pax nasm gperf autogen bzip2 autoconf-archive p7zip-full meson clang python3-distutils -y

mesonのアップデート

スクリプトを実行します。

./cross_compile_ffmpeg.sh

以下のようなメッセージが表示されます。

your meson version is too old 0.45.1 wanted 0.49.2

以下のコマンドを実行します。

cd ~
git clone https://github.com/mesonbuild/meson.git
cd meson
cp meson.py meson
echo 'export PATH=$HOME/meson:$PATH' >> ~/.bashrc
source ~/.bashrc
cd ~/ffmpeg-windows-build-helpers

参考 Your meson version is too old 0.45.1 wanted 0.47 · Issue #429 · rdp/ffmpeg-windows-build-helpers · GitHub

binfmtの無効化

スクリプトを実行します。

./cross_compile_ffmpeg.sh

以下のようなメッセージが表示されます。

windows WSL detected: you must first disable 'binfmt' by running this
      sudo bash -c 'echo 0 > /proc/sys/fs/binfmt_misc/WSLInterop'
      then try again

sudoの行をコピーして実行します。

sudo bash -c 'echo 0 > /proc/sys/fs/binfmt_misc/WSLInterop'

ビルド

スクリプトを実行します。

./cross_compile_ffmpeg.sh

以下のようなメッセージが表示されます。

What version of MinGW-w64 would you like to build or update?
  1. Both Win32 and Win64
  2. Win32 (32-bit only)
  3. Win64 (64-bit only)
  4. Local native
  5. Exit
Input your choice [1-5]:

ビルドには非常に時間がかかるので2か3がおすすめです。

ファイルを取り出す

エクスプローラーで以下のフォルダを開きます。

\\wsl$\Ubuntu-18.04\home\ユーザー名\ffmpeg-windows-build-helpers\sandbox\win32かwin64\ffmpeg_git

ffmpeg.exe、ffplay.exe、ffprobe.exeを適当なフォルダにコピーします。

オプション

すべてのオプションは以下を実行すると表示されます。

./cross_compile_ffmpeg.sh -h

オプションは以下のようにスクリプト実行時に指定します。

./cross_compile_ffmpeg.sh --build-ffmpeg-shared=y

オプションを指定すると「ffmpeg_git_shared」のように出力フォルダ名が変わります。

Shared版のビルド

--build-ffmpeg-shared=y

ffmpeg_git_shared\bin に出力されます。

バージョンの指定

--ffmpeg-git-checkout-version=n4.3.1

nX.X.Xの形で指定します。

FDK AACを組み込む

--disable-nonfree=n

ライセンスの関係で再配布不可になります。

スポンサーリンク
スポンサーリンク
エンコード
thtsfをフォローする
スポンサーリンク
スポンサーリンク

コメント

タイトルとURLをコピーしました