Windowsでffmpegをビルドする【VMWare編】
- 2019.05.03
- 環境情報

概要
いろいろとWindowsで試しましたが、満足行く環境が構築できなかったので、VMWareでLinuxをインストールして、「ffmpeg-windows-build-helpers」を使ってビルドすることにしました。
環境
- VMWare Workstation 15 Player
- Debian 9
環境の構築手順は、情報が豊富なので他のサイトに任せます。
仮想化やLinuxのディストリビューションは何でも構いません。
最近では「WSL(Windows Subsystem for Linux)」という方法もあるようです。
https://signal-flag-z.blogspot.com/2017/06/windowsffmpegwindows-10-bash-on-ubuntu.html
実行方法
まずは、一般ユーザで適当なディレクトリを作って、以下のコマンドを実行します。
1 2 3 4 5 6 7 |
mkdir ffmpeg_windows cd ffmpeg_windows/ git clone https://github.com/rdp/ffmpeg-windows-build-helpers.git cd ffmpeg-windows-build-helpers ./cross_compile_ffmpeg.sh |
なんかメッセージが出ますね…
1 2 3 4 5 6 7 8 |
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): autogen gperf unzip pax hg bison flex cvs svn curl ragel Install the missing packages before running this script. for gentoo (a non ubuntu distro): same as above, but no g++, no gcc, git is dev-vcs/git, zlib1g-dev is zlib, pkg-config is dev-util/pkgconfig, add ed... for OS X (homebrew): brew install ragel wget cvs hg yasm autogen automake autoconf cmake libtool xz pkg-config nasm bzip2 autoconf-archive p7zip coreutils for debian: same as ubuntu, but also add libtool-bin, ed, autoconf-archive for RHEL/CentOS: First ensure you have epel repos available, then run $ sudo yum install ragel subversion texinfo mercurial libtool autogen gperf nasm patch unzip pax ed gcc-c++ bison flex yasm automake autoconf gcc zlib-devel cvs bzip2 cmake3 -y for fedora: if your distribution comes with a modern version of cmake then use the same as RHEL/CentOS but replace cmake3 with cmake. for linux native compiler option: add libva-dev |
環境によって、必要なパッケージが違うのでメッセージは参考程度ですが、rootになって、必要なパッケージをインストールしていきます。
これは、私のDebian 9の環境での場合です。
1 2 3 4 5 6 7 |
su - apt-get install libtool-bin ed autoconf-archive apt-get install autogen gperf unzip pax mercurial \ bison flex cvs subversion curl ragel exit |
インストールが終われば、一般ユーザに戻って、再度実行します。
1 |
./cross_compile_ffmpeg.sh |
まだエラーが出ますね…
1 2 3 4 5 6 |
Found no assembler Minimum version is nasm-2.13 If you really want to compile without asm, configure with --disable-asm. $ nasm -v NASM version 2.12.01 |
nasmのバージョンが古いようです。
testingのパッケージをインストールする
nasmの新しいバージョンは「testing」にあるので、インストールできるようにリポジトリに変更を加えます。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
su - vi /etc/apt/apt.conf.d/99target APT::Default-Release "stable"; vi /etc/apt/sources.list deb http://ftp.jp.debian.org/debian testing main contrib non-free deb-src http://ftp.jp.debian.org/debian testing main contrib non-free apt-get update apt-get install nasm/testing exit |
ビルド
これでビルドする環境が整ったので、スクリプトを実行し直します。
1 |
./cross_compile_ffmpeg.sh |
しばらく待つと、スクリプトの実行が完了して、以下の場所にffmpeg.exeが生成されます。
1 |
./sandbox/cross_compilers/mingw-w64-x86_64/x86_64-w64-mingw32/bin/ffmpeg.exe |
あとがき
やっぱりLinuxで環境を作るのは楽ですね、MSYS2/MinGWで3日かかったのが、わずか3時間でできてしまいました(笑)
最初からLinuxを使えばよかったです…
何のためにわざわざソースからビルドしたかって?
理由はこれを実現するためでした、合わせてご覧ください。
-
前の記事
Windowsでffmpegをビルドする【オレ流編】 2019.05.03
-
次の記事
Windowsのffmpegを日本語化する 2019.05.03