This patch: - moves ffmpeg binaries from `//bin/` to `//third_party/ffmpeg` - adds [COPYING.GPLv3](https://github.com/FFmpeg/FFmpeg/blob/master/COPYING.GPLv3) ffmpeg license - changes npm packaging to include `//third_party/ffmpeg` only in `playwright` and `playwrihgt-chromium` a
6.7 KiB
Binary Files
Building ffmpeg-mac
I mostly followed steps at https://trac.ffmpeg.org/wiki/CompilationGuide/macOS
- Clone repo & checkout release tag (we're building release v4.3.1)
~$ git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg
~$ cd ffmpeg
~/ffmpeg$ git checkout n4.3.1
- Install brew dependencies
~/ffmpeg$ brew install automake fdk-aac git lame libass libtool libvorbis libvpx \
opus sdl shtool texi2html theora wget x264 x265 xvid nasm
- Prepare output folders
~/ffmpeg$ mkdir -p output/bin
- Configure with vpx
~/ffmpeg$ ./configure --prefix=$PWD/output \
--pkg-config-flags="--static" \
--bindir=$PWD/output/bin \
--disable-everything \
--enable-ffmpeg \
--enable-protocol=pipe \
--enable-protocol=file \
--enable-parser=mjpeg \
--enable-decoder=mjpeg \
--enable-demuxer=image2pipe \
--enable-filter=pad \
--enable-filter=crop \
--enable-filter=scale \
--enable-muxer=webm \
--enable-encoder=libvpx_vp8 \
--enable-libvpx \
--enable-static
- Make & install to the
output/bin
~/ffmpeg$ make && make install
Building ffmpeg-win64.exe
-
Install
MSYS2
fromhttps://www.msys2.org
and install toc:\msys64
-
Launch
c:\msys64\mingw64
to launch a shell with a proper environment. -
MSYS2
usespacman
to install dependencies. Run the following commands to update & install packages:
$ pacman -Syu
$ pacman -Su
$ pacman -S make pkgconf diffutils yasm
$ pacman -S mingw-w64-x86_64-nasm mingw-w64-x86_64-gcc mingw-w64-x86_64-SDL2
notes:
yasm
is needed forlibvpx
- the rest is a general compilation toolchain
- Clone
libvpx
of proper version, compile manually and install to a well-known location (prefix):
$ cd /c/
$ git clone https://chromium.googlesource.com/webm/libvpx
$ cd libvpx
$ git checkout d1a78971ebcfd728c9c73b0cfbee69f470d4dc72
$ ./configure --prefix=/eee64 --target=x86_64-win64-gcc --enable-static --disable-shared --disable-docs --disable-tools --disable-unit-tests --disable-examples
$ make && make install
Note: libvpx
has a useful readme: https://chromium.googlesource.com/webm/libvpx/+/master/README
- Once
libvpx
is compiled, compileffmpeg
using the just-compiledlibvpx
:
$ cd /c/
$ git clone git://source.ffmpeg.org/ffmpeg.git
$ cd ffmpeg
$ git checkout n4.3.1
$ ./configure --extra-cflags="-I/eee64/include" \
--extra-ldflags="-L/eee64/lib -static" \
--prefix=/eee64 \
--pkg-config-flags="--static" \
--bindir=$PWD/output/bin \
--disable-everything \
--enable-ffmpeg \
--enable-protocol=pipe \
--enable-protocol=file \
--enable-parser=mjpeg \
--enable-decoder=mjpeg \
--enable-demuxer=image2pipe \
--enable-filter=pad \
--enable-filter=crop \
--enable-filter=scale \
--enable-muxer=webm \
--enable-libvpx \
--enable-static \
--enable-encoder=libvpx_vp8 \
--disable-pthreads \
--disable-zlib \
--disable-iconv \
--disable-bzlib \
--disable-w32threads
$ make && make install
note: the following resources helped me to deal with some dynamic dependencies in the resulting ffmpeg.exe
:
Building ffmpeg-win32.exe
NOTE: these steps assume that
ffmpeg-win64.exe
was just built on the machine.
-
Launch
c:\msys64\mingw32
to launch a shell with a proper environment. Not sure if this is required or everything could be done frommingw64
- but it worked. -
Update libraries for mingw32
$ pacman -Syu
$ pacman -Su
- Uninstall the
x86_64
compilers that we installed to build win64 version:
$ pacman -R mingw-w64-x86_64-nasm mingw-w64-x86_64-gcc mingw-w64-x86_64-SDL2
- Install the i686 compilers instead of their x86_64 counterparts:
$ pacman -S mingw-w64-i686-nasm mingw-w64-i686-gcc mingw-w64-i686-SDL2
- Remove all old source folders - we'll re-clone everything later for simplicity
$ rm -rf /c/ffmpeg && rm -rf /c/libvpx
- Clone & compile libvpx. Notice a change:
--target=x86-win32-gcc
$ cd /c/
$ git clone https://chromium.googlesource.com/webm/libvpx
$ cd libvpx
$ ./configure --prefix=/eee32 --target=x86-win32-gcc --enable-static --disable-shared --disable-docs --disable-tools --disable-unit-tests --disable-examples
$ make && make install
- Clone & compile ffmpeg
$ cd /c/
$ git clone git://source.ffmpeg.org/ffmpeg.git
$ cd ffmpeg
$ git checkout n4.3.1
$ ./configure --extra-cflags="-I/eee32/include" \
--extra-ldflags="-L/eee32/lib -static" \
--prefix=/eee32 \
--pkg-config-flags="--static" \
--bindir=$PWD/output/bin \
--disable-everything \
--enable-ffmpeg \
--enable-protocol=pipe \
--enable-protocol=file \
--enable-parser=mjpeg \
--enable-decoder=mjpeg \
--enable-demuxer=image2pipe \
--enable-filter=pad \
--enable-filter=crop \
--enable-filter=scale \
--enable-muxer=webm \
--enable-libvpx \
--enable-static \
--enable-encoder=libvpx_vp8 \
--disable-pthreads \
--disable-zlib \
--disable-iconv \
--disable-bzlib \
--disable-w32threads
$ make && make install
note: using -j
for make somehow breaks compilation - so I'd suggest compiling everything in one thread.