From b909dace6303b72410fe8fb3508dda3b6116ee36 Mon Sep 17 00:00:00 2001 From: Mikael Finstad Date: Fri, 11 Dec 2020 00:09:13 +0100 Subject: [PATCH] upgrade ffmpeg to 4.3.1 also use package ffmpeg-ffprobe-static --- package.json | 15 +++++++-------- src/ffmpeg.js | 32 +++++++------------------------- yarn.lock | 51 +++++++++++++++++++++++---------------------------- 3 files changed, 37 insertions(+), 61 deletions(-) diff --git a/package.json b/package.json index 126cbbba..31c63ced 100644 --- a/package.json +++ b/package.json @@ -89,8 +89,7 @@ "electron-store": "^5.1.1", "electron-unhandled": "^3.0.2", "execa": "^4.0.0", - "ffmpeg-static": "^4.2.1", - "ffprobe-static": "^3.0.0", + "ffmpeg-ffprobe-static": "^4.3.1-rc.2", "file-type": "^12.4.0", "fs-extra": "^8.1.0", "github-api": "^3.2.2", @@ -124,8 +123,8 @@ }, "files": [ "build/**/*", - "!node_modules/ffmpeg-static/ffmpeg", - "!node_modules/ffprobe-static/bin/**/*" + "!node_modules/ffmpeg-ffprobe-static/ffmpeg", + "!node_modules/ffmpeg-ffprobe-static/ffprobe" ], "asar": { "smartUnpack": false @@ -273,8 +272,8 @@ "appx" ], "extraResources": [ - "node_modules/ffmpeg-static/ffmpeg.exe", - "node_modules/ffprobe-static/bin/win32/x64/**" + "node_modules/ffmpeg-ffprobe-static/ffmpeg.exe", + "node_modules/ffmpeg-ffprobe-static/ffprobe.exe" ], "icon": "icon-build/app-512.png", "fileAssociations": [ @@ -383,8 +382,8 @@ "linux": { "executableName": "losslesscut", "extraResources": [ - "node_modules/ffmpeg-static/ffmpeg", - "node_modules/ffprobe-static/bin/linux/x64/**" + "node_modules/ffmpeg-ffprobe-static/ffmpeg", + "node_modules/ffmpeg-ffprobe-static/ffprobe" ], "icon": "icon-build/app-512.png", "target": [ diff --git a/src/ffmpeg.js b/src/ffmpeg.js index 11416170..ca1de317 100644 --- a/src/ffmpeg.js +++ b/src/ffmpeg.js @@ -25,39 +25,21 @@ function getFfCommandLine(cmd, args) { return `${cmd} ${args.map(mapArg).join(' ')}`; } -function getFfmpegPath() { +function getFfPath(cmd) { const platform = os.platform(); if (platform === 'darwin') { - return isDev ? 'ffmpeg-mac/ffmpeg' : join(window.process.resourcesPath, 'ffmpeg'); + return isDev ? `ffmpeg-mac/${cmd}` : join(window.process.resourcesPath, cmd); } - const exeName = platform === 'win32' ? 'ffmpeg.exe' : 'ffmpeg'; + const exeName = platform === 'win32' ? `${cmd}.exe` : cmd; return isDev - ? `node_modules/ffmpeg-static/${exeName}` - : join(window.process.resourcesPath, `node_modules/ffmpeg-static/${exeName}`); + ? `node_modules/ffmpeg-ffprobe-static/${exeName}` + : join(window.process.resourcesPath, `node_modules/ffmpeg-ffprobe-static/${exeName}`); } -function getFfprobePath() { - const platform = os.platform(); - - if (platform === 'darwin') { - return isDev ? 'ffmpeg-mac/ffprobe' : join(window.process.resourcesPath, 'ffprobe'); - } - - const map = { - win32: 'win32/x64/ffprobe.exe', - linux: 'linux/x64/ffprobe', - }; - - const subPath = map[platform]; - - if (!subPath) throw new Error(`${i18n.t('Unsupported platform')} ${platform}`); - - return isDev - ? `node_modules/ffprobe-static/bin/${subPath}` - : join(window.process.resourcesPath, `node_modules/ffprobe-static/bin/${subPath}`); -} +const getFfmpegPath = () => getFfPath('ffmpeg'); +const getFfprobePath = () => getFfPath('ffprobe'); async function runFfprobe(args) { const ffprobePath = getFfprobePath(); diff --git a/yarn.lock b/yarn.lock index d5569b0f..c7994b30 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1114,9 +1114,9 @@ integrity sha512-ij4wRiunFfaJxjB0BdrYHIH8FxBJpOwNPhhAcunlmPdXudL1WQV1qoP9un6JsEBAgQH+7UXyyjh0g7jTxXK6tg== "@derhuerst/http-basic@^8.2.0": - version "8.2.0" - resolved "https://registry.yarnpkg.com/@derhuerst/http-basic/-/http-basic-8.2.0.tgz#d009a4a6820dea756061d21842e79d1dbf9a1e11" - integrity sha512-v1cqPUpFjU8DInW4YkC9caGKy8kUkqz0z10yCHawkxgpaJPId0F5xKi8fUY5rqC58F9Muz9T136jNReZQH9xIw== + version "8.2.1" + resolved "https://registry.yarnpkg.com/@derhuerst/http-basic/-/http-basic-8.2.1.tgz#11e3964cf1f2fb40806f9a0fff0c451bb7526093" + integrity sha512-Rmn7qQQulw2sxJ8qGfZ7OuqMWuhz8V+L5xnYKMF5cXVcYqmgWqlVEAme90pF7Ya8OVhxVxLmhh0rI2k6t7ITWw== dependencies: caseless "^0.12.0" concat-stream "^1.6.2" @@ -1660,9 +1660,9 @@ integrity sha512-GnZbirvmqZUzMgkFn70c74OQpTTUcCzlhQliTzYjQMqg+hVKcDnxdL19Ne3UdYzdMA/+W3eb646FWn/ZaT1NfQ== "@types/node@^10.0.3": - version "10.17.18" - resolved "https://registry.yarnpkg.com/@types/node/-/node-10.17.18.tgz#ae364d97382aacdebf583fa4e7132af2dfe56a0c" - integrity sha512-DQ2hl/Jl3g33KuAUOcMrcAOtsbzb+y/ufakzAdeK9z/H/xsvkpbETZZbPNMIiQuk24f5ZRMCcZIViAwyFIiKmg== + version "10.17.48" + resolved "https://registry.yarnpkg.com/@types/node/-/node-10.17.48.tgz#726e7f25d00bf58d79c8f00dd586dd9a10d06a4f" + integrity sha512-Agl6xbYP6FOMDeAsr3QVZ+g7Yzg0uhPHWx0j5g4LFdUBHVtqtU+gH660k/lCEe506jJLOGbEzsnqPDTZGJQLag== "@types/node@^12.0.12": version "12.12.37" @@ -2048,9 +2048,9 @@ adjust-sourcemap-loader@2.0.0: regex-parser "2.2.10" agent-base@6: - version "6.0.0" - resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-6.0.0.tgz#5d0101f19bbfaed39980b22ae866de153b93f09a" - integrity sha512-j1Q7cSCqN+AwrmDd+pzgqc0/NpC655x2bUf5ZjRIO77DcNBFmh+OgRNzF6OKdCC9RSCb19fGd99+bhXFdkRNqw== + version "6.0.2" + resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-6.0.2.tgz#49fff58577cfee3f37176feab4c22e00f86d7f77" + integrity sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ== dependencies: debug "4" @@ -4161,12 +4161,12 @@ debug@2.6.9, debug@^2.2.0, debug@^2.3.3, debug@^2.6.0, debug@^2.6.9: dependencies: ms "2.0.0" -debug@4, debug@^4.1.0, debug@^4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791" - integrity sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw== +debug@4, debug@^4.3.0: + version "4.3.1" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.1.tgz#f0d229c505e0c6d8c49ac553d1b13dc183f6b2ee" + integrity sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ== dependencies: - ms "^2.1.1" + ms "2.1.2" debug@=3.1.0: version "3.1.0" @@ -4196,12 +4196,12 @@ debug@^4.0.1: dependencies: ms "^2.1.1" -debug@^4.3.0: - version "4.3.1" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.1.tgz#f0d229c505e0c6d8c49ac553d1b13dc183f6b2ee" - integrity sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ== +debug@^4.1.0, debug@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791" + integrity sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw== dependencies: - ms "2.1.2" + ms "^2.1.1" decamelize@^1.1.1, decamelize@^1.2.0: version "1.2.0" @@ -5506,21 +5506,16 @@ fd-slicer@~1.1.0: dependencies: pend "~1.2.0" -ffmpeg-static@^4.2.1: - version "4.2.1" - resolved "https://registry.yarnpkg.com/ffmpeg-static/-/ffmpeg-static-4.2.1.tgz#10819f35f0f4bae775293be3fdffa74b87d65848" - integrity sha512-vLhKBNqMwtoZe3pPQd8QUGJwlS0A5dTu0EVJQ9MvjsIauDrUHzFHo2XJ3B1SJbKvFnQVd5kZXIK+zqZAUcT0qQ== +ffmpeg-ffprobe-static@^4.3.1-rc.2: + version "4.3.1-rc.2" + resolved "https://registry.yarnpkg.com/ffmpeg-ffprobe-static/-/ffmpeg-ffprobe-static-4.3.1-rc.2.tgz#f12d865d5a5ff3ced1128175e23403f099a4f0ad" + integrity sha512-8PfynXZOHxCNI3R/8MBYeNqpGQt8JYOK6YwW8UFQ1CatpQ9ELBxXjFWsWUvqBc4raooUi9O6JyXVHgb40QQvhw== dependencies: "@derhuerst/http-basic" "^8.2.0" env-paths "^2.2.0" https-proxy-agent "^5.0.0" progress "^2.0.3" -ffprobe-static@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/ffprobe-static/-/ffprobe-static-3.0.0.tgz#479689c8a237987beca5627968f3d87429bf569d" - integrity sha512-LZ1Sj4RHS95t/ReZtRbCmMEWDDl7cfIMwmhNgCZcdtOgRlAHaGGOupoc166Q9AV+T7lXnUvu5HYczcsn69c6fw== - figgy-pudding@^3.5.1: version "3.5.1" resolved "https://registry.yarnpkg.com/figgy-pudding/-/figgy-pudding-3.5.1.tgz#862470112901c727a0e495a80744bd5baa1d6790"