问题
I am trying to build an electron application for the mac apple store that uses ffmpeg.
I can use fluent-ffmpeg locally fine and It continues to work when I build my app for windows/mac/linux, but when I build a sandoxed Mac Apple Store (MAS) .app file and sign the .app file, fluent-ffmpeg does not work anymore, and throws an ffmpeg was killed with signal SIGILL
error in console:
Fluent-ffmpeg gets setup with this javscript code:
//begin get ffmpeg info
const ffmpeg = require('fluent-ffmpeg');
//Get the paths to the packaged versions of the binaries we want to use
var ffmpegPath = require('ffmpeg-static-electron').path;
ffmpegPath = ffmpegPath.replace('app.asar', 'app.asar.unpacked')
var ffprobePath = require('ffprobe-static-electron').path;
ffprobePath = ffprobePath.replace('app.asar', 'app.asar.unpacked')
//tell the ffmpeg package where it can find the needed binaries.
ffmpeg.setFfmpegPath(ffmpegPath)//("./src/ffmpeg/ffmpeg");
ffmpeg.setFfprobePath(ffprobePath)//("./src/ffmpeg/ffprobe");
//end set ffmpeg info
I have looked into this issue some and found similar questions, like this stackoverflow answer (link here) which says to compile a static ffmpeg executable and use that.
So I learned how to compile ffmpeg from the command line using these commands on my mac terminal:
git clone https://git.ffmpeg.org/ffmpeg.git
./configure --pkg-config-flags="--static" --libdir=/usr/local/lib --extra-version=ntd_20150128 --disable-shared --enable-static --enable-gpl --enable-pthreads --enable-nonfree --enable-libass --enable-libfdk-aac --enable-libmp3lame --enable-libx264 --enable-filters --enable-runtime-cpudetect
make
After a while, I get an ffmpeg folder, which I move to my electron project's src folder /src/
I place this ffmpeg folder inside my electron /src folder and change my ffmpeg setup code to use my statically built folder like so:
//begin get ffmpeg info
const ffmpeg = require('fluent-ffmpeg');
//Get the paths to the packaged versions of the binaries we want to use
var ffmpegPath = require('ffmpeg-static-electron').path;
ffmpegPath = ffmpegPath.replace('app.asar', 'app.asar.unpacked')
var ffprobePath = require('ffprobe-static-electron').path;
ffprobePath = ffprobePath.replace('app.asar', 'app.asar.unpacked')
//tell the ffmpeg package where it can find the needed binaries.
ffmpeg.setFfmpegPath(ffmpegPath)//("./src/ffmpeg/ffmpeg");
ffmpeg.setFfprobePath(ffprobePath)//("./src/ffmpeg/ffprobe");
//end set ffmpeg info
And then build / sign my app with these commands:
$ electron-builder build --mac
$ sudo codesign --deep --force --verbose --sign '##(my dev id)####' dist/mas/Digify-mac.app
But the final built .app file has the same error when trying to launch ffmpeg:
ffmpeg was killed with signal SIGILL
I've been trying to solve this issue myself but with no luck, there have been some recent posts about this on the apple developer forums: https://developer.apple.com/forums/thread/87849
but most of the other guides online are outdated.
Can anyone please help me get ffmpeg working in an sandboxed electron app for the Mac Apple Store? Any help would be much appreciated
来源:https://stackoverflow.com/questions/65474096/sandboxed-electron-app-cant-use-ffmpeg-mac-apple-store