Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

window上处理MP3 #54

Closed
bjfrbjx opened this issue Apr 1, 2023 · 7 comments
Closed

window上处理MP3 #54

bjfrbjx opened this issue Apr 1, 2023 · 7 comments

Comments

@bjfrbjx
Copy link

bjfrbjx commented Apr 1, 2023

File "E:\learn\sadtalker\inference.py", line 93, in main animate_from_coeff.generate(data, save_dir, enhancer=args.enhancer, original_size=original_size) File "E:\learn\sadtalker\src\facerender\animate.py", line 165, in generate sound = AudioSegment.from_mp3(audio_path) File "E:\venv\sadtalker\lib\site-packages\pydub\audio_segment.py", line 796, in from_mp3 return cls.from_file(file, 'mp3', parameters=parameters) File "E:\venv\sadtalker\lib\site-packages\pydub\audio_segment.py", line 728, in from_file info = mediainfo_json(orig_file, read_ahead_limit=read_ahead_limit) File "E:\venv\sadtalker\lib\site-packages\pydub\utils.py", line 274, in mediainfo_json res = Popen(command, stdin=stdin_parameter, stdout=PIPE, stderr=PIPE) File "E:\Python310\pyenv-win\versions\3.8.3\lib\subprocess.py", line 854, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "E:\Python310\pyenv-win\versions\3.8.3\lib\subprocess.py", line 1307, in _execute_child hp, ht, pid, tid = _winapi.CreateProcess(executable, args, FileNotFoundError: [WinError 2] 系统找不到指定的文件。
原因:pyhub的AudioSegment.from_file方法使用的时Popen去执行命令行 ['ffprobe' ,'-of' ,'json', '-v' ,'info' ,'-show_format', '-show_streams', 'D:\\audio\\m.mp3'] 来加载音频详细信息。linux、mac下是没有问题的,但是windows下需要把ffmpeg、ffprobe等执行文件放在工作目录下才能执行,想要使用环境变量PATH下的ffprobe需要加上 ['cmd' ,'/c'] 。

@vinthony
Copy link
Collaborator

vinthony commented Apr 5, 2023

非常感谢您的分享,会帮助到其他使用windows的朋友。我会开一个FAQ存放此类问题。

@vinthony vinthony closed this as completed Apr 8, 2023
@mingweihehehe
Copy link

请问具体怎么操作?

@mingweihehehe
Copy link

工作目录具体指什么?怎样加上CMD?

@vinthony
Copy link
Collaborator

ffmpeg的bin文件夹在系统环境变量路径之中就可以了

@bjfrbjx
Copy link
Author

bjfrbjx commented Apr 20, 2023

ffmpeg的bin文件夹在系统环境变量路径之中就可以了

确实如此,之前我把ffmpeg放在中文目录下,导致python的os.environ.get("PATH")下ffmpeg的路径乱码,所以失败。
后面改成英文路径就好了

@liuzengzhen
Copy link

可以老哥,路径需要全英文

@liangzhenbin1992
Copy link

运行时出现这个,请问怎么解决
RuntimeError: Cannot load audio from file: ffprobe not found. Please install ffmpeg in your system to use non-WAV audio file formats and make sure ffprobe is in your PATH.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants