1
0
mirror of https://github.com/mifi/lossless-cut.git synced 2024-11-25 11:43:17 +01:00

try to support arm64 #1056

but without ffmpeg
This commit is contained in:
Mikael Finstad 2022-03-09 23:40:09 +08:00
parent 90126d92b1
commit c0aabf53cf
No known key found for this signature in database
GPG Key ID: 25AB36E3E81CBC26
3 changed files with 29 additions and 15 deletions

View File

@ -11,9 +11,9 @@
"start:frontend": "cross-env BROWSER=none PORT=3001 DISABLE_ESLINT_PLUGIN=true react-scripts start", "start:frontend": "cross-env BROWSER=none PORT=3001 DISABLE_ESLINT_PLUGIN=true react-scripts start",
"start:electron": "wait-on http://localhost:3001 && electron .", "start:electron": "wait-on http://localhost:3001 && electron .",
"icon-gen": "mkdirp icon-build build-resources/appx && node script/icon-gen.mjs", "icon-gen": "mkdirp icon-build build-resources/appx && node script/icon-gen.mjs",
"download-ffmpeg-mac": "mkdirp ffmpeg/darwin && cd ffmpeg/darwin && wget https://github.com/mifi/ffmpeg-build-script/releases/download/4.4.1-2/ffmpeg -O ffmpeg && wget https://github.com/mifi/ffmpeg-build-script/releases/download/4.4.1-2/ffprobe -O ffprobe && chmod +x ffmpeg && chmod +x ffprobe", "download-ffmpeg-mac": "mkdirp ffmpeg/darwin-x64 && cd ffmpeg/darwin-x64 && wget https://github.com/mifi/ffmpeg-build-script/releases/download/4.4.1-2/ffmpeg -O ffmpeg && wget https://github.com/mifi/ffmpeg-build-script/releases/download/4.4.1-2/ffprobe -O ffprobe && chmod +x ffmpeg && chmod +x ffprobe",
"download-ffmpeg-linux": "mkdirp ffmpeg/linux && cd ffmpeg/linux && wget https://github.com/mifi/ffmpeg-builds/releases/download/4.4.1/ffmpeg-release-amd64-static.tar.xz -O ffmpeg.xz && tar xvf ffmpeg.xz ffmpeg-4.4.1-amd64-static/ffmpeg ffmpeg-4.4.1-amd64-static/ffprobe --strip-components=1", "download-ffmpeg-linux": "mkdirp ffmpeg/linux-x64 && cd ffmpeg/linux-x64 && wget https://github.com/mifi/ffmpeg-builds/releases/download/4.4.1/ffmpeg-release-amd64-static.tar.xz -O ffmpeg.xz && tar xvf ffmpeg.xz ffmpeg-4.4.1-amd64-static/ffmpeg ffmpeg-4.4.1-amd64-static/ffprobe --strip-components=1",
"download-ffmpeg-windows": "mkdirp ffmpeg/win32 && cd ffmpeg/win32 && npx download-cli https://github.com/mifi/ffmpeg-builds/releases/download/4.4.1/ffmpeg-n4.4.1-2-gcc33e73618-win64-gpl-4.4.zip --out . --filename ffmpeg.zip && 7z x ffmpeg.zip && npx shx mv ffmpeg-n4.4.1-2-gcc33e73618-win64-gpl-4.4/bin/ffmpeg.exe ./ && npx shx mv ffmpeg-n4.4.1-2-gcc33e73618-win64-gpl-4.4/bin/ffprobe.exe ./", "download-ffmpeg-windows": "mkdirp ffmpeg/win32-x64 && cd ffmpeg/win32-x64 && npx download-cli https://github.com/mifi/ffmpeg-builds/releases/download/4.4.1/ffmpeg-n4.4.1-2-gcc33e73618-win64-gpl-4.4.zip --out . --filename ffmpeg.zip && 7z x ffmpeg.zip && npx shx mv ffmpeg-n4.4.1-2-gcc33e73618-win64-gpl-4.4/bin/ffmpeg.exe ./ && npx shx mv ffmpeg-n4.4.1-2-gcc33e73618-win64-gpl-4.4/bin/ffprobe.exe ./",
"build": "yarn icon-gen && react-scripts build", "build": "yarn icon-gen && react-scripts build",
"test": "react-scripts test", "test": "react-scripts test",
"eject": "react-scripts eject", "eject": "react-scripts eject",
@ -157,11 +157,11 @@
], ],
"extraResources": [ "extraResources": [
{ {
"from": "ffmpeg/darwin/ffmpeg", "from": "ffmpeg/darwin-${arch}/ffmpeg",
"to": "ffmpeg" "to": "ffmpeg"
}, },
{ {
"from": "ffmpeg/darwin/ffprobe", "from": "ffmpeg/darwin-${arch}/ffprobe",
"to": "ffprobe" "to": "ffprobe"
} }
], ],
@ -282,11 +282,11 @@
], ],
"extraResources": [ "extraResources": [
{ {
"from": "ffmpeg/win32/ffmpeg.exe", "from": "ffmpeg/win32-${arch}/ffmpeg.exe",
"to": "ffmpeg.exe" "to": "ffmpeg.exe"
}, },
{ {
"from": "ffmpeg/win32/ffprobe.exe", "from": "ffmpeg/win32-${arch}/ffprobe.exe",
"to": "ffprobe.exe" "to": "ffprobe.exe"
} }
], ],
@ -397,20 +397,33 @@
"linux": { "linux": {
"executableName": "losslesscut", "executableName": "losslesscut",
"extraResources": [ "extraResources": [
{ {
"from": "ffmpeg/linux/ffmpeg", "from": "ffmpeg/linux-${arch}/ffmpeg",
"to": "ffmpeg" "to": "ffmpeg"
}, },
{ {
"from": "ffmpeg/linux/ffprobe", "from": "ffmpeg/linux-${arch}/ffprobe",
"to": "ffprobe" "to": "ffprobe"
} }
], ],
"icon": "icon-build/app-512.png", "icon": "icon-build/app-512.png",
"target": [ "target": [
"tar.bz2", {
"AppImage", "arch": "x64",
"snap" "target": "tar.bz2"
},
{
"arch": "x64",
"target": "AppImage"
},
{
"arch": "x64",
"target": "snap"
},
{
"arch": "arm64",
"target": "tar.bz2"
}
] ]
}, },
"snap": { "snap": {

View File

@ -6,7 +6,7 @@ import i18n from 'i18next';
import Timecode from 'smpte-timecode'; import Timecode from 'smpte-timecode';
import { pcmAudioCodecs, getMapStreamsArgs } from './util/streams'; import { pcmAudioCodecs, getMapStreamsArgs } from './util/streams';
import { getOutPath, isDurationValid, getExtensionForFormat, isWindows, isMac, platform } from './util'; import { getOutPath, isDurationValid, getExtensionForFormat, isWindows, isMac, platform, arch } from './util';
const execa = window.require('execa'); const execa = window.require('execa');
const { join } = window.require('path'); const { join } = window.require('path');
@ -31,7 +31,7 @@ function getFfPath(cmd) {
const exeName = isWindows ? `${cmd}.exe` : cmd; const exeName = isWindows ? `${cmd}.exe` : cmd;
if (customFfPath) return join(customFfPath, exeName); if (customFfPath) return join(customFfPath, exeName);
if (isDev) return join('ffmpeg', platform, exeName); if (isDev) return join('ffmpeg', `${platform}-${arch}`, exeName);
return join(window.process.resourcesPath, exeName); return join(window.process.resourcesPath, exeName);
} }

View File

@ -153,6 +153,7 @@ export const isStoreBuild = isMasBuild || isWindowsStoreBuild;
export const isDurationValid = (duration) => Number.isFinite(duration) && duration > 0; export const isDurationValid = (duration) => Number.isFinite(duration) && duration > 0;
export const platform = os.platform(); export const platform = os.platform();
export const arch = os.arch();
export const isWindows = platform === 'win32'; export const isWindows = platform === 'win32';
export const isMac = platform === 'darwin'; export const isMac = platform === 'darwin';