Can't launch ffmpeg in sandboxed electron app

Hello, I am trying to publish an electron app on the apple mac store. My program can be built for mac / linux / windows, but if I try to build it for the mac apple store (mas) ffmpeg fails with the error:
ffmpeg was killed with signal SIGILL
when I try to use my app in it's built mas sandboxed mode.

Since ffmpeg works fine when I run locally and build for any other platform, I think there is an issue with my mas build entitlements. This is my first time ever making an electron app for the mac apple store so any help would be much appreciated.

My electron app has this code which initiates ffmpeg using the npm libarary fluent-ffmpeg:
Code Block
//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"); //ffmpegPath
ffmpeg.setFfprobePath(ffprobePath); //"./src/ffmpeg/ffprobe"); //ffprobePath
//end set ffmpeg info


Inside my package.json file I have the following build code:

Code Block
"build": {
"asarUnpack": [
"node_modules/ffmpeg-static/bin/${os}/${arch}/ffmpeg",
"node_modules/ffmpeg-static/index.js",
"node_modules/ffmpeg-static/package.json"
],
"appId": "com.martinbarker.digify",
"productName": "Digify-mac",
"buildVersion": "1",
"copyright": "Copyright © 2020 Martin Barker/company",
"mac": {
"icon": "build/icon.icns",
"hardenedRuntime": true,
"entitlements": "build/entitlements.mas.plist",
"type": "distribution",
"provisioningProfile": "embedded.provisionprofile",
"target": [
"mas"
]
},


My entitlements.mas.plist file looks like this:
Code Block
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.inherit</key>
<true/>
<key>com.apple.security.application-groups</key>
<string>##TEAMID###.com.martinbarker.digify</string>
<key>com.apple.security.files.user-selected.read-only</key>
<true/>
<key>com.apple.security.files.user-selected.read-write</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
<key>com.apple.security.device.audio-input</key>
<true/>
<key>com.apple.security.personal-information.location</key>
<true/>
</dict>
</plist>


In order to build my MAS .app file, I run:
electron-builder build --mac
from my mac terminal. Once it finishes, I sign my .app file with this command:
sudo codesign --deep --force --verbose --sign '##MAC-DEVELOPER-ID##' dist/mas/Digify-mac.app
Once signed, I can open the .app file, but when I try to run an ffmpeg command, I get the ffmpeg was killed with signal SIGILL error.

I have been trying to get ffmpeg to run when my app is in this sandboxed stage, but with no luck. This issue was mentioned previously in this developer post that I've been trying to follow but with no luck:
https://developer.apple.com/forums/thread/87849
Can't launch ffmpeg in sandboxed electron app
 
 
Q