在Ins之后不存在FFMpegNormalize

2024-05-15 02:50:48 发布

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

我在克隆this repo。我安装了ffmpeg normalize并pip install ffmpeg-normalize返回

Requirement Already Satisfied...

但是我得到一个错误,在执行预处理.py步骤:

enter image description here

违规代码:

def preprocess(audio_filename, output_filename):
    ext_ind = audio_filename.rfind('.wav')
    audio_filename_formatted = audio_filename[:ext_ind] + '-formatted.wav'
    try:
        os.remove(audio_filename_formatted)
    except OSError:
        pass
    try:
        os.remove(output_filename)
    except OSError:
        pass
    error = os.system(
        'ffmpeg -i {} -acodec pcm_s16le -ac 1 -ar 16000 {}'.format(
            audio_filename, audio_filename_formatted))
    if error:
        print error
        raise StandardError('ffmpeg or audio file doesn\'t exist')
    error = os.system(
        'ffmpeg-normalize -f {}'.format(audio_filename_formatted))
    if error:
        raise StandardError('ffmpeg-normalize doesn\'t exist')

    data = wavfile.read(audio_filename_formatted)
    mfcc_inst = MFCC()
    features = mfcc_inst.sig2s2mfc_energy(data[1])

    np.save(output_filename, features)


if __name__ == '__main__':
    if len(sys.argv) < 3:
        sys.exit(
            "Have to pass audio_filename and output_filename as parameters.")
    print sys.argv[1],sys.argv[2]
    preprocess(sys.argv[1], sys.argv[2])

安装后是否需要另一个步骤?在Mac上运行它有问题吗?我完全迷路了。先谢谢你。你知道吗


Tags: outputifossys步骤errorpassfilename

热门问题