· 4 min read

Transcribe Audio from the Command Line, Offline: Whisper without Python

Turn recordings into text and subtitles-style timestamps from your terminal with OpenAI's Whisper, running locally. One binary, no Python, no pip, no GPU. A whole folder of recordings in a three-line shell loop.

kjarni transcribe -q jfk.wav
 And so my fellow Americans, ask not what your country can do for you, ask what you can do for your country.

That is OpenAI's Whisper model, run on your own machine from a single binary. There is no Python environment, no pip install openai-whisper pulling in PyTorch, and no recording uploaded anywhere.

Install

Linux and macOS:

curl -fsSL https://kjarni.ai/install.sh | sh

Windows, in PowerShell:

irm https://kjarni.ai/install.ps1 | iex

Both put one kjarni binary in ~/.local/bin, in your user profile on Windows, and add that folder to your PATH. On Linux and macOS, open a new terminal so it takes effect. Then fetch a sample, the 11-second public domain Kennedy clip from the whisper.cpp repository:

curl -LO https://github.com/ggml-org/whisper.cpp/raw/master/samples/jfk.wav
kjarni transcribe jfk.wav

The first run downloads whisper-small (920 MB) and caches it. After that it works with no network. -q hides the progress lines, which go to stderr, so the transcript on stdout is clean to redirect or pipe.

Timestamps

kjarni transcribe -q --timestamps --no-stream jfk.wav
[00:00.000 --> 00:11.000] And so my fellow Americans, ask not what your country can do for you, ask what you can do for your country.

On a longer recording each line is one segment of speech, a sentence or two. Here is the start of a 3 minute 19 second public domain address from Wikimedia Commons:

curl -L -o columbia.ogg https://upload.wikimedia.org/wikipedia/commons/1/1f/George_W_Bush_Columbia_FINAL.ogg
ffmpeg -i columbia.ogg -ar 16000 -ac 1 columbia.wav
kjarni transcribe -q --timestamps --no-stream columbia.wav
[00:00.000 --> 00:09.000] My fellow Americans, this day has brought terrible news and great sadness to our country.
[00:09.000 --> 00:18.000] At 9 o'clock this morning, Mission Control in Houston lost contact with our space shuttle Columbia.
[00:18.000 --> 00:24.000] A short time later, debris was seen falling from the skies above Texas.
[00:24.000 --> 00:27.000] The Columbia's lost.
...

That took 27 seconds on an Intel i7-13700, about seven times faster than the recording plays. In Kjarni 0.4.2, --timestamps only takes effect together with --no-stream; without it you get plain text.

WAV in, ffmpeg for everything else

Kjarni 0.4.2 reads WAV, at any sample rate, mono or stereo. MP3, Ogg, FLAC and video files fail with Format 'mp3' requires the 'symphonia' feature. ffmpeg converts anything it can play:

ffmpeg -i meeting.mp3 -ar 16000 -ac 1 meeting.wav
ffmpeg -i talk.mp4 -vn -ar 16000 -ac 1 talk.wav

16 kHz mono is what Whisper uses internally, so converting to it also makes the file smaller.

A folder of recordings

Transcribe every WAV in a folder into a .txt beside it:

for f in recordings/*.wav; do
  kjarni transcribe -q "$f" > "${f%.wav}.txt"
done

Or convert and transcribe in one pass, for a folder of voice memos in M4A:

for f in memos/*.m4a; do
  ffmpeg -loglevel error -y -i "$f" -ar 16000 -ac 1 /tmp/memo.wav
  kjarni transcribe -q /tmp/memo.wav > "${f%.m4a}.txt"
done

Each command loads the model again, about a second for whisper-small. For hundreds of files, that is small next to the transcription itself.

Summarize what was said

kjarni summarize reads stdin, so a transcript pipes straight into it:

kjarni transcribe -q columbia.wav | kjarni summarize -q
 At 9 o'clock this morning, Mission Control in Houston lost contact with our space shuttle Columbia . A short time later, debris was seen falling from the skies above Texas . On board was a crew of seven, Colonel Rick Husband, Lieutenant Colonel Michael Anderson, Commander Laurel Clark, Captain David Brown, Commander William McCool, Dr. Kultna Shavla, and Ilan Ramon .

The summarizer is distilbart-cnn, a news-summary model, and it writes a space before full stops the way its training data did. It picks out sentences more than it rewrites them. For a summary in your own words, ask a local LLM with kjarni chat.

That output also shows Whisper's main weakness: names. Astronaut Kalpana Chawla came out as "Kultna Shavla". Check names and numbers before you rely on a transcript.

Other languages, and translation

Whisper detects the language when you do not pass one, and --language fixes it:

kjarni transcribe -q --language de interview.wav

--translate writes English text from speech in another language, in the same pass:

kjarni transcribe -q --translate interview.wav

Bigger model, better accuracy

kjarni transcribe -q -m whisper-large-v3 columbia.wav

whisper-large-v3 is a 2.9 GB download. On the address above it took 124 seconds instead of 25, and it kept a phrase that whisper-small dropped ("In the words of the prophet Isaiah"). Use it for accented speech, noisy audio and languages other than English.

FAQ

How do I transcribe audio from the Linux command line offline?

Install Kjarni with curl -fsSL https://kjarni.ai/install.sh | sh, then run kjarni transcribe recording.wav. It runs OpenAI's Whisper locally; after the first model download it needs no network.

Does it need Python or a GPU?

No. It is a single native binary and runs on the CPU. --gpu uses a GPU through Vulkan, Metal or DirectX 12 when one is present.

Which audio formats does it read?

WAV. Convert MP3, M4A, Ogg, FLAC and video to WAV with ffmpeg first.

How do I get timestamps?

kjarni transcribe --timestamps --no-stream file.wav prints each segment with its start and end time.

Getting it

Install:  curl -fsSL https://kjarni.ai/install.sh | sh
Releases: https://github.com/olafurjohannsson/kjarni/releases
GitHub:   https://github.com/olafurjohannsson/kjarni

Kjarni runs the same engine on every platform: