不管我尝试了什么解决方案,pydub都找不到ffprobe

2024-05-16 00:22:51 发布

您现在位置:Python中文网/ 问答频道 /正文

这是一个非常类似于这个Pydub unable to locte ffprobe的问题,但是在遵循解决方案之后,它仍然不起作用:|

对于环境变量,我在路径中也有FFmpeg

我目前的代码只是一个简单的代码,让我熟悉pydub

from pydub import AudioSegment
import os

directory = r"C:\Users\Wei's PC\Music\Files\Relaxing"

AudioSegment.converter = 'C:\\FFmpeg\\bin\\ffmpeg.exe'
AudioSegment.ffmpeg = "C:\\FFmpeg\\bin\\ffmpeg.exe"
AudioSegment.ffprobe = "C:\\FFmpeg\\bin\\ffprobe.exe"

os.chdir(directory)
file = AudioSegment.from_file(rf'{directory}\test.flac', 'flac')
file.export(f'River Flows in You.mp3', format = 'mp3')

但我总是犯这个错误

Warning (from warnings module):
  File "C:\Users\Wei's PC\AppData\Local\Programs\Python\Python37\lib\site-packages\pydub\utils.py", line 193
    warn("Couldn't find ffprobe or avprobe - defaulting to ffprobe, but may not work", RuntimeWarning)
RuntimeWarning: Couldn't find ffprobe or avprobe - defaulting to ffprobe, but may not work
Traceback (most recent call last):
  File "C:\Users\Wei's PC\Documents\Python\testing pydub.py", line 11, in <module>
    file = AudioSegment.from_file(rf'{directory}\test.flac', 'flac')
  File "C:\Users\Wei's PC\AppData\Local\Programs\Python\Python37\lib\site-packages\pydub\audio_segment.py", line 665, in from_file
    info = mediainfo_json(orig_file)
  File "C:\Users\Wei's PC\AppData\Local\Programs\Python\Python37\lib\site-packages\pydub\utils.py", line 263, in mediainfo_json
    res = Popen(command, stdin=stdin_parameter, stdout=PIPE, stderr=PIPE)
  File "C:\Users\Wei's PC\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 800, in __init__
    restore_signals, start_new_session)
  File "C:\Users\Wei's PC\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 1207, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified

Tags: infrompylocallineusersappdatafile