TGraphX › Insights › Offline Video Transcription with Whisper and FFmpeg, with Timestamps
← Back to Insights

Offline Video Transcription with Whisper and FFmpeg, with Timestamps

Topic: Vision, multimodal and domain applications

To transcribe an MP4 on your own computer and keep the times, install FFmpeg and the openai-whisper package, call model.transcribe() on the file, and save the segments list from the result, not only the text. The model weights are downloaded once; after that the transcription itself runs on your machine and nothing needs to be uploaded.

AI-Powered Video Analyzer, a tool that analyzes video files on your machine, also transcribes with Whisper, but its report keeps only the text and the detected language, with no times. This tutorial therefore shows both: what the analyzer does (version 1.1.0, checked 27 November 2026) and a separate, direct use of Whisper for timestamps.

What happens to the audio before Whisper sees it

A video file is a container holding separate streams, typically one video stream and one audio stream. Transcription uses only the audio. The path has four steps:

  1. Decode the audio stream from its codec (AAC in a typical MP4) into raw samples.
  2. Downmix and resample to one channel at 16 kHz. openai-whisper does this by calling the ffmpeg program itself.
  3. Convert the samples into a log-Mel spectrogram, a picture of energy by frequency band over time.
  4. Decode text from that spectrogram with a Transformer encoder-decoder.

From a video file to timestamped text

1. Decode and resample2. Log-Mel spectrogram3. Encoder4. Decoder5. Segments
Inputs and outputs of every stage
stageinputoutputwhat happens
1. Decode and resampleaudio stream in an MP416 kHz mono waveformFFmpeg decodes the codec, mixes to one channel and resamples. The video stream is ignored.
2. Log-Mel spectrogramwaveform samples80 bands x 3000 frames per 30 s25 ms windows every 10 ms, Mel filter bank, logarithm and scaling. The large-v3 and turbo models use 128 bands.
3. Encoder80 x 3000 spectrogram1500 positions of 20 msTwo convolutions, the second with stride 2, followed by Transformer blocks.
4. Decoderencoder output and tokens so fartext and timestamp tokensSpecial tokens select the language and the task; timestamps are tokens in steps of 20 ms.
5. Segmentstokens of each windowstart, end, textTimes are shifted by the window position. The window then moves on through the file.

Stage 1 of 5, Decode and resample. Input: audio stream in an MP4. Output: 16 kHz mono waveform.

Step through the stages. Shapes and rates are those of openai-whisper with 80 Mel bands. A schematic of the stages as described by the author; nothing is executed.

Sampling rate and sample count

The number of samples is the sampling rate times the duration: N = f_s * T. A 12 second clip at 16 kHz has 192,000 samples. Whisper works in 30 second windows of 480,000 samples; shorter audio is padded with silence.

python
sr, seconds = 16000, 12
print("samples in the clip:", sr * seconds)
print("samples per 30 s window:", 30 * sr)
print("Mel frames per window:", 30 * sr // 160, "| encoder positions:", 30 * sr // 160 // 2)
print("bytes, 16 kHz mono 16-bit:", sr * seconds * 2)
print("bytes, 44.1 kHz stereo 16-bit:", 44100 * seconds * 2 * 2)
text
samples in the clip: 192000
samples per 30 s window: 480000
Mel frames per window: 3000 | encoder positions: 1500
bytes, 16 kHz mono 16-bit: 384000
bytes, 44.1 kHz stereo 16-bit: 2116800

The last line is the size of the temporary WAV the analyzer writes for such a clip (44.1 kHz, stereo, 16-bit), apart from the header. Whisper resamples it down again.

Short-time Fourier transform and Mel filters

A waveform shows amplitude over time but hides which frequencies are present. The short-time Fourier transform (STFT) cuts the signal into short overlapping windows and takes a Fourier transform of each:

text
X(m, k) = sum over n of  x[n + m*H] * w[n] * exp(-2*pi*i*k*n / N_fft)
S(m, b) = log10( sum over k of  M_b(k) * |X(m, k)|^2 )

Here x is the signal, m the window number, H the step between windows (160 samples), w the window function, N_fft the window length (400 samples), k the frequency bin, and M_b the b-th triangular filter on the Mel scale, which is finely spaced at low frequencies and coarsely spaced at high ones. Whisper then clips the dynamic range and rescales the values.

The following is a simplified version for a made-up signal: a 300 Hz tone for half a second, then a 2000 Hz tone. It uses its own Mel filters, no padding and none of Whisper's scaling.

python
import numpy as np

sr, n_fft, hop, n_mels = 16000, 400, 160, 80      # 25 ms window, 10 ms step
t = np.arange(sr) / sr                            # one second of audio
x = np.where(t < 0.5, np.sin(2 * np.pi * 300 * t), np.sin(2 * np.pi * 2000 * t))

frames = np.stack([x[i:i + n_fft] for i in range(0, len(x) - n_fft + 1, hop)])
power = np.abs(np.fft.rfft(frames * np.hanning(n_fft), axis=1)) ** 2       # STFT power

to_mel = lambda f: 2595 * np.log10(1 + f / 700)
to_hz = lambda m: 700 * (10 ** (m / 2595) - 1)
edges = to_hz(np.linspace(0, to_mel(sr / 2), n_mels + 2))
freqs = np.fft.rfftfreq(n_fft, 1 / sr)
bank = np.stack([np.clip(np.minimum((freqs - lo) / (mid - lo), (hi - freqs) / (hi - mid)), 0, None)
                 for lo, mid, hi in zip(edges[:-2], edges[1:-1], edges[2:])])
logmel = np.log10(np.maximum(power @ bank.T, 1e-10))                       # (time, mel)
print("samples:", len(x), "| STFT power:", power.shape, "| log-Mel:", logmel.shape)
for name, part in (("first half ", logmel[:45]), ("second half", logmel[55:])):
    band = part.mean(axis=0).argmax()
    print(f"{name}: strongest Mel band {band}, centred at {edges[band + 1]:.0f} Hz")
text
samples: 16000 | STFT power: (98, 201) | log-Mel: (98, 80)
first half : strongest Mel band 11, centred at 317 Hz
second half: strongest Mel band 42, centred at 1967 Hz

Each tone peaks in a band centred within about 35 Hz of it. The FFT bins of a 25 ms window are 40 Hz apart and neighbouring filters overlap, so adjacent bands receive energy too.

For real input, use Whisper's own functions: whisper.log_mel_spectrogram(whisper.load_audio("talk.wav")) returns 80 rows by 1200 frames for 12 seconds of audio, which transcribe() pads to a 3000 frame window before the model sees it. The figure shows that array for the spoken test clip used below, averaged down to a coarse grid.

Whisper log-Mel input of the 12 second test clip

A coarse spectrogram of twenty Mel band groups over twelve seconds of synthetic speech. Energy is concentrated in the lower bands and continues through most of the clip, with brief quieter columns, one of them near six and a half seconds.

scaled log-Mel (cells below the threshold are dimmed)

-0.7 (dark)1 (light)

Left to right: time (s) 0 to 11.75. Bottom to top: lowest Mel band in row 0 to 76.

selected cell
lowest Mel band in row 0, time (s) 0
scaled log-Mel there
0
scaled log-Mel: cells counted
960 of 960
scaled log-Mel: lowest Mel band in row (rows) by time (s) (columns)
row00.250.50.7511.251.51.7522.252.52.7533.253.53.7544.254.54.7555.255.55.7566.256.56.7577.257.57.7588.258.58.7599.259.59.751010.2510.510.751111.2511.511.75
76-0.6-0.6-0.6-0.30-0.4-0.4-0.4-0.4-0.5-0.3-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24-0.50.10.40.1-0.5-0.2-0.1-0.2-0.20-0.400.4-0.50.100.10.10.1-0.2-0.4-0.1-0.40-0.30-0.6-0.5-0.40.1-0.2-0.1-0.2-0.1-0.4-0.30.30.1-0.10.40.5-0.30-0.30.1-0.2-0.1-0.4
20-0.40.20.50.2-0.5-0.10.1-0.2-0.20.1-0.500.6-0.40.30.10.20.20.1-0.1-0.4-0.1-0.40.1-0.30.1-0.6-0.5-0.30.2-0.2-0.1-0.10-0.3-0.20.40.1-0.10.50.7-0.30-0.20.3-0.2-0.1-0.3
16-0.40.40.60.3-0.400.20.100.3-0.20.20.5-0.20.40.30.40.40.20.1-0.20.2-0.20.2-0.10.2-0.5-0.3-0.10.3-0.10.100.2-0.1-0.10.60.40.10.60.8-0.10.2-0.10.50.10.2-0.2
12-0.30.60.60.3-0.30.10.30.40.10.300.40.400.50.50.60.60.40.1-0.20.5-0.10.30.10.3-0.500.10.300.20.10.40.1-0.10.70.50.20.60.70.10.30.10.70.30.3-0.2
8-0.20.90.70.5-0.20.20.40.50.30.40.30.50.60.10.60.60.80.70.60.2-0.10.700.30.20.6-0.40.30.10.40.20.30.20.60.300.70.70.40.70.70.20.40.30.80.50.6-0.1
40110.7-0.10.30.50.80.40.60.50.70.80.30.80.710.90.90.500.90.10.50.40.9-0.30.50.30.60.40.70.30.80.50.20.910.70.90.90.40.50.50.90.70.90.2
000.50.70.4-0.10.20.30.60.30.40.40.50.50.30.60.50.70.70.70.400.70.10.40.30.6-0.30.30.20.40.30.50.20.50.40.20.70.70.50.60.60.30.30.30.60.50.70.1

Cell lowest Mel band in row 0, time (s) 0: scaled log-Mel 0 (at or above the threshold). Cells at or above -0.7: scaled log-Mel 960 of 960.

Raise the threshold to dim quiet cells. Time runs left to right, low Mel bands are at the bottom. Measured grid values, as recorded by the author: openai-whisper 20250625 log_mel_spectrogram of the 12 s synthetic-speech WAV the analyzer extracted; each cell is the mean of 4 Mel bands x 25 frames, rounded to 0.1. The figure only displays and compares them. A cell counts when its value is at or above the threshold.

Most of the energy sits in the lower bands and runs through the clip. A quieter column near 6.5 seconds coincides with a segment boundary reported later, but similar dips occur inside sentences too: you cannot read the segmentation off silences alone.

The model

Whisper is an encoder-decoder Transformer. The paper's models were trained on 680,000 hours of audio paired with transcripts collected at scale (weak supervision). The decoder's token sequence begins with a language token and a task token (transcribe or translate), followed by the text. For timestamps it predicts additional tokens that give times within the current window in steps of 20 ms, before and after each stretch of text. A segment's start and end are therefore model predictions, not measurements of the signal.

The sizes below are the figures in OpenAI's README as read on 27 November 2026. Relative speed was measured by OpenAI for English speech on their GPU, not here.

Size Parameters Approximate VRAM Relative speed (large = 1)
tiny 39M about 1 GB about 10x
base 74M about 1 GB about 7x
small 244M about 2 GB about 4x
medium 769M about 5 GB about 2x
large 1550M about 10 GB 1x
turbo 809M about 6 GB about 8x

Extract the audio with FFmpeg

Look at the streams first:

bash
ffprobe -v error -show_entries stream=codec_type,codec_name,sample_rate,channels,start_time,duration -of compact talk.mp4

Then write a WAV file in the format Whisper uses internally:

bash
ffmpeg -i talk.mp4 -vn -ac 1 -ar 16000 -c:a pcm_s16le talk.wav
Option Effect When you need it
-vn Do not write a video stream Always, for audio extraction
-ac 1 One channel Whisper is mono
-ar 16000 16 kHz sampling rate Whisper's input rate
-c:a pcm_s16le Uncompressed 16-bit WAV Easy to inspect and reuse
-map 0:a:1 Take the second audio stream Files with several languages or tracks
-ss 60 -t 30 Start at 60 s, keep 30 s Testing on a short piece
-af aresample=async=1:first_pts=0 Fill a late audio start with silence Keeping times on the video's timeline

You do not strictly need this step: Whisper accepts the MP4 and runs FFmpeg itself. Extracting first lets you listen to exactly what the model receives, cut it, and check its length.

The last row of the table matters for alignment. In a test file whose audio stream started 1.98 s after the video, plain extraction produced a WAV that began directly with the sound, so every timestamp would have been about two seconds early relative to the picture. With the aresample filter shown, FFmpeg 8.0.1 wrote about two seconds of silence first. Passing the MP4 straight to Whisper behaves like the plain extraction, so check start_time in the ffprobe output either way.

Transcribe and keep the timestamps

Install Whisper with the command its README gives, and FFmpeg from your system's package manager:

bash
pip install -U openai-whisper
sudo apt install ffmpeg      # macOS: brew install ffmpeg

This is a direct use of openai-whisper. It is not something the analyzer exports.

python
import json
import whisper

model = whisper.load_model("base")                    # downloads the weights on first use
result = model.transcribe("talk.wav", task="transcribe")   # language=None: auto-detect

segments = [{"start": round(s["start"], 2), "end": round(s["end"], 2), "text": s["text"].strip()}
            for s in result["segments"]]
with open("talk_segments.json", "w", encoding="utf-8") as f:
    json.dump({"language": result["language"], "segments": segments}, f,
              ensure_ascii=False, indent=2)
print(result["language"], len(segments))
for s in segments:
    print(f"{s['start']:6.2f} {s['end']:6.2f}  {s['text']}")

The test material is a 12 second clip with a synthetic voice (FFmpeg's flite) reading three sentences, so the correct text is known. A recorded run of base with library defaults (openai-whisper 20250625, CUDA GPU, Linux), on the 44.1 kHz stereo WAV that the analyzer extracted from that clip, gave these segments:

text
  0.00-  3.20  ' Video analysis starts by choosing which frames to look at.'
  3.20-  6.48  ' The detector then labels objects in each selected frame.'
  6.48- 11.76  ' Speech is transcribed separately, and the language model writes a short summary at the end.'

One word differs from the script: "the language model" where the script says "a language model". Synthetic speech without noise is an easy case, so this says nothing about accuracy on real recordings.

Write SRT subtitles

SRT is a numbered list of time ranges and text. This block formats the recorded segments above; in your own script, pass the segments list from transcribe().

python
def srt_time(seconds):
    ms = round(seconds * 1000)
    h, ms = divmod(ms, 3_600_000)
    m, ms = divmod(ms, 60_000)
    s, ms = divmod(ms, 1000)
    return f"{h:02}:{m:02}:{s:02},{ms:03}"

def to_srt(segments):
    return "\n".join(f"{i}\n{srt_time(s['start'])} --> {srt_time(s['end'])}\n{s['text']}\n"
                     for i, s in enumerate(segments, 1))

# recorded segments: Whisper base on the audio extracted from the 12 s test clip
segments = [
    {"start": 0.00, "end": 3.20, "text": "Video analysis starts by choosing which frames to look at."},
    {"start": 3.20, "end": 6.48, "text": "The detector then labels objects in each selected frame."},
    {"start": 6.48, "end": 11.76, "text": "Speech is transcribed separately, and the language model "
                                          "writes a short summary at the end."},
]
print(to_srt(segments), end="")
text
1
00:00:00,000 --> 00:00:03,200
Video analysis starts by choosing which frames to look at.

2
00:00:03,200 --> 00:00:06,480
The detector then labels objects in each selected frame.

3
00:00:06,480 --> 00:00:11,760
Speech is transcribed separately, and the language model writes a short summary at the end.

Keep the JSON as your source record and generate SRT from it. The package also installs a command that writes subtitle files directly:

bash
whisper talk.mp4 --model base --output_format srt

Its defaults differ from the Python call: the command uses the turbo model unless you pass --model, and decodes with a beam of 5, while transcribe() decodes greedily unless told otherwise.

Segment boundaries are not stable

The same sentences can be cut differently when the model, the input file or the decoder settings change. On the clip above, two model sizes disagreed on both the wording and the number of segments:

Segments from tiny and base on the same 12 second clip

tinybasebase 1base 2base 3024681012seconds
What each lane holds at the selected time
laneholds
tinytiny 1: sentences one and two
basebase 1
All events
eventlanetime
tiny 1: sentences one and twotiny0 to 6.54 s
tiny 2: sentence threetiny6.54 to 11.88 s
base 1base0 to 3.2 s
base 2base3.2 to 6.48 s
base 3base6.48 to 11.76 s

At 0 s. tiny: tiny 1: sentences one and two. base: base 1.

Select a time to read both rows. Same audio file, library defaults, one recorded run each. Measured times and events, as recorded by the author: openai-whisper 20250625, CUDA, synthetic flite speech, 44.1 kHz WAV extracted by analyzer 1.1.0, one run per model. The figure only displays and compares them.

tiny also rendered "Video analysis" as "The Dionylysis" and "model" as "noddle". And base itself returned two segments, not three, when given the original 16 kHz mono recording in place of the extracted WAV. Treat segment times as good for finding a passage, and verify against the audio where an exact cut matters.

Word-level times are available through word_timestamps=True, which the command-line help labels experimental; it was not tested here. Whisper does not label speakers.

Why the analyzer's report has no times

The analyzer extracts the soundtrack with moviepy to a temporary WAV, runs transcribe() with task="transcribe" and the model chosen by --whisper-model (default base), and keeps result["text"] and result["language"]. The segment list is discarded. The JSON report holds one transcript string and transcript_language.

To get the transcript this way, install the full requirements and the package itself, then switch the other stages off:

bash
git clone https://github.com/arashsajjadi/ai-powered-video-analyzer.git
cd ai-powered-video-analyzer
python -m pip install -r pip_requirements.txt
python -m pip install -e .      # the requirements file does not install the analyzer
ai-video-analyzer analyze talk.mp4 --backend none --no-captioning \
  --no-audio-events --no-summarization --whisper-model base -o results

Things to know about this stage in version 1.1.0:

  • There is no switch that turns transcription off; it runs whenever audio extraction succeeds.
  • If Whisper is missing or transcription fails, the transcript is empty, the language is unknown, and the report's limitations list says nothing about it.
  • Whisper uses a CUDA GPU if it finds one; --device does not control it.
  • --language passes a language to Whisper; without it the language is detected.

Line up speech with sampled frames

The analyzer samples video frames and records each one's timestamp_sec. With your own segments you can attach the spoken sentence to each frame. For the test clip, the sampled times were 0, 1, 2 and so on up to 11 seconds.

python
def segment_at(t, segments, offset=0.0):
    """1-based number of the segment spoken at video time t, or None."""
    return next((i for i, s in enumerate(segments, 1)
                 if s["start"] + offset <= t < s["end"] + offset), None)

# the analyzer sampled this clip once per second: frame_observations[].timestamp_sec
frame_times = [float(t) for t in range(12)]
for number in (1, 2, 3, None):
    hits = [t for t in frame_times if segment_at(t, segments) == number]
    print(f"segment {number}: frames at {hits}")
text
segment 1: frames at [0.0, 1.0, 2.0, 3.0]
segment 2: frames at [4.0, 5.0, 6.0]
segment 3: frames at [7.0, 8.0, 9.0, 10.0, 11.0]
segment None: frames at []

Spoken segments and sampled frames on one time axis

Speech (Whisper base)Sampled frames024681012seconds
What each lane holds at the selected time
laneholds
Speech (Whisper base)choosing frames
Sampled framesa sampled frame
Events, with the sampled frames inside each visual event
eventlanetimeSampled frames
choosing framesSpeech (Whisper base)0 to 3.2 s—
detector labelsSpeech (Whisper base)3.2 to 6.48 s—
transcript and summarySpeech (Whisper base)6.48 to 11.76 s—

Sampled frames: 12 frames in 12 s (1 per second).

At 0 s. Speech (Whisper base): choosing frames. Sampled frames: a sampled frame.

Select a time to see which sentence was being spoken when a frame was sampled. Measured times and events, as recorded by the author: Whisper base segments and analyzer 1.1.0 frame times for the same synthetic 12 s clip, one recorded run. The figure only displays and compares them.

The offset argument is the audio stream's late start discussed above; leave it at zero if you extracted with silence padding or both streams start at zero. The alignment is only as good as both clocks: the analyzer computes frame times as frame index divided by the nominal frame rate, which is wrong for variable-frame-rate recordings. Sharing a time axis also does not show that a sentence is about what the frame displays.

Failure modes and mitigations

Symptom Likely cause What to try
Wrong words, especially names and terms Model limits, unusual voice or audio A larger model; check against the audio
A word or phrase repeated many times Repetition loop, sometimes triggered by odd audio Check the extracted audio; condition_on_previous_text=False
Text where nobody speaks Hallucination on silence, music or noise Listen to those stretches; cut them out before transcribing
Wrong language Detection uses the first 30 seconds Pass language="en" (or the right code)
Missing first or last words Known long-form failure Compare the ends with the audio
Timestamps shifted against the picture Audio stream starts later than the video Pad on extraction or add the offset

No noisy recordings were tested for this article. Background noise, overlapping speakers, music, distant microphones and unfamiliar accents are the conditions to try on your own material before trusting a transcript. OpenAI's README also states that performance varies widely between languages.

The Whisper authors list repeat loops, skipped words at the edges of a segment and complete hallucination as failure modes of long-form transcription. By default transcribe() retries a window at a higher temperature when its output looks too repetitive or has a low average log-probability, which reduces but does not remove these problems.

One case seen in testing is worth a specific warning. The analyzer extracts audio with moviepy (version 1.0.3 in this test). When a test file's audio stream was shorter than its video stream (11.98 s against 17.9 s), the extracted WAV ran to the video's length, filled with an exactly repeating loop about half a second long. Whisper base transcribed that tail as "End. End. End." and so on. The same file extracted with the ffmpeg command above produced a WAV of about 12 s. This was observed on synthetic files; it does not show that every such video loops. Compare stream durations with ffprobe when a transcript ends strangely.

Privacy

Whisper runs locally, and the analyzer has no upload code. Network access is still needed to install packages and to download model weights the first time; Whisper keeps them in a per-user cache folder. A transcript is a readable copy of what was said, so protect the JSON, SRT and report files as you protect the recording.

Speech is only part of a soundtrack. For non-speech sounds, see audio event detection with PANNs.

To turn a transcript and frame evidence into a checked summary, see local video summarization with Ollama.

For the complete first run of the pipeline, start with how to analyze videos locally.

References

  1. A. Radford, J. W. Kim, T. Xu, G. Brockman, C. McLeavey, I. Sutskever. Robust Speech Recognition via Large-Scale Weak Supervision. arXiv:2212.04356
  2. OpenAI. Whisper repository and README. github.com/openai/whisper
  3. FFmpeg documentation. ffmpeg.org/ffmpeg.html
  4. A. Sajjadi. AI-Powered Video Analyzer, source repository, version 1.1.0. GitHub