YaoFANGUK / video-subtitle-generator

视频音频生成字幕,生成srt文件。无需申请第三方API,本地实现音频转文本。基于Transformer的视频字幕生成框架。A GUI tool for generating subtitle from videos and generating srt files.
Apache License 2.0
857 stars 164 forks source link

运行报错 #7

Closed godofworld closed 1 year ago

godofworld commented 1 year ago

请输入视频地址: F:\video-subtitle-generator-main\test\test_cn.mp4 return program 'ffmpeg' 不是内部或外部命令,也不是可运行的程序 或批处理文件。 multiprocessing.pool.RemoteTraceback: """ Traceback (most recent call last): File "C:\Users\user007\miniconda3\envs\vsgEnv\lib\multiprocessing\pool.py", line 125, in worker result = (True, func(*args, *kwds)) File "F:\video-subtitle-generator-main\backend\main.py", line 64, in call subprocess.check_output(command, stdin=open(os.devnull), shell=use_shell) File "C:\Users\user007\miniconda3\envs\vsgEnv\lib\subprocess.py", line 415, in check_output return run(popenargs, stdout=PIPE, timeout=timeout, check=True, File "C:\Users\user007\miniconda3\envs\vsgEnv\lib\subprocess.py", line 516, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['ffmpeg', '-ss', '0.006000000000000005', '-t', '1.524', '-y', '-i', 'C:\Users\user007\AppData\Local\Temp\tmpyt4zyzet.wav', '-loglevel', 'error', 'C:\Users\user007\AppData\Local\Temp\tmpk3bh6dlw.flac']' returned non-zero exit status 1. """

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "backend/main.py", line 228, in sg.run() File "backend/main.py", line 194, in run for i, extracted_region in enumerate(pool.imap(converter, regions)): File "C:\Users\user007\miniconda3\envs\vsgEnv\lib\multiprocessing\pool.py", line 868, in next raise value subprocess.CalledProcessError: Command '['ffmpeg', '-ss', '0.006000000000000005', '-t', '1.524', '-y', '-i', 'C:\Users\user007\AppData\Local\Temp\tmpyt4zyzet.wav', '-loglevel', 'error', 'C:\Users\user007\AppData\Local\Temp\tmpk3bh6dlw.flac']' returned non-zero exit status 1. (vsgEnv) PS F:\video-subtitle-generator-main>

请问是缺了什么组件吗?

YaoFANGUK commented 1 year ago

装一下ffmpeg

godofworld commented 1 year ago

感谢回复!win10下安装ffmpeg并配置环境变量后运行python backend/main.py报错如下 (vsgEnv) PS F:\video-subtitle-generator-main> python backend/main.py

Traceback (most recent call last): File "backend/main.py", line 13, in import whisper File "F:\video-subtitle-generator-main\backend\whisper__init__.py", line 5, in import torch ModuleNotFoundError: No module named 'torch' (vsgEnv) PS F:\video-subtitle-generator-main>

求指导,感谢!

YaoFANGUK commented 1 year ago

pip install -r requirements.txt

godofworld commented 1 year ago

总算运行成功,感谢指导!请问可以指定识别的语种吗?测试发现有的视频会识别出多种语言,一会儿en,一会儿fr,还有ko的,感觉容易混乱,后期整理花费的时间很大,如果可以指定单语种识别效率应该会更快

majay123 commented 1 year ago

multiprocessing.pool.RemoteTraceback: """ Traceback (most recent call last): File "/Users/mcd/opt/miniconda3/envs/vsgEnv/lib/python3.8/multiprocessing/pool.py", line 125, in worker result = (True, func(*args, kwds)) File "/Users/mcd/Desktop/My_Github/video-subtitle-generator/backend/main.py", line 64, in call subprocess.check_output(command, stdin=open(os.devnull), shell=use_shell) File "/Users/mcd/opt/miniconda3/envs/vsgEnv/lib/python3.8/subprocess.py", line 415, in check_output return run(popenargs, stdout=PIPE, timeout=timeout, check=True, File "/Users/mcd/opt/miniconda3/envs/vsgEnv/lib/python3.8/subprocess.py", line 493, in run with Popen(popenargs, kwargs) as process: File "/Users/mcd/opt/miniconda3/envs/vsgEnv/lib/python3.8/subprocess.py", line 858, in init self._execute_child(args, executable, preexec_fn, close_fds, File "/Users/mcd/opt/miniconda3/envs/vsgEnv/lib/python3.8/subprocess.py", line 1704, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'ffmpeg' """

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "backend/main.py", line 228, in sg.run() File "backend/main.py", line 194, in run for i, extracted_region in enumerate(pool.imap(converter, regions)): File "/Users/mcd/opt/miniconda3/envs/vsgEnv/lib/python3.8/multiprocessing/pool.py", line 868, in next raise value FileNotFoundError: [Errno 2] No such file or directory: 'ffmpeg' 这是找不到ffmpeg,系统是mac,在mac下安装ffmpeg吗?

joe-zxh commented 1 year ago

multiprocessing.pool.RemoteTraceback: """ Traceback (most recent call last): File "/Users/mcd/opt/miniconda3/envs/vsgEnv/lib/python3.8/multiprocessing/pool.py", line 125, in worker result = (True, func(*args, kwds)) File "/Users/mcd/Desktop/My_Github/video-subtitle-generator/backend/main.py", line 64, in call subprocess.check_output(command, stdin=open(os.devnull), shell=use_shell) File "/Users/mcd/opt/miniconda3/envs/vsgEnv/lib/python3.8/subprocess.py", line 415, in check_output return run(popenargs, stdout=PIPE, timeout=timeout, check=True, File "/Users/mcd/opt/miniconda3/envs/vsgEnv/lib/python3.8/subprocess.py", line 493, in run with Popen(popenargs, kwargs) as process: File "/Users/mcd/opt/miniconda3/envs/vsgEnv/lib/python3.8/subprocess.py", line 858, in init self._execute_child(args, executable, preexec_fn, close_fds, File "/Users/mcd/opt/miniconda3/envs/vsgEnv/lib/python3.8/subprocess.py", line 1704, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'ffmpeg' """

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "backend/main.py", line 228, in sg.run() File "backend/main.py", line 194, in run for i, extracted_region in enumerate(pool.imap(converter, regions)): File "/Users/mcd/opt/miniconda3/envs/vsgEnv/lib/python3.8/multiprocessing/pool.py", line 868, in next raise value FileNotFoundError: [Errno 2] No such file or directory: 'ffmpeg' 这是找不到ffmpeg,系统是mac,在mac下安装ffmpeg吗?

在main.py的第80行: command = ["ffmpeg", "-ss", str(start), "-t", str(end - start), 改成: command = [config.FFMPEG_PATH, "-ss", str(start), "-t", str(end - start),