Skip to content

Let's use AI to Earn!

feat: 更换包

牛文政2c26a6ab1ada
diff --git a/electron/util/ffmpeg/index.ts b/electron/util/ffmpeg/index.ts
index e734e405..6729d65a 100644
--- a/electron/util/ffmpeg/index.ts
+++ b/electron/util/ffmpeg/index.ts
@@ -5,32 +5,14 @@
* @LastEditors: nevin
* @Description: ffmpeg工具
*/
-import ffmpeg from 'fluent-ffmpeg'; // 一个封装了 ffmpeg API 的库,当然可以选择不安装,直接使用字符串拼接的方式调用
-import os from 'os';
-import { app } from 'electron';
-import path from 'path';
-import { fileURLToPath } from 'node:url';
-
-const __dirname = path.dirname(fileURLToPath(import.meta.url));
-
-const platform = os.platform();
-const arch = os.arch();
-
-// 获取ffmpeg二进制文件的路径,不同平台不一样
-function setFFmpegPath() {
- const ffPath = app.isPackaged
- ? path.join(process.resourcesPath, 'bin')
- : path.join(__dirname, `../../scripts/file/ff/${platform}/${arch}`);
-
- ffmpeg.setFfprobePath(
- path.join(ffPath, `ffprobe${platform === 'win32' ? '.exe' : ''}`),
- );
- ffmpeg.setFfmpegPath(
- path.join(ffPath, `ffmpeg${platform === 'win32' ? '.exe' : ''}`),
- );
-}
-setFFmpegPath();
+import ffmpeg from 'fluent-ffmpeg';
+import ffmpegPath from '@ffmpeg-installer/ffmpeg';
+import ffprobePath from '@ffprobe-installer/ffprobe';
+ffmpeg.setFfmpegPath(ffmpegPath.path.replace('app.asar', 'app.asar.unpacked'));
+ffmpeg.setFfprobePath(
+ ffprobePath.path.replace('app.asar', 'app.asar.unpacked'),
+);
export default class FFmpeg {
ffmpeg: ffmpeg.FfmpegCommand;
diff --git a/electron/util/ffmpeg/indexback b/electron/util/ffmpeg/indexback
new file mode 100644
index 00000000..e734e405
--- /dev/null
+++ b/electron/util/ffmpeg/indexback
@@ -0,0 +1,40 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-02-14 16:36:05
+ * @LastEditTime: 2025-02-23 20:07:52
+ * @LastEditors: nevin
+ * @Description: ffmpeg工具
+ */
+import ffmpeg from 'fluent-ffmpeg'; // 一个封装了 ffmpeg API 的库,当然可以选择不安装,直接使用字符串拼接的方式调用
+import os from 'os';
+import { app } from 'electron';
+import path from 'path';
+import { fileURLToPath } from 'node:url';
+
+const __dirname = path.dirname(fileURLToPath(import.meta.url));
+
+const platform = os.platform();
+const arch = os.arch();
+
+// 获取ffmpeg二进制文件的路径,不同平台不一样
+function setFFmpegPath() {
+ const ffPath = app.isPackaged
+ ? path.join(process.resourcesPath, 'bin')
+ : path.join(__dirname, `../../scripts/file/ff/${platform}/${arch}`);
+
+ ffmpeg.setFfprobePath(
+ path.join(ffPath, `ffprobe${platform === 'win32' ? '.exe' : ''}`),
+ );
+ ffmpeg.setFfmpegPath(
+ path.join(ffPath, `ffmpeg${platform === 'win32' ? '.exe' : ''}`),
+ );
+}
+setFFmpegPath();
+
+export default class FFmpeg {
+ ffmpeg: ffmpeg.FfmpegCommand;
+
+ constructor(inputPath: string) {
+ this.ffmpeg = ffmpeg(inputPath);
+ }
+}
diff --git a/package-lock.json b/package-lock.json
index f9ba1717..8744f670 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -11,6 +11,8 @@
"dependencies": {
"@ant-design/colors": "^7.2.0",
"@ant-design/icons": "^5.6.1",
+ "@ffmpeg-installer/ffmpeg": "^1.1.0",
+ "@ffprobe-installer/ffprobe": "^2.1.2",
"antd": "^5.23.1",
"antd-img-crop": "^4.24.0",
"axios": "^1.7.9",
@@ -40,6 +42,7 @@
"p-queue": "^8.1.0",
"path": "^0.12.7",
"qs": "^6.14.0",
+ "react-intersection-observer": "^9.16.0",
"react-masonry-css": "^1.0.16",
"react-router-dom": "6",
"react-sortablejs": "^6.1.4",
@@ -1403,6 +1406,243 @@
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
}
},
+ "node_modules/@ffmpeg-installer/darwin-arm64": {
+ "version": "4.1.5",
+ "resolved": "https://registry.npmmirror.com/@ffmpeg-installer/darwin-arm64/-/darwin-arm64-4.1.5.tgz",
+ "integrity": "sha512-hYqTiP63mXz7wSQfuqfFwfLOfwwFChUedeCVKkBtl/cliaTM7/ePI9bVzfZ2c+dWu3TqCwLDRWNSJ5pqZl8otA==",
+ "cpu": [
+ "arm64"
+ ],
+ "hasInstallScript": true,
+ "optional": true,
+ "os": [
+ "darwin"
+ ]
+ },
+ "node_modules/@ffmpeg-installer/darwin-x64": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmmirror.com/@ffmpeg-installer/darwin-x64/-/darwin-x64-4.1.0.tgz",
+ "integrity": "sha512-Z4EyG3cIFjdhlY8wI9aLUXuH8nVt7E9SlMVZtWvSPnm2sm37/yC2CwjUzyCQbJbySnef1tQwGG2Sx+uWhd9IAw==",
+ "cpu": [
+ "x64"
+ ],
+ "hasInstallScript": true,
+ "optional": true,
+ "os": [
+ "darwin"
+ ]
+ },
+ "node_modules/@ffmpeg-installer/ffmpeg": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmmirror.com/@ffmpeg-installer/ffmpeg/-/ffmpeg-1.1.0.tgz",
+ "integrity": "sha512-Uq4rmwkdGxIa9A6Bd/VqqYbT7zqh1GrT5/rFwCwKM70b42W5gIjWeVETq6SdcL0zXqDtY081Ws/iJWhr1+xvQg==",
+ "optionalDependencies": {
+ "@ffmpeg-installer/darwin-arm64": "4.1.5",
+ "@ffmpeg-installer/darwin-x64": "4.1.0",
+ "@ffmpeg-installer/linux-arm": "4.1.3",
+ "@ffmpeg-installer/linux-arm64": "4.1.4",
+ "@ffmpeg-installer/linux-ia32": "4.1.0",
+ "@ffmpeg-installer/linux-x64": "4.1.0",
+ "@ffmpeg-installer/win32-ia32": "4.1.0",
+ "@ffmpeg-installer/win32-x64": "4.1.0"
+ }
+ },
+ "node_modules/@ffmpeg-installer/linux-arm": {
+ "version": "4.1.3",
+ "resolved": "https://registry.npmmirror.com/@ffmpeg-installer/linux-arm/-/linux-arm-4.1.3.tgz",
+ "integrity": "sha512-NDf5V6l8AfzZ8WzUGZ5mV8O/xMzRag2ETR6+TlGIsMHp81agx51cqpPItXPib/nAZYmo55Bl2L6/WOMI3A5YRg==",
+ "cpu": [
+ "arm"
+ ],
+ "hasInstallScript": true,
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@ffmpeg-installer/linux-arm64": {
+ "version": "4.1.4",
+ "resolved": "https://registry.npmmirror.com/@ffmpeg-installer/linux-arm64/-/linux-arm64-4.1.4.tgz",
+ "integrity": "sha512-dljEqAOD0oIM6O6DxBW9US/FkvqvQwgJ2lGHOwHDDwu/pX8+V0YsDL1xqHbj1DMX/+nP9rxw7G7gcUvGspSoKg==",
+ "cpu": [
+ "arm64"
+ ],
+ "hasInstallScript": true,
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@ffmpeg-installer/linux-ia32": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmmirror.com/@ffmpeg-installer/linux-ia32/-/linux-ia32-4.1.0.tgz",
+ "integrity": "sha512-0LWyFQnPf+Ij9GQGD034hS6A90URNu9HCtQ5cTqo5MxOEc7Rd8gLXrJvn++UmxhU0J5RyRE9KRYstdCVUjkNOQ==",
+ "cpu": [
+ "ia32"
+ ],
+ "hasInstallScript": true,
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@ffmpeg-installer/linux-x64": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmmirror.com/@ffmpeg-installer/linux-x64/-/linux-x64-4.1.0.tgz",
+ "integrity": "sha512-Y5BWhGLU/WpQjOArNIgXD3z5mxxdV8c41C+U15nsE5yF8tVcdCGet5zPs5Zy3Ta6bU7haGpIzryutqCGQA/W8A==",
+ "cpu": [
+ "x64"
+ ],
+ "hasInstallScript": true,
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@ffmpeg-installer/win32-ia32": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmmirror.com/@ffmpeg-installer/win32-ia32/-/win32-ia32-4.1.0.tgz",
+ "integrity": "sha512-FV2D7RlaZv/lrtdhaQ4oETwoFUsUjlUiasiZLDxhEUPdNDWcH1OU9K1xTvqz+OXLdsmYelUDuBS/zkMOTtlUAw==",
+ "cpu": [
+ "ia32"
+ ],
+ "optional": true,
+ "os": [
+ "win32"
+ ]
+ },
+ "node_modules/@ffmpeg-installer/win32-x64": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmmirror.com/@ffmpeg-installer/win32-x64/-/win32-x64-4.1.0.tgz",
+ "integrity": "sha512-Drt5u2vzDnIONf4ZEkKtFlbvwj6rI3kxw1Ck9fpudmtgaZIHD4ucsWB2lCZBXRxJgXR+2IMSti+4rtM4C4rXgg==",
+ "cpu": [
+ "x64"
+ ],
+ "optional": true,
+ "os": [
+ "win32"
+ ]
+ },
+ "node_modules/@ffprobe-installer/darwin-arm64": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmmirror.com/@ffprobe-installer/darwin-arm64/-/darwin-arm64-5.0.1.tgz",
+ "integrity": "sha512-vwNCNjokH8hfkbl6m95zICHwkSzhEvDC3GVBcUp5HX8+4wsX10SP3B+bGur7XUzTIZ4cQpgJmEIAx6TUwRepMg==",
+ "cpu": [
+ "arm64"
+ ],
+ "hasInstallScript": true,
+ "optional": true,
+ "os": [
+ "darwin"
+ ]
+ },
+ "node_modules/@ffprobe-installer/darwin-x64": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmmirror.com/@ffprobe-installer/darwin-x64/-/darwin-x64-5.1.0.tgz",
+ "integrity": "sha512-J+YGscZMpQclFg31O4cfVRGmDpkVsQ2fZujoUdMAAYcP0NtqpC49Hs3SWJpBdsGB4VeqOt5TTm1vSZQzs1NkhA==",
+ "cpu": [
+ "x64"
+ ],
+ "hasInstallScript": true,
+ "optional": true,
+ "os": [
+ "darwin"
+ ]
+ },
+ "node_modules/@ffprobe-installer/ffprobe": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmmirror.com/@ffprobe-installer/ffprobe/-/ffprobe-2.1.2.tgz",
+ "integrity": "sha512-ZNvwk4f2magF42Zji2Ese16SMj9BS7Fui4kRjg6gTYTxY3gWZNpg85n4MIfQyI9nimHg4x/gT6FVkp/bBDuBwg==",
+ "engines": {
+ "node": ">=14.21.2"
+ },
+ "optionalDependencies": {
+ "@ffprobe-installer/darwin-arm64": "5.0.1",
+ "@ffprobe-installer/darwin-x64": "5.1.0",
+ "@ffprobe-installer/linux-arm": "5.2.0",
+ "@ffprobe-installer/linux-arm64": "5.2.0",
+ "@ffprobe-installer/linux-ia32": "5.2.0",
+ "@ffprobe-installer/linux-x64": "5.2.0",
+ "@ffprobe-installer/win32-ia32": "5.1.0",
+ "@ffprobe-installer/win32-x64": "5.1.0"
+ }
+ },
+ "node_modules/@ffprobe-installer/linux-arm": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmmirror.com/@ffprobe-installer/linux-arm/-/linux-arm-5.2.0.tgz",
+ "integrity": "sha512-PF5HqEhCY7WTWHtLDYbA/+rLS+rhslWvyBlAG1Fk8VzVlnRdl93o6hy7DE2kJgxWQbFaR3ZktPQGEzfkrmQHvQ==",
+ "cpu": [
+ "arm"
+ ],
+ "hasInstallScript": true,
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@ffprobe-installer/linux-arm64": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmmirror.com/@ffprobe-installer/linux-arm64/-/linux-arm64-5.2.0.tgz",
+ "integrity": "sha512-X1VvWtlLs6ScP73biVLuHD5ohKJKsMTa0vafCESOen4mOoNeLAYbxOVxDWAdFz9cpZgRiloFj5QD6nDj8E28yQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "hasInstallScript": true,
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@ffprobe-installer/linux-ia32": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmmirror.com/@ffprobe-installer/linux-ia32/-/linux-ia32-5.2.0.tgz",
+ "integrity": "sha512-TFVK5sasXyXhbIG7LtPRDmtkrkOsInwKcL43iEvEw+D9vCS2rc//mn9/0Q+BR0UoJEiMK4+ApYr/3LLVUBPOCQ==",
+ "cpu": [
+ "ia32"
+ ],
+ "hasInstallScript": true,
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@ffprobe-installer/linux-x64": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmmirror.com/@ffprobe-installer/linux-x64/-/linux-x64-5.2.0.tgz",
+ "integrity": "sha512-D3UeqTLYPNs7pBWPLUYGehPdRVqU8eACox4OZy3pZUZatxye2YKlvBwEfaLdL1v2Z4FOAlLUhms0kY8m8kqSRA==",
+ "cpu": [
+ "x64"
+ ],
+ "hasInstallScript": true,
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@ffprobe-installer/win32-ia32": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmmirror.com/@ffprobe-installer/win32-ia32/-/win32-ia32-5.1.0.tgz",
+ "integrity": "sha512-5O3vOoNRxmut0/Nu9vSazTdSHasrr+zPT2B3Hm7kjmO3QVFcIfVImS6ReQnZeSy8JPJOqXts5kX5x/3KOX54XQ==",
+ "cpu": [
+ "ia32"
+ ],
+ "optional": true,
+ "os": [
+ "win32"
+ ]
+ },
+ "node_modules/@ffprobe-installer/win32-x64": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmmirror.com/@ffprobe-installer/win32-x64/-/win32-x64-5.1.0.tgz",
+ "integrity": "sha512-jMGYeAgkrdn4e2vvYt/qakgHRE3CPju4bn5TmdPfoAm1BlX1mY9cyMd8gf5vSzI8gH8Zq5WQAyAkmekX/8TSTg==",
+ "cpu": [
+ "x64"
+ ],
+ "optional": true,
+ "os": [
+ "win32"
+ ]
+ },
"node_modules/@gar/promisify": {
"version": "1.1.3",
"resolved": "https://registry.npmmirror.com/@gar/promisify/-/promisify-1.1.3.tgz",
@@ -10641,6 +10881,20 @@
"react-dom": ">=16.4.0"
}
},
+ "node_modules/react-intersection-observer": {
+ "version": "9.16.0",
+ "resolved": "https://registry.npmmirror.com/react-intersection-observer/-/react-intersection-observer-9.16.0.tgz",
+ "integrity": "sha512-w9nJSEp+DrW9KmQmeWHQyfaP6b03v+TdXynaoA964Wxt7mdR3An11z4NNCQgL4gKSK7y1ver2Fq+JKH6CWEzUA==",
+ "peerDependencies": {
+ "react": "^17.0.0 || ^18.0.0 || ^19.0.0",
+ "react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0"
+ },
+ "peerDependenciesMeta": {
+ "react-dom": {
+ "optional": true
+ }
+ }
+ },
"node_modules/react-is": {
"version": "16.13.1",
"resolved": "https://registry.npmmirror.com/react-is/-/react-is-16.13.1.tgz",
diff --git a/package.json b/package.json
index 4d9ccee4..ecd6f6cd 100644
--- a/package.json
+++ b/package.json
@@ -32,6 +32,8 @@
"dependencies": {
"@ant-design/colors": "^7.2.0",
"@ant-design/icons": "^5.6.1",
+ "@ffmpeg-installer/ffmpeg": "^1.1.0",
+ "@ffprobe-installer/ffprobe": "^2.1.2",
"antd": "^5.23.1",
"antd-img-crop": "^4.24.0",
"axios": "^1.7.9",