问题描述
我正在尝试为使用 ffmpeg 的 mac 苹果商店构建一个电子应用程序。
我可以在本地很好地使用 fluent-ffmpeg 并且当我为 windows/mac/linux 构建我的应用程序时它继续工作,但是当我构建一个经过沙盘处理的 Mac Apple Store (MAS) .app 文件并签署 .app 文件时, fluent-ffmpeg 不再工作,并在控制台中引发 ffmpeg was killed with signal SIGILL
错误:
Fluent-ffmpeg 使用此 javscript 代码进行设置:
//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
我研究了这个问题,发现了一些类似的问题,比如这个 stackoverflow answer (link here) 说要编译一个静态的 ffmpeg 可执行文件并使用它。
所以我学会了如何在我的 mac 终端上使用这些命令从命令行编译 ffmpeg:
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
过了一会儿,我得到了一个 ffmpeg 文件夹,我把它移到我的电子项目的 src 文件夹 /src/
我将此 ffmpeg 文件夹放在我的电子 /src 文件夹中,并更改我的 ffmpeg 设置代码以使用我静态构建的文件夹,如下所示:
//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')
//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
然后使用以下命令构建/签署我的应用程序:
$ electron-builder build --mac
$ sudo codesign --deep --force --verbose --sign '##(my dev id)####' dist/mas/Digify-mac.app
但最终构建的 .app 文件在尝试启动 ffmpeg 时出现相同的错误:
ffmpeg was killed with signal SIGILL
我一直试图自己解决这个问题,但没有运气,最近在苹果开发者论坛上有一些关于这个的帖子: https://developer.apple.com/forums/thread/87849
但大多数其他在线指南已经过时。
谁能帮我让 ffmpeg 在 Mac Apple Store 的沙盒电子应用程序中工作?任何帮助将不胜感激
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)