1

这是一个潜在的“陷阱”,我将在此处记录以防其他人绊倒它。我正在对可能是 .wav 或 .mov 格式的文件进行转换。测试看起来像这样:

            if pic[0].audiodesc.path.lower().endswith('.wav'):
                sound = AudioSegment.from_file(pic[0].audiodesc.path)
                sound.export(mp3_filepath, format = 'mp3', bitrate = '64k')
            elif pic[0].audiodesc.path.lower().endswith('.mov'):
                sound = AudioSegment.from_file(pic[0].audiodesc.path, 'mov')
                sound.export(mp3_filepath, format = 'mp3', bitrate = '64k')

AudioSegment.from_file(pic[0].audiodesc.path),如果我指定 .., 'wav') 则编码失败:

avconv version 9.20-6:9.20-0ubuntu0.14.04.1, Copyright (c) 2000-2014 the Libav developers built on Dec  7 2016 21:22:31 with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.3) 
/tmp/tmpGhtAOn: Operation not permitted
4

1 回答 1

0

删除“wav”可以解决问题。

于 2017-09-04T10:25:15.183 回答