Pydub 无法定位 ffprobe

Pydub unable to locate ffprobe

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

为转换器 and/or 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 work warn("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_file info = mediainfo_json(orig_file) File "C:\Program Files\Python36\lib\site-packages\pydub\utils.py", line 263, in mediainfo_json res = Popen(command, stdin=stdin_parameter, stdout=PIPE, stderr=PIPE) File "C:\Program Files\Python36\lib\subprocess.py", line 707, in init restore_signals, start_new_session) File "C:\Program Files\Python36\lib\subprocess.py", line 990, in _execute_child startupinfo) 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文件位置的系统路径。

(¥表示\)

我把文件放到了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"

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

最后,重启电脑

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

我按照@user9402680 提到的步骤进行操作,但仍然出现问题。然后我将 ffmpeg bin 文件路径位置添加到 PATH 环境变量。现在工作正常

LINUX/ubuntu/deb 用户:

sudo apt install ffmpeg

添加到@Gopesh Kwandelwal 的回答中

sudo apt install ffmpeg

另一种方法是安装 Anaconda 或 Miniconda,然后使用:
conda install ffmpeg

这在自定义环境中对我有用,甚至不需要重新启动内核,更不用说重新启动计算机了。 (我无法对该主题发表评论 b/c 我没有足够的声誉)。