9 Commits

Author SHA1 Message Date
YILS
f86ed53ccc 优化 MAC 构建配置 2025-10-22 23:56:15 +08:00
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
5 changed files with 57 additions and 10 deletions

View File

@@ -32,11 +32,7 @@ jobs:
if: matrix.os == 'macos-latest'
run: |
export ELECTRON_BUILDER_EXTRA_ARGS="--universal"
npm rebuild --arch=x64 -f ffmpeg-static && mv node_modules/ffmpeg-static/ffmpeg{,-x64}
npm rebuild --arch=arm64 -f ffmpeg-static && mv node_modules/ffmpeg-static/ffmpeg{,-arm64}
cd node_modules/ffmpeg-static
lipo -create ffmpeg-arm64 ffmpeg-x64 -output ffmpeg
cd ../..
pnpm run lipo-ffmpeg
pnpm run build
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -2,17 +2,19 @@
All significant changes to this project will be recorded in this file.
此项目的所有显著更改都将记录在此文件中。
## [v1.1.3] - 2025-10-22
## [v1.1.10] - 2025-10-22
### Added
- Add MAC embedding FFmpeg support
### Fixed
- 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
- Optimize some details
### 添加
- 增加MAC嵌入FFmpeg支持
### 修复
- 解决不设置bgm文件夹报错
- 解决 BGM 文件夹存在非 mp3 文件时报错问题
- 移除视频素材总时长不的短于语音的限制
- 优化一些细节

View File

@@ -1,7 +1,7 @@
{
"name": "short-video-factory",
"description": "短视频工厂一键生成产品营销与泛内容短视频AI批量自动剪辑",
"version": "1.1.3",
"version": "1.1.10",
"author": {
"name": "YILS",
"developer": "YILS",
@@ -16,7 +16,8 @@
"preview": "vite preview",
"format": "prettier --write .",
"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": {
"axios": "^1.11.0",

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

@@ -0,0 +1,48 @@
#!/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')
// 移除原来的二进制文件
run('rm -f ffmpeg', { cwd: ffmpegStaticDir })
// 获取两种架构的二进制文件
archs.forEach((arch) => {
run(
`pnpm cross-env FFMPEG_BINARIES_URL=${FFMPEG_BINARIES_URL} npm_config_arch=${arch} npm run install`,
{
cwd: ffmpegStaticDir,
},
)
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
if (appStore.renderConfig.bgmPath) {
try {
const bgmList = await window.electron.listFilesFromFolder({
const bgmList = (await window.electron.listFilesFromFolder({
folderPath: appStore.renderConfig.bgmPath.replace(/\\/g, '/'),
})
})).filter((asset) => asset.name.endsWith('.mp3'))
if (bgmList.length > 0) {
randomBgm = random.choice(bgmList)
}