0
votes

I am on mac and am working on a project in which my program shoud convert a .mp3 file into a .wav file and than get text from that file (basic speech recognition). For converting a .mp3 file into a .wav file I am using ffmpeg library. I have installed both ffmpeg and ffprobe libraryies using pip and than using homebrew so I have them installed in a folder.

This is my code:

import speech_recognition
from pydub import AudioSegment
from os import path


#get text from original voice file------------------------------------------------- 

sound = AudioSegment.from_mp3("/path/to/file.mp3")
sound.export("/output/path/file.wav", format="wav")

file_audio = speech_recognition.AudioFile('/output/path/file.wav')

r = speech_recognition.Recognizer()
with file_audio as source:
    audio_text = r.record(source)

word = r.recognize_google(audio_text)

And this is the error i get: FileNotFoundError: [Errno 2] No such file or directory: 'ffprobe'

Full error: Warning (from warnings module): File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/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.9/lib/python3.9/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/marcus/Downloads/pronaunciation_checker/pronaunciation_check.py", line 12, in sound = AudioSegment.from_mp3("/Users/marcus/Desktop/think.mp3") File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pydub/audio_segment.py", line 796, in from_mp3 return cls.from_file(file, 'mp3', parameters=parameters) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/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.9/lib/python3.9/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.9/lib/python3.9/subprocess.py", line 951, in init self._execute_child(args, executable, preexec_fn, close_fds, File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 1821, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'ffprobe'

The full error traceback would be very helpful. Seems like an unproper installation of the libs.Raf
Than how can I install them correctly on macgasper101
You mention you have installed the libs in Python using pip. But did you installed ffmpeg itself in your system? The Python libs only binds to the binaries that must be installed in your system.Raf
I installed ffmpeg and ffprobe again using homebrewgasper101