No such file or directory: 'ffprobe': 'ffprobe'

427 Views Asked by At

I'm hoping someone can point me in the right direction. I'm currently trying to build a python GUI that plays clips of sounds from a specified file and allows the user to annotate it. All the research I've done has pointed my to using pydub. I'm using the following snippet:

from pydub import AudioSegment
from pydub.playback import play

song = AudioSegment.from_wav("beepboop.mp3")
play(song)

However, I'm currently getting the following error:

Warning (from warnings module):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pydub/utils.py", line 170
    warn("Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work", RuntimeWarning)
RuntimeWarning: Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work

Warning (from warnings module):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pydub/utils.py", line 198
    warn("Couldn't find ffprobe or avprobe - defaulting to ffprobe, but may not work", RuntimeWarning)
RuntimeWarning: Couldn't find ffprobe or avprobe - defaulting to ffprobe, but may not work
Traceback (most recent call last):
  File "/Users/jack/Desktop/code-repo/convert-csv-to-json/cleaner.py", line 7, in <module>
    song = AudioSegment.from_wav("beepboop.mp3")
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pydub/audio_segment.py", line 808, in from_wav
    return cls.from_file(file, 'wav', parameters=parameters)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pydub/audio_segment.py", line 728, in from_file
    info = mediainfo_json(orig_file, read_ahead_limit=read_ahead_limit)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pydub/utils.py", line 274, in mediainfo_json
    res = Popen(command, stdin=stdin_parameter, stdout=PIPE, stderr=PIPE)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 775, in __init__
    restore_signals, start_new_session)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 1522, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'ffprobe': 'ffprobe'

I've downloaded both ffprobe and ffmpeg from the official website, extracted the files, and installed to usr/local/bin based on input I've read in other StackOverflow comments. When I run:

print(os.environ['PATH'])

I get:

/usr/bin:/bin:/usr/sbin:/sbin

Also, MacOSX won't let me manually drag the executable into /usr/bin or /usr/sbin. Nor will it let me copy it into the directory using:

$ sudo cp ffmpeg /usr/bin

When I use:

pip3 install ffprobe-python

I get:

Requirement already satisfied: ffprobe-python in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (1.0.3)

I'll add that when I try and use the "apt install" method, it barks at me and says my version of MacOSX isn't supported.

0

There are 0 best solutions below