gpt4 book ai didi

python - Pydub 无法定位 ffprobe

转载 作者:太空宇宙 更新时间:2023-11-03 10:50:37 25 4
gpt4 key购买 nike

这是与此类似问题的链接:Pydub (WindowsError: [Error 2] The system can not find the file specified)虽然在这一个中问题出在 ffmpeg 上,但我通过设置绝对路径解决了这个问题。

在为转换器和/或 ffmpeg 设置绝对路径后:

AudioSegment.converter = r'C:\ffmpeg\bin'

AudioSegment.ffmpeg = r'C:\ffmpeg\bin'

我仍然得到这个错误:

C:\Program Files\Python36\lib\site-packages\pydub\utils.py:193: RuntimeWarning: Couldn't find ffprobe or avprobe - defaulting to ffprobe, but may not workwarn("Couldn't find ffprobe or avprobe - defaulting to ffprobe, but may not work", RuntimeWarning)Traceback (most recent call last):File "C:/Users/Sean/Desktop/vp/encode_audio/m4a_to_wav.py", line 4, in song = AudioSegment.from_file("pines.m4a", "m4a")File "C:\Program Files\Python36\lib\site-packages\pydub\audio_segment.py", line 660, in from_fileinfo = mediainfo_json(orig_file)File "C:\Program Files\Python36\lib\site-packages\pydub\utils.py", line 263, in mediainfo_jsonres = Popen(command, stdin=stdin_parameter, stdout=PIPE, stderr=PIPE)File "C:\Program Files\Python36\lib\subprocess.py", line 707, in initrestore_signals, start_new_session)File "C:\Program Files\Python36\lib\subprocess.py", line 990, in _execute_childstartupinfo)FileNotFoundError: [WinError 2] The system cannot find the file specified`

我的路径环境变量中有 ffmpeg。我的路径 envvar 中也有 libav,并按照 https://github.com/jiaaro/pydub#dependencies 中指定的顺序安装了 libav,然后安装了 pydub。 .

我所做的一切似乎都不起作用,所以任何想法或解决方案都将不胜感激!

最佳答案

我遇到了同样的问题,但我在五分钟前解决了。

解决方法如下:

  1. 将 ffmpeg 文件下载到您的计算机并安装它。

  2. 传递 ffmpeg 文件位置的系统路径。 enter image description here

(¥表示\)

我把文件放到C:\\ffmpeg\\ffmpeg\\bin\\ffmpeg.exe

(注意:这是我改文件名后的)

from pydub import AudioSegment
AudioSegment.converter = "C:\\ffmpeg\\ffmpeg\\bin\\ffmpeg.exe"
AudioSegment.ffmpeg = "C:\\ffmpeg\\ffmpeg\\bin\\ffmpeg.exe"
AudioSegment.ffprobe ="C:\\ffmpeg\\ffmpeg\\bin\\ffprobe.exe"

将这些行放在导入语句之后。

最后,重启电脑

这个问题我很苦恼,现在问题解决了。

关于python - Pydub 无法定位 ffprobe,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51219531/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com