UPDATE: this attempt failed :( Resulting binary doesn't support vp8
encoding.
I tried cross-compiling ffmpeg for windows on Sep 1, 2020 Cross-compiling ffmpeg for Windows seems to be very plausible, according to the documentation at https://trac.ffmpeg.org/wiki/CompilationGuide/CrossCompilingForWindows
I decided to use https://github.com/rdp/ffmpeg-windows-build-helpers. I tried using it on Mac 10.15, but unfortunately it failed for me.
So I decided to run inside Ubuntu 18.04 docker image: docker run --rm -it ubuntu-18.04 /bin/bash
.
All the following steps are happenning inside docker:
- Install all required packages to bootstrape bare ubuntu-18.04. These include
git
,ssh
andvim
- to live inside, and also a bunch of packages required to cross-compile ffmpeg.
$ sudo apt-get install -y git ssh vim python3-setuptools lsb_release cmake python clang meson autogen gperf nasm unzip pax mercurial ed g++ texinfo bison flex cvs yasm automake autoconf gcc subversion make pkg-config curl ragel
- Get latest
meson
(as described at rdp/ffmpeg-windows-build-helpers#429 (comment))
~$ git clone https://github.com/mesonbuild/meson.git
~$ ln -s /root/meson/meson.py /usr/local/bin/meson
- Clone repository
~$ git clone https://github.com/rdp/ffmpeg-windows-build-helpers
- Change configuration options: edit
cross_compile_ffmpeg.sh
and find line that starts withconfig_options="$init_options
. (this is line 2323 for me). Change the line into the following:
config_options="$init_options --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"
- As of September 2, 2020, LAME doesn't trans-compile: rdp/ffmpeg-windows-build-helpers#485
However, since we don't need it for FFMPEG, comment out the build_lame
function in cross_compile_ffmpeg.sh
.
- Run the script passing the release version:
~ffmpeg-windows-build-helpers$ ./cross_compile_ffmpeg.sh --ffmpeg-git-checkout-version=n4.3.1