NAME
transcribe-audio.pl - Transcribe an audio file
SYNOPSIS
perl transcribe-audio.pl [FILE]
DESCRIPTION
This script transcribes an audio file using the OpenAI API using the `whisper-1` model.
It's more or less equivalent to the following curl command:
curl https://api.openai.com/v1/audio/transcriptions \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "Content-Type: multipart/form-data" \
-F file="@./examples/data/speech.mp3" \
-F model="whisper-1"
In the examples/data directory, you will find a sample audio file called speech.mp3. This is the default file used by the script. The script should run in a second or two and print the following to the console:
The quick brown fox jumped over the lazy dog.
OpenAI cost for this is less than a penny.
Alternatively, you can try this with examples/data/englishminstershereford_1_grierson_64kb.mp3:
perl transcribe-audio.pl examples/data/englishminstershereford_1_grierson_64kb.mp3
The above file is 7.7M, roughly 2,700 w0rds, and transcribes in less than a minute. At this time, the cost to transcribe this text is about 10 cents. You might want to redirect the output to a file for later processing.
perl transcribe-audio.pl examples/data/englishminstershereford_1_grierson_64kb.mp3 > output.txt
SUPPORTED FORMATS
The OpenAI API supports the following audio formats:
flac
m4a
mp3
mp4
mpeg
mpga
oga
ogg
wav
webm