We are using ffmpeg-static
in our Electron app, and creating a universal mac build via electron-forge
and under the hood electron/universal
. But only the arm64 ffmpeg binary exists in the final app. I have confirmed that the ffmpeg-static
module can be rebuilt manually with an arch param as arm64
or x86
(npm rebuild --arch=x64 -f ffmpeg-static
, then confirmed with file node_modules/ffmpeg-static/ffmpeg
) and the correct binary is created/downloaded. But when running the universal build, only os.arch()
seems to be respected, which in this case is which is an M1 machine.
It seems electron-forge
isn’t passing the correct arch
to dependencies. If there were hooks in the universal build process, or some env vars set, I could manually rebuild this one ffmpeg
module according to an arch. For example ffmpeg-static
does read process.env.npm_config_arch
, so if I were able to set that in between the x64 and arm64 builds (or electron/universal
did), the module would build the correct ffmpeg binary.
I have attempted using hooks in electron-forge
to try and switch based on arch
, but that value is always universal
. Also, building the app on separate Intel and M1 machines produces the appropriate ffmpeg
binary.
How can ffmpeg-static
in our case receive the correct arch
?