After I abandoned my attempt to transpile a C# library to C yesterday, I started to see if I can get the LGPL version of FFmpeg's libavutil library compiled as a shared library, for which I can then write a JavaScript wrapper. I'll put the instructions here in case I or someone else needs it again in future.

First, get the FFmpeg source files: git clone git@github.com:FFmpeg/FFmpeg.git Make sure you have all the required dependencies. A weird one I didn't know I needed was YASM (sudo apt install yasm) .

To have it compile a shared library, you have to pass the right parameter to configure:

./configure --enable-shared 

You can then just run make. It'll take a while to compile, but if it finishes successfully, you'll find a libavutil.a in the libavutil folder.

It's also possible to cross-compile to a Windows DLL file using Linux. You just need to do:

sudo apt install gcc-mingw-w64
./configure --enable-shared --arch=x86 --target-os=mingw32 --cross-prefix=i686-w64-mingw32-
make clean
make

The make clean is necessary to clear out the object files from your previous build that won't cross-compile.