bravekingzhang / text2video

半个神器👉一键文本转视频的工具
MIT License
942 stars 167 forks source link

Win中报错 #1

Closed ObliviateOnline closed 1 year ago

ObliviateOnline commented 1 year ago

错误日志如下: zh-cn {'type': 'ZH_CN2EN', 'errorCode': 0, 'elapsedTime': 0, 'translateResult': [[{'src': '白云朵朵', 'tgt': 'White clouds'}]]} [2023-06-14 11:21:43,288] ERROR in app: Exception on /convert [POST] Traceback (most recent call last): File "C:\Users\17892\AppData\Roaming\Python\Python311\site-packages\flask\app.py", line 2190, in wsgi_app response = self.full_dispatch_request() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\17892\AppData\Roaming\Python\Python311\site-packages\flask\app.py", line 1486, in full_dispatch_request rv = self.handle_user_exception(e) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\17892\AppData\Roaming\Python\Python311\site-packages\flask\app.py", line 1484, in full_dispatch_request rv = self.dispatch_request() ^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\17892\AppData\Roaming\Python\Python311\site-packages\flask\app.py", line 1469, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(*view_args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\text2video\app.py", line 21, in convert_text_to_video video_path = convertTextToVideo(validate_model(model), text) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\text2video\text_to_video.py", line 102, in convertTextToVideo generateImage(model, sentence.strip()) File "D:\text2video\text_to_video.py", line 48, in generateImage convert_text_to_speech( File "D:\text2video\text_to_video.py", line 61, in convert_text_to_speech result = subprocess.run(command, cwd=current_directory, timeout=10) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python311\Lib\subprocess.py", line 548, in run with Popen(popenargs, **kwargs) as process: ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python311\Lib\subprocess.py", line 1024, in init self._execute_child(args, executable, preexec_fn, close_fds, File "C:\Python311\Lib\subprocess.py", line 1509, in _execute_child hp, ht, pid, tid = _winapi.CreateProcess(executable, args, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FileNotFoundError: [WinError 2] 系统找不到指定的文件。

感觉是文字转音频失败了

bravekingzhang commented 1 year ago

那就检查下音频目录生成了吗?

ObliviateOnline commented 1 year ago

D:\text2video\voices 这个是有的

bravekingzhang commented 1 year ago

那你这个感觉是不是不对呀🤦‍♂️

ObliviateOnline commented 1 year ago

定位是在text_to_video.py的convert_text_to_speech这个方法上

ObliviateOnline commented 1 year ago

image 请问要安这个吗edge-tts

ObliviateOnline commented 1 year ago

在ext_to_video.py文件中导入了import edge_tts,以及python -m zh-cn {'type': 'ZH_CN2EN', 'errorCode': 0, 'elapsedTime': 1, 'translateResult': [[{'src': '白日依山尽', 'tgt': 'The sun beyond the mountain glows'}]]} C:\Python311\python.exe: No module named edge-tts CompletedProcess(args=['python', '-m', 'edge-tts', '--voice', 'zh-CN-XiaoyiNeural', '--text', '白日依山尽', '--write-media', 'voices/1686731885-stable-diffusion-2-1.mp3', '--write-subtitles', 'voices/1686731885-stable-diffusion-2-1.mp3.vtt'], returncode=1) voices/1686731885-stable-diffusion-2-1.mp3.vtt [2023-06-14 16:38:05,942] ERROR in app: Exception on /convert [POST] Traceback (most recent call last): File "C:\Users\17892\AppData\Roaming\Python\Python311\site-packages\flask\app.py", line 2190, in wsgi_app response = self.full_dispatch_request() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\17892\AppData\Roaming\Python\Python311\site-packages\flask\app.py", line 1486, in full_dispatch_request rv = self.handle_user_exception(e) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\17892\AppData\Roaming\Python\Python311\site-packages\flask\app.py", line 1484, in full_dispatch_request rv = self.dispatch_request() ^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\17892\AppData\Roaming\Python\Python311\site-packages\flask\app.py", line 1469, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\text2video\app.py", line 21, in convert_text_to_video video_path = convertTextToVideo(validate_model(model), text) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\text2video\text_to_video.py", line 106, in convertTextToVideo generateImage(model, sentence.strip()) File "D:\text2video\text_to_video.py", line 52, in generateImage convert_text_to_speech( File "D:\text2video\text_to_video.py", line 70, in convert_text_to_speech os.remove(output_file + ".vtt") FileNotFoundError: [WinError 2] 系统找不到指定的文件。: 'voices/1686731885-stable-diffusion-2-1.mp3.vtt'

现在变成了 image

bravekingzhang commented 1 year ago

安装一下edge-tts ,可能是我没在readme里面写,这个文字生成声音用到这个库了

ObliviateOnline commented 1 year ago

我pip install edge-tts,但是你原来的text_to_video.py文件没引用这个库啊,如果不修改文件还是没法转,我改了但好像又不对,所以作者是在哪里安装的edge-tts?

bravekingzhang commented 1 year ago

我pip install edge-tts,但是你原来的text_to_video.py文件没引用这个库啊,如果不修改文件还是没法转,我改了但好像又不对,所以作者是在哪里安装的edge-tts?

代码里面,shell 命令有调用

ObliviateOnline commented 1 year ago

解决了,要用pipx去下载,这样就有带exe可执行文件的edge-tts.exe,然后再添加到环境path就行