我刚刚开始使用Python,我正在使用python来读取mp3文件。我试图使用ffmpeg来读取mp3文件,但是,我一直收到拒绝许可的错误。
感谢您是否可以告诉我如何解决此错误!
谢谢!
$ cd '/Users/jingyi/Downloads/' && '/usr/bin/pythonw' '/Users/jingyi/Downloads/sound detection.py' && echo Exit status: $? && exit 1
Traceback (most recent call last):
File "/Users/jingyi/Downloads/sound detection.py", line 14, in <module>
pipe = sp.Popen(command, stdout = sp.PIPE)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 709, in __init__
errread, errwrite)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1326, in _execute_child
raise child_exception
OSError: [Errno 13] Permission denied
FFMPEG_BIN = '/Users/jingyi/Downloads/ffmpeg'
#INPUT_Sound = '/Users/jingyi/Downloads/Snore.mp3'
import subprocess as sp
command = [ FFMPEG_BIN,
'-i', '/Users/jingyi/Downloads/Snore.mp3',
'-f', 's16le',
'-acodec', 'pcm_s16le',
'-ar', '44100', # ouput will have 44100 Hz
'-ac', '2', # stereo (set to '1' for mono)
'-']
pipe = sp.Popen(command, stdout = sp.PIPE)