有以下问题的解决方案吗

时间:2020-05-18 11:15:43

标签: python python-3.x ffmpeg avconv pydub

这是代码,我得到以下问题文件名是“ ply_audio.py”

    from pydub import AudioSegment
    ># read/write data
    > data = AudioSegment.from_file(file="one.wav",format="wav")
    >data.export("new_test.wav")
 > python ply_audio.py

C:\Users\raj\AppData\Local\Programs\Python\Python38\lib\site-packages\pydub\utils.py:170: RuntimeWarning: Couldn't
 find ffmpeg or avconv - defaulting to ffmpeg, but may not work

warn("Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work", RuntimeWarning)

C:\Users\raj\AppData\Local\Programs\Python\Python38\lib\site-packages\pydub\utils.py:198: 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 "ply_audio.py", line 4, in <module>
data = AudioSegment.from_file(file="one.wav",format="wav")

File "C:\Users\raj\AppData\Local\Programs\Python\Python38\lib\site-packages\pydub\audio_segment.py", line 685, i
n from_file

info = mediainfo_json(orig_file, read_ahead_limit=read_ahead_limit)

 File "C:\Users\raj\AppData\Local\Programs\Python\Python38\lib\site-packages\pydub\utils.py", line 274, in mediainfo_json res = Popen(command, stdin=stdin_parameter, stdout=PIPE, stderr=PIPE)

File "C:\Users\raj\AppData\Local\Programs\Python\Python38\lib\subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,

File "C:\Users\raj\AppData\Local\Programs\Python\Python38\lib\subprocess.py", line 1307, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,

FileNotFoundError: [WinError 2] The system cannot find the file specified

1 个答案:

答案 0 :(得分:0)

您正在使用的库需要ffmpeg(或avconv)。我建议使用ffmepg(但是如果需要,您应该检查项目的许可限制)。 您可以从official下载它,然后确保下载的ffmpeg应用程序的bin文件夹在您的路径中(例如,请参见https://www.wikihow.com/Install-FFmpeg-on-Windows) 然后,您上面的代码将同时看到ffmpeg和ffprobe二进制文件。