I am using MacOS (Apple Silicon) and I am trying to use the whisper module from OpenAI in Python. My code is this:
import whisper
file_path = "4547.mp3"
model = whisper.load_model("base")
result = model.transcribe(file_path)
print(result["text"])
When running that code I get the error:
FileNotFoundError: [Errno 2] No such file or directory: 'ffmpeg': 'ffmpeg'
I think it is because Python is looking in the wrong folder for ffmpeg and therefore can't find it, but I don't know how to fix that if that is the issue.
I have installed homebrew and used the command 'brew install ffmpeg' and it has successfully installed with no errors. I have tried uninstalling ffmpeg and reinstalling it. I have tried uninstalling open_whisper but to no avail.
In Mac OS Sonoma 14.1.1 with Apple Silicon M1, I installed ffmpeg in the terminal with brew install ffmpeg and the following script:
import whisper
import ssl
# use the line from below to avoid verification of certificate
ssl._create_default_https_context = ssl._create_unverified_context
model = whisper.load_model("base")
result = model.transcribe("./sample.mp3")
with open("sample.txt", "w") as f:
f.write(result["text"])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With