diff --git a/package.json b/package.json index 7cca7ccb..ee4571a0 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "scripts": { "start": "concurrently -k \"BROWSER=none PORT=3001 react-scripts start\" \"wait-on http://localhost:3001 && electron .\"", "icon-gen": "mkdirp icon-build && svg2png src/icon.svg -o ./icon-build/app-512.png -w 512 -h 512 && mkdirp icns-build && icon-gen -i src/icon.svg -o ./icns-build --icns --icns-sizes 512,1024 && mkdirp build-resources/appx && npx svg2png src/icon.svg --output=build-resources/appx/StoreLogo.png --width=50 --height=50 && npx svg2png src/icon.svg --output=build-resources/appx/Square150x150Logo.png --width=300 --height=300 && npx svg2png src/icon.svg --output=build-resources/appx/Square44x44Logo.png --width=44 --height=44 && npx svg2png src/icon.svg --output=build-resources/appx/Wide310x150Logo.png --width=620 --height=300", - "download-ffmpeg": "mkdir -p ffmpeg-mac && wget https://github.com/mifi/ffmpeg-build-script/releases/download/v2.1.0/ffmpeg -O ffmpeg-mac/ffmpeg && wget https://github.com/mifi/ffmpeg-build-script/releases/download/v2.1.0/ffprobe -O ffmpeg-mac/ffprobe && chmod +x ffmpeg-mac/ffmpeg && chmod +x ffmpeg-mac/ffprobe", + "download-ffmpeg": "mkdir -p ffmpeg-mac && wget https://github.com/mifi/ffmpeg-build-script/releases/download/v2.1.2/ffmpeg -O ffmpeg-mac/ffmpeg && wget https://github.com/mifi/ffmpeg-build-script/releases/download/v2.1.2/ffprobe -O ffmpeg-mac/ffprobe && chmod +x ffmpeg-mac/ffmpeg && chmod +x ffmpeg-mac/ffprobe", "build": "yarn icon-gen && react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject", @@ -132,11 +132,11 @@ "extraResources": [ { "from": "ffmpeg-mac/ffmpeg", - "to": "node_modules/ffmpeg-static/ffmpeg" + "to": "ffmpeg" }, { "from": "ffmpeg-mac/ffprobe", - "to": "node_modules/ffmpeg-static/ffprobe" + "to": "ffprobe" } ], "icon": "icns-build/app.icns" @@ -147,8 +147,8 @@ "entitlementsInherit": "entitlements.mas.inherit.plist", "provisioningProfile": "LosslessCut_Mac_App_Store_provisioning_profile.provisionprofile", "binaries": [ - "dist/mas/LosslessCut.app/Contents/Resources/node_modules/ffmpeg-static/ffmpeg", - "dist/mas/LosslessCut.app/Contents/Resources/node_modules/ffprobe-static/bin/darwin/x64/ffprobe" + "dist/mas/LosslessCut.app/Contents/Resources/ffmpeg", + "dist/mas/LosslessCut.app/Contents/Resources/ffprobe" ] }, "win": { diff --git a/src/ffmpeg.js b/src/ffmpeg.js index e39aec3a..8ef1afe1 100644 --- a/src/ffmpeg.js +++ b/src/ffmpeg.js @@ -27,6 +27,10 @@ function getFfCommandLine(cmd, args) { function getFfmpegPath() { const platform = os.platform(); + if (platform === 'darwin') { + return isDev ? 'ffmpeg-mac/ffmpeg' : join(window.process.resourcesPath, 'ffmpeg'); + } + const exeName = platform === 'win32' ? 'ffmpeg.exe' : 'ffmpeg'; return isDev ? `node_modules/ffmpeg-static/${exeName}` @@ -36,8 +40,11 @@ function getFfmpegPath() { function getFfprobePath() { const platform = os.platform(); + if (platform === 'darwin') { + return isDev ? 'ffmpeg-mac/ffprobe' : join(window.process.resourcesPath, 'ffprobe'); + } + const map = { - darwin: 'darwin/x64/ffprobe', win32: 'win32/x64/ffprobe.exe', linux: 'linux/x64/ffprobe', };