I am trying to get AudioSegment
working on my local computer. After resolving some issues, I am stuck on a permission error that I cannot seem to resolve. Let me detail what I have done so far (so that the error is easy to detect):
I pip
installed both ffprobe
and ffmpeg
. But when I import ffprobe
, it raised ImportError: cannot import name 'FFProbe'
. Thankfully, was able to fix it following a brilliant post here. But now when I run audio = AudioSegment.from_file(audioname)
, it raises the following error: PermissionError: [Errno 13] Permission denied: 'ffprobe'
. Based on one of the comments here, I manually adjusted the permissions using (which I think is the maximum permission granted to a folder?):
import os
import stat
os.chmod('/path/to/ffmpeg', stat.S_IRWXU)
os.chmod('/path/to/ffprobe', stat.S_IRWXU)
Just to be 100% sure, I then manually adjusted the permissions for all the files in ffmpeg
and ffprobe
folders using stat.S_IRWXU
, but to no avail (also tried chmod 755). I also confirmed if execution permission was actually granted (using os.access(my_file, os.X_OK)
) but still get the same error. (Also changed the permission for the .mp3
file, no luck)
Additional details:
- Based on a suggestion somewhere, I also added the following options right after importing
AudioSegment
:
AudioSegment.converter = "/path/to/ffmpeg"
AudioSegment.ffmpeg = "/path/to/ffmpeg"
AudioSegment.ffprobe = "/path/to/ffprobe"
- There is also a runtime warning (that I don't think has anything to do with the error I get) but mentioning it here for completion:
/opt/anaconda3/lib/python3.8/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)
Thanks!