mirror of
https://github.com/mifi/lossless-cut.git
synced 2024-11-22 10:22:31 +01:00
upgrade ffmpeg static
This commit is contained in:
parent
2fce98680d
commit
2fc6d0f3fa
10
package.json
10
package.json
@ -61,7 +61,7 @@
|
||||
"electron-store": "^5.1.0",
|
||||
"evergreen-ui": "^4.23.0",
|
||||
"execa": "^0.5.0",
|
||||
"ffmpeg-static": "3",
|
||||
"ffmpeg-static": "^4.0.1",
|
||||
"ffprobe-static": "^3.0.0",
|
||||
"file-type": "^12.4.0",
|
||||
"framer-motion": "^1.8.4",
|
||||
@ -103,7 +103,7 @@
|
||||
"build": {
|
||||
"files": [
|
||||
"build/**/*",
|
||||
"!node_modules/ffmpeg-static/bin/**/*",
|
||||
"!node_modules/ffmpeg-static/ffmpeg",
|
||||
"!node_modules/ffprobe-static/bin/**/*"
|
||||
],
|
||||
"asar": {
|
||||
@ -116,7 +116,7 @@
|
||||
"hardenedRuntime": true,
|
||||
"target": "dmg",
|
||||
"extraResources": [
|
||||
"node_modules/ffmpeg-static/bin/darwin/**",
|
||||
"node_modules/ffmpeg-static/ffmpeg",
|
||||
"node_modules/ffprobe-static/bin/darwin/**"
|
||||
],
|
||||
"icon": "icon-build/app-512.png"
|
||||
@ -127,14 +127,14 @@
|
||||
"zip"
|
||||
],
|
||||
"extraResources": [
|
||||
"node_modules/ffmpeg-static/bin/win32/x64/**",
|
||||
"node_modules/ffmpeg-static/ffmpeg.exe",
|
||||
"node_modules/ffprobe-static/bin/win32/x64/**"
|
||||
],
|
||||
"icon": "icon-build/app-512.png"
|
||||
},
|
||||
"linux": {
|
||||
"extraResources": [
|
||||
"node_modules/ffmpeg-static/bin/linux/x64/**",
|
||||
"node_modules/ffmpeg-static/bin/ffmpeg",
|
||||
"node_modules/ffprobe-static/bin/linux/x64/**"
|
||||
],
|
||||
"icon": "icon-build/app-512.png",
|
||||
|
@ -22,13 +22,22 @@ function getFfCommandLine(cmd, args) {
|
||||
return `${cmd} ${args.map(mapArg).join(' ')}`;
|
||||
}
|
||||
|
||||
function getPath(type) {
|
||||
function getFfmpegPath() {
|
||||
const platform = os.platform();
|
||||
|
||||
const exeName = platform === 'win32' ? 'ffmpeg.exe' : 'ffmpeg';
|
||||
return isDev
|
||||
? `node_modules/ffmpeg-static/${exeName}`
|
||||
: join(window.process.resourcesPath, `node_modules/ffmpeg-static/${exeName}`);
|
||||
}
|
||||
|
||||
function getFfprobePath() {
|
||||
const platform = os.platform();
|
||||
|
||||
const map = {
|
||||
darwin: `darwin/x64/${type}`,
|
||||
win32: `win32/x64/${type}.exe`,
|
||||
linux: `linux/x64/${type}`,
|
||||
darwin: 'darwin/x64/ffprobe',
|
||||
win32: 'win32/x64/ffprobe.exe',
|
||||
linux: 'linux/x64/ffprobe',
|
||||
};
|
||||
|
||||
const subPath = map[platform];
|
||||
@ -36,18 +45,18 @@ function getPath(type) {
|
||||
if (!subPath) throw new Error(`Unsupported platform ${platform}`);
|
||||
|
||||
return isDev
|
||||
? `node_modules/${type}-static/bin/${subPath}`
|
||||
: join(window.process.resourcesPath, `node_modules/${type}-static/bin/${subPath}`);
|
||||
? `node_modules/ffprobe-static/bin/${subPath}`
|
||||
: join(window.process.resourcesPath, `node_modules/ffprobe-static/bin/${subPath}`);
|
||||
}
|
||||
|
||||
async function runFfprobe(args) {
|
||||
const ffprobePath = await getPath('ffprobe');
|
||||
const ffprobePath = getFfprobePath();
|
||||
console.log(getFfCommandLine('ffprobe', args));
|
||||
return execa(ffprobePath, args);
|
||||
}
|
||||
|
||||
async function runFfmpeg(args) {
|
||||
const ffmpegPath = await getPath('ffmpeg');
|
||||
const ffmpegPath = getFfmpegPath();
|
||||
console.log(getFfCommandLine('ffmpeg', args));
|
||||
return execa(ffmpegPath, args);
|
||||
}
|
||||
@ -202,7 +211,7 @@ async function cut({
|
||||
|
||||
onProgress(0);
|
||||
|
||||
const ffmpegPath = await getPath('ffmpeg');
|
||||
const ffmpegPath = getFfmpegPath();
|
||||
const process = execa(ffmpegPath, ffmpegArgs);
|
||||
handleProgress(process, cutDuration, onProgress);
|
||||
const result = await process;
|
||||
@ -334,7 +343,7 @@ async function mergeFiles({ paths, outPath, allStreams }) {
|
||||
|
||||
console.log(concatTxt);
|
||||
|
||||
const ffmpegPath = await getPath('ffmpeg');
|
||||
const ffmpegPath = getFfmpegPath();
|
||||
const process = execa(ffmpegPath, ffmpegArgs);
|
||||
|
||||
stringToStream(concatTxt).pipe(process.stdin);
|
||||
@ -486,7 +495,7 @@ async function renderFrame(timestamp, filePath, rotation) {
|
||||
];
|
||||
|
||||
// console.time('ffmpeg');
|
||||
const ffmpegPath = await getPath('ffmpeg');
|
||||
const ffmpegPath = getFfmpegPath();
|
||||
// console.timeEnd('ffmpeg');
|
||||
// console.log('ffmpeg', args);
|
||||
const { stdout } = await execa(ffmpegPath, args, { encoding: null });
|
||||
|
42
yarn.lock
42
yarn.lock
@ -1933,6 +1933,13 @@ decompress-response@^3.3.0:
|
||||
dependencies:
|
||||
mimic-response "^1.0.0"
|
||||
|
||||
decompress-response@^4.2.0:
|
||||
version "4.2.1"
|
||||
resolved "https://registry.yarnpkg.com/decompress-response/-/decompress-response-4.2.1.tgz#414023cc7a302da25ce2ec82d0d5238ccafd8986"
|
||||
integrity sha512-jOSne2qbyE+/r8G1VU+G/82LBs2Fs4LAsTiLSHOCOMZQl2OKZ6i8i4IyHemTe+/yIXOtTcRQMzPcgyhoFlqPkw==
|
||||
dependencies:
|
||||
mimic-response "^2.0.0"
|
||||
|
||||
deep-extend@^0.6.0:
|
||||
version "0.6.0"
|
||||
resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac"
|
||||
@ -2666,10 +2673,13 @@ fd-slicer@~1.0.1:
|
||||
dependencies:
|
||||
pend "~1.2.0"
|
||||
|
||||
ffmpeg-static@3:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/ffmpeg-static/-/ffmpeg-static-3.0.0.tgz#e5d259023682f118ea370eab937385c8da4c664f"
|
||||
integrity sha512-LCBAB1J10ku7+SWbFTLJ4zjDtrniwYDMIyRmg1Vxvzst5TyCrsrfKHg1YPrvvsUhrzknTXxL6NoUG6s2xftbcg==
|
||||
ffmpeg-static@^4.0.1:
|
||||
version "4.0.1"
|
||||
resolved "https://registry.yarnpkg.com/ffmpeg-static/-/ffmpeg-static-4.0.1.tgz#0833e010ef96251e1d4c1ca67ebcf0d036be9662"
|
||||
integrity sha512-tUGBiessDvslK6jfVpfrhm6NvXPrIOclSVsqI8FGx4uDPN6xvdH8mGghcZDOjXky65FjaRPcTu3y/8Ne6VXRtQ==
|
||||
dependencies:
|
||||
progress "^2.0.3"
|
||||
simple-get "^3.1.0"
|
||||
|
||||
ffprobe-static@^3.0.0:
|
||||
version "3.0.0"
|
||||
@ -4104,6 +4114,11 @@ mimic-response@^1.0.0, mimic-response@^1.0.1:
|
||||
resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-1.0.1.tgz#4923538878eef42063cb8a3e3b0798781487ab1b"
|
||||
integrity sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==
|
||||
|
||||
mimic-response@^2.0.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-2.1.0.tgz#d13763d35f613d09ec37ebb30bac0469c0ee8f43"
|
||||
integrity sha512-wXqjST+SLt7R009ySCglWBCFpjUygmCIfD790/kVbiGmUgfYGuB14PiTd5DwVxSV4NcYHjzMkoj5LjQZwTQLEA==
|
||||
|
||||
minimatch@^3.0.0, minimatch@^3.0.2, minimatch@^3.0.4:
|
||||
version "3.0.4"
|
||||
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
|
||||
@ -4773,6 +4788,11 @@ progress@^2.0.0:
|
||||
resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.0.tgz#8a1be366bf8fc23db2bd23f10c6fe920b4389d1f"
|
||||
integrity sha1-ihvjZr+Pwj2yvSPxDG/pILQ4nR8=
|
||||
|
||||
progress@^2.0.3:
|
||||
version "2.0.3"
|
||||
resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8"
|
||||
integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==
|
||||
|
||||
promise@^7.1.1:
|
||||
version "7.3.1"
|
||||
resolved "https://registry.yarnpkg.com/promise/-/promise-7.3.1.tgz#064b72602b18f90f29192b8b1bc418ffd1ebd3bf"
|
||||
@ -5521,6 +5541,20 @@ signal-exit@^3.0.0, signal-exit@^3.0.2:
|
||||
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d"
|
||||
integrity sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=
|
||||
|
||||
simple-concat@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/simple-concat/-/simple-concat-1.0.0.tgz#7344cbb8b6e26fb27d66b2fc86f9f6d5997521c6"
|
||||
integrity sha1-c0TLuLbib7J9ZrL8hvn21Zl1IcY=
|
||||
|
||||
simple-get@^3.1.0:
|
||||
version "3.1.0"
|
||||
resolved "https://registry.yarnpkg.com/simple-get/-/simple-get-3.1.0.tgz#b45be062435e50d159540b576202ceec40b9c6b3"
|
||||
integrity sha512-bCR6cP+aTdScaQCnQKbPKtJOKDp/hj9EDLJo3Nw4y1QksqaovlW/bnptB6/c1e+qmNIDHRK+oXFDdEqBT8WzUA==
|
||||
dependencies:
|
||||
decompress-response "^4.2.0"
|
||||
once "^1.3.1"
|
||||
simple-concat "^1.0.0"
|
||||
|
||||
simple-swizzle@^0.2.2:
|
||||
version "0.2.2"
|
||||
resolved "https://registry.yarnpkg.com/simple-swizzle/-/simple-swizzle-0.2.2.tgz#a4da6b635ffcccca33f70d17cb92592de95e557a"
|
||||
|
Loading…
Reference in New Issue
Block a user