python - Pydub 无法定位 ffprobe

标签 python ffmpeg libav pydub

这是与此类似问题的链接: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 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 文件位置的系统路径。 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/

相关文章:

android - 通过音轨在 Android 中播放音乐

javascript - 谷歌云平台存储 JSON API 上传会破坏音频文件..?!怎么修?

ffmpeg - CMAKE ExternalProject_Add 添加不需要的双引号

python - 将列表的相似元素合并到一个新列表中

Python 线程 - 在 join() 时做一些事情

python - 获取失败的 django-celery 任务的参数

python - 如何用matplotlib制作 'fuller'轴箭头

将 mp4 转换为 mpeg2-ts 会导致音频数据包崩溃

c++ - 在 RTP/RTSP 中检索时间戳

c - libavformat/ffmpeg C 程序 "not suitable input format"