librosa audioread.NoBackendError

最近在做语音合成

librosa合成出来的音频,读取时候报错

audioread.NoBackendError

代码debug进去发现

with audioread.audio_open(os.path.realpath(path)) as input_file:

这里行报错,再向下追溯

# FFmpeg.
from . import ffdec
try:
    return ffdec.FFmpegAudioFile(path)
except DecodeError:
    pass

最后发现在ffdec.py第89行

for i, command in enumerate(commands):
    cmd = [command] + command_args
    try:
        return subprocess.Popen(cmd, *args, **kwargs)
    except OSError:
        if i == len(commands) - 1:
            # No more commands to try.
            raise

调用系统命令报错

33行

COMMANDS = ('ffmpeg', 'avconv')

 

打开shell进去ffmpeg发现not found

$ whereis ffmpeg
ffmpeg: /home/wangrui/anaconda3/bin/ffmpeg
 

33行改成

COMMANDS = ('/home/wangrui/anaconda3/bin/ffmpeg', 'avconv')

运行成功,bug修复结束

 

 

你可能感兴趣的:(语音)