9 Commits

Author SHA1 Message Date
YILS
56600b3353 优化 MAC 构建配置 2025-10-22 23:43:00 +08:00
YILS
1cedfae6a7 优化 MAC 构建配置 2025-10-22 23:20:26 +08:00
YILS
b35c4420f2 优化 MAC 构建配置 2025-10-22 23:06:16 +08:00
YILS
3768010b60 优化 MAC 构建配置 2025-10-22 22:30:59 +08:00
YILS
7002e0a153 优化 MAC 构建配置 2025-10-22 22:20:43 +08:00
YILS
5bf62a7c71 更新版本 2025-10-22 22:11:22 +08:00
YILS
42c94a56f8 解决 BGM 文件夹存在非 mp3 文件时报错问题 2025-10-22 22:09:30 +08:00
YILS
7097a95d78 优化 Action Mac构建配置 2025-10-22 22:05:30 +08:00
YILS
240c0bce72 优化MAC构建配置 2025-10-22 17:39:58 +08:00
6 changed files with 53 additions and 6 deletions

View File

@@ -11,7 +11,7 @@ jobs:
strategy: strategy:
matrix: matrix:
os: [macos-latest, macos-latest-large, windows-latest, ubuntu-latest] os: [macos-latest, windows-latest, ubuntu-latest]
steps: steps:
- name: Check out Git repository - name: Check out Git repository
@@ -32,6 +32,7 @@ jobs:
if: matrix.os == 'macos-latest' if: matrix.os == 'macos-latest'
run: | run: |
export ELECTRON_BUILDER_EXTRA_ARGS="--universal" export ELECTRON_BUILDER_EXTRA_ARGS="--universal"
pnpm run lipo-ffmpeg
pnpm run build pnpm run build
env: env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -2,17 +2,19 @@
All significant changes to this project will be recorded in this file. All significant changes to this project will be recorded in this file.
此项目的所有显著更改都将记录在此文件中。 此项目的所有显著更改都将记录在此文件中。
## [v1.1.2] - 2025-10-22 ## [v1.1.9] - 2025-10-22
### Added ### Added
- Add MAC embedding FFmpeg support - Add MAC embedding FFmpeg support
### Fixed ### Fixed
- Resolve the error of not setting BGM folder - Resolve the error of not setting BGM folder
- Resolve the issue of reporting errors when there are non mp3 files in the BGM folder
- Remove the restriction that the total duration of video materials should not be shorter than that of voice - Remove the restriction that the total duration of video materials should not be shorter than that of voice
- Optimize some details - Optimize some details
### 添加 ### 添加
- 增加MAC嵌入FFmpeg支持 - 增加MAC嵌入FFmpeg支持
### 修复 ### 修复
- 解决不设置bgm文件夹报错 - 解决不设置bgm文件夹报错
- 解决 BGM 文件夹存在非 mp3 文件时报错问题
- 移除视频素材总时长不的短于语音的限制 - 移除视频素材总时长不的短于语音的限制
- 优化一些细节 - 优化一些细节

View File

@@ -14,6 +14,7 @@
target: [ target: [
{ {
target: 'dmg', target: 'dmg',
arch: ['universal'],
}, },
], ],
artifactName: '${name}-${version}-mac-${arch}-installer.${ext}', artifactName: '${name}-${version}-mac-${arch}-installer.${ext}',

View File

@@ -1,7 +1,7 @@
{ {
"name": "short-video-factory", "name": "short-video-factory",
"description": "短视频工厂一键生成产品营销与泛内容短视频AI批量自动剪辑", "description": "短视频工厂一键生成产品营销与泛内容短视频AI批量自动剪辑",
"version": "1.1.2", "version": "1.1.9",
"author": { "author": {
"name": "YILS", "name": "YILS",
"developer": "YILS", "developer": "YILS",
@@ -16,7 +16,8 @@
"preview": "vite preview", "preview": "vite preview",
"format": "prettier --write .", "format": "prettier --write .",
"preinstall": "npx only-allow pnpm", "preinstall": "npx only-allow pnpm",
"postinstall": "node scripts/post-install.js" "postinstall": "node scripts/post-install.js",
"lipo-ffmpeg":"node scripts/lipo-ffmpeg.js"
}, },
"dependencies": { "dependencies": {
"axios": "^1.11.0", "axios": "^1.11.0",

42
scripts/lipo-ffmpeg.js Normal file
View File

@@ -0,0 +1,42 @@
#!/usr/bin/env node
/**
* 1. 设置环境变量 FFMPEG_BINARIES_URL
* 2. 分别 rebuild x64 / arm64 两个架构
* 3. 用 lipo 合并为通用二进制
*/
const { execSync } = require('child_process')
const path = require('path')
// 1. 环境变量
const FFMPEG_BINARIES_URL = process.env['npm_config_ffmpeg_binaries_url']
// 2. 工具函数:执行命令并带彩色输出
function run(cmd, opts = {}) {
console.log(`\n${cmd}`)
try {
execSync(cmd, { stdio: 'inherit', shell: true, ...opts })
} catch (e) {
console.error(`❌ 命令失败: ${cmd}`)
process.exit(1)
}
}
// 3. 开始干活
const archs = ['x64', 'arm64']
const ffmpegStaticDir = path.join(__dirname, '..', 'node_modules', 'ffmpeg-static')
// rebuild 两次
archs.forEach((arch) => {
run(
`pnpm cross-env FFMPEG_BINARIES_URL=${FFMPEG_BINARIES_URL} npm --arch=${arch} rebuild -f ffmpeg-static`,
)
run(`mv ${ffmpegStaticDir}/ffmpeg ${ffmpegStaticDir}/ffmpeg-${arch}`)
})
// 合并
run('lipo -create ffmpeg-arm64 ffmpeg-x64 -output ffmpeg', { cwd: ffmpegStaticDir })
// 赋权
run('chmod 0755 ffmpeg', { cwd: ffmpegStaticDir })
console.log('\n✅ 通用 ffmpeg 已生成:', path.join(ffmpegStaticDir, 'ffmpeg'))

View File

@@ -66,9 +66,9 @@ const handleRenderVideo = async () => {
let randomBgm: ListFilesFromFolderRecord | undefined = undefined let randomBgm: ListFilesFromFolderRecord | undefined = undefined
if (appStore.renderConfig.bgmPath) { if (appStore.renderConfig.bgmPath) {
try { try {
const bgmList = await window.electron.listFilesFromFolder({ const bgmList = (await window.electron.listFilesFromFolder({
folderPath: appStore.renderConfig.bgmPath.replace(/\\/g, '/'), folderPath: appStore.renderConfig.bgmPath.replace(/\\/g, '/'),
}) })).filter((asset) => asset.name.endsWith('.mp3'))
if (bgmList.length > 0) { if (bgmList.length > 0) {
randomBgm = random.choice(bgmList) randomBgm = random.choice(bgmList)
} }