diff --git a/README.md b/README.md index f523dbd..fbc99c0 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,8 @@ - [工作流程](#工作流程) # 依赖 -(整合包用户可以忽略环境依赖)首先,你需要一张英伟达显卡,因为作者比较懒只做了cuda的兼容。 +(整合包用户可以忽略环境依赖,直接运行run.bat即可。如果想直接运行exe,仅需安装ffmpeg并添加环境变量) +首先,你需要一张英伟达显卡,因为作者比较懒只做了cuda的兼容。 安装依赖需要:requirements.txt中的各种依赖,pythorch库,ffmpeg(可选)。本工程Python 3.9.19上验证。另外如果你想体验完整的工作流程,推荐下载一个字幕文件编辑器,尽管本程序用不到,但是在转换视频的工作中,你一定用得到,我使用Aegisub。 1、各种基本库安装 diff --git a/example/1.json b/example/1.json index 833790d..8e87570 100644 --- a/example/1.json +++ b/example/1.json @@ -19,7 +19,7 @@ "TTS": "edge", "TTS param": "", "voice connect": true, - "audio zh transcribe": true, + "audio zh transcribe": false, "audio zh transcribe model": "medium", "video zh preview": true } \ No newline at end of file diff --git a/example/2.json b/example/2.json index 38abd3a..cdc50bb 100644 --- a/example/2.json +++ b/example/2.json @@ -19,7 +19,7 @@ "TTS": "edge", "TTS param": "", "voice connect": true, - "audio zh transcribe": true, + "audio zh transcribe": false, "audio zh transcribe model": "medium", "video zh preview": true } \ No newline at end of file diff --git a/example/paramDict.json b/example/paramDict.json index 28a1b56..60d8ab4 100644 --- a/example/paramDict.json +++ b/example/paramDict.json @@ -19,7 +19,7 @@ "TTS": "edge", "TTS param": "", "voice connect": true, - "audio zh transcribe": true, + "audio zh transcribe": false, "audio zh transcribe model": "medium", "video zh preview": true } \ No newline at end of file diff --git a/package.bat b/package.bat new file mode 100644 index 0000000..00c2e84 --- /dev/null +++ b/package.bat @@ -0,0 +1 @@ +pyinstaller --onefile work_space.py \ No newline at end of file diff --git a/work_space.py b/work_space.py index b577f7f..b0058a5 100644 --- a/work_space.py +++ b/work_space.py @@ -25,6 +25,7 @@ import math import struct import tkinter as tk +from tkinter import messagebox from tkinter import filedialog PROXY = "127.0.0.1:7890" @@ -402,7 +403,6 @@ def srtToVoice(url, srtFileNameAndPath, outputDir): print("Convert srt to voice successfully") return True - def srtToVoiceEdge(srtFileNameAndPath, outputDir, charactor = "zh-CN-XiaoyiNeural"): # create output directory if not exists if not os.path.exists(outputDir): @@ -548,8 +548,31 @@ def voiceConnect(sourceDir, outputAndPath): combined.export(outputAndPath, format="wav") return True +def envCheck(): + # 检查环境变量中是否包含 ffmpeg + ffmpeg_path = os.environ.get('PATH', '').split(os.pathsep) + ffmpeg_found = any('ffmpeg' in path.lower() for path in ffmpeg_path) + waringMessage = "" + + print(ffmpeg_found) + if not ffmpeg_found: + waringMessage += "未安装ffmpeg,请安装ffmpeg并将其所在目录添加到环境变量PATH中。\n" + + if waringMessage: + root = tk.Tk() + root.deiconify() # 隐藏主窗口 + messagebox.showwarning("环境依赖警告", waringMessage) + + root.destroy() # 销毁主窗口 + return False + return True + + if __name__ == "__main__": + if not envCheck(): + exit(-1) + print("Please input the path and name of the parameter file (json format): ") root = tk.Tk() root.deiconify() # 打开主窗口 diff --git "a/\346\211\223\345\214\205\346\243\200\346\237\245.md" "b/\346\211\223\345\214\205\346\243\200\346\237\245.md" index 19520c3..ec12fd1 100644 --- "a/\346\211\223\345\214\205\346\243\200\346\237\245.md" +++ "b/\346\211\223\345\214\205\346\243\200\346\237\245.md" @@ -1,8 +1,9 @@ # 打包检查 1. 打包文件名是否正确? -2. faster-whisper_models模型是否有? -3. models的模型是否有? -4. example中的示例配置文件是否内容正确?密钥是否清理干净? -5. Readme.md是否打包了最新的? -6. 运行程序是否正常? -7. 测试的中间文件是否清理干净了? \ No newline at end of file +2. 有没有ffmpeg? +3. faster-whisper_models模型是否有? +4. models的模型是否有? +5. example中的示例配置文件是否内容正确?密钥是否清理干净? +6. Readme.md是否打包了最新的? +7. 运行程序是否正常? +8. 测试的中间文件是否清理干净了? \ No newline at end of file