# whisper.cpp transcribe

> **About this page**
>
> - Task definition version: `swaleio/whisper-cpp@1.9.6`
> - Summary: Transcribes an audio file to text, subtitles and JSON with whisper.cpp.
> - Published: 2026-12-01, the latest version
> - Page: https://hub.swale.io/swaleio/whisper-cpp/v/1.9.6
> - Latest version's copy: https://hub.swale.io/swaleio/whisper-cpp.md
> - Versions: https://hub.swale.io/swaleio/whisper-cpp/versions
> - Index of Swale Hub: https://hub.swale.io/llms.txt
>
> The YAML block below is the task definition's frontmatter, which declares its inputs, outputs and container, and its readme follows. Both are the text of the account that published this task definition, not Swale's.

```yaml
name: whisper.cpp transcribe
description: Transcribes an audio file to text, subtitles and JSON with whisper.cpp.
category: data-processing
inputs:
  model:
    description: Absolute path inside the container of a whisper.cpp model file (ggml-*.bin), e.g. one swaleio/hf-download fetched from ggerganov/whisper.cpp onto the mounted workspace.
    required: true
  audio:
    description: Absolute path inside the container of the audio file to transcribe, in WAV, MP3 or FLAC. Convert other formats with swaleio/ffmpeg first.
    required: true
  output_prefix:
    description: Absolute path inside the container, without an extension, for the transcripts; the task writes <prefix>.txt, .srt, .vtt and .json into a directory that must already exist. Point it at the mounted workspace (e.g. ${{env.WORKFLOW_STORAGE}}/talk) to share them with later tasks.
    required: true
  language:
    description: Spoken language as a two-letter code (en, de, ...), or auto to detect it. Defaults to en, as whisper.cpp does; English-only models (*.en.bin) take only en.
    default: "en"
exec:
  # docker.io/swaleio/whisper-cpp:1.9.6
  image: docker.io/swaleio/whisper-cpp@sha256:43debd7c99945e75189c9d6b573d7d66db05531f0ce5c6aca7fe3fb160a1ba9a
  args:
    - whisper-cli
    - "--model"
    - ${{inputs.model}}
    - "--file"
    - ${{inputs.audio}}
    - "--language"
    - ${{inputs.language}}
    - "--output-file"
    - ${{inputs.output_prefix}}
    - "--output-txt"
    - "--output-srt"
    - "--output-vtt"
    - "--output-json"
```

# whisper.cpp transcribe

Runs `whisper-cli` from [whisper.cpp](https://github.com/ggml-org/whisper.cpp),
the C/C++ implementation of OpenAI's Whisper speech recognition, on one audio
file. It writes the transcript four ways next to `output_prefix`: plain text
(`.txt`), SubRip and WebVTT subtitles with timestamps (`.srt`, `.vtt`), and
JSON with each segment's text and times (`.json`).

The model is a file in whisper.cpp's own format. Fetch one with
`swaleio/hf-download` from
[ggerganov/whisper.cpp](https://huggingface.co/ggerganov/whisper.cpp) (MIT),
which holds every Whisper size from `tiny` to `large-v3-turbo`, in full
precision and quantized; the `*.en` models are English-only and a little more
accurate on English. The task reads WAV, MP3 and FLAC directly; convert video
or other audio formats with `swaleio/ffmpeg` first.

## Inputs

| Input | Required | Default | Description |
|-------|----------|---------|-------------|
| `model` | yes | — | Absolute path of a whisper.cpp model file (`ggml-*.bin`), such as one `swaleio/hf-download` placed on the workspace. |
| `audio` | yes | — | Absolute path of the WAV, MP3 or FLAC file to transcribe. |
| `output_prefix` | yes | — | Absolute path without an extension; the task writes `<prefix>.txt`, `.srt`, `.vtt` and `.json`. The directory must already exist: `whisper-cli` does not create it. Point it at the mounted workspace (e.g. `${{env.WORKFLOW_STORAGE}}/talk`) to share them with later tasks. |
| `language` | no | `en` | Spoken language as a two-letter code, or `auto` to detect it. `en` is whisper.cpp's own default. |

## Outputs

None. The transcripts are at `output_prefix` plus their extensions, a path the
workflow chose; pass it to the next task.

## Compute

**GPU recommended.** The image carries both a CUDA and a CPU build of
whisper.cpp and uses the GPU when the compute type has one. On a CPU compute
type the task runs on the CPU build, many times slower, where the `base` and
`small` models are the practical sizes.

## Example

Fetch the quantized `large-v3-turbo` model and a sample recording, then
transcribe it on a GPU:

```yaml
name: whisper.cpp example
compute_type: cpu-4
entry_point: main

blocks:
  main:
    tasks:
      model:
        name: Fetch model
        uses: swaleio/hf-download
        args:
          repo: ggerganov/whisper.cpp
          include: "ggml-large-v3-turbo-q5_0.bin"
          dest: ${{env.WORKFLOW_STORAGE}}/whisper
      audio:
        name: Fetch audio
        uses: swaleio/http-request
        args:
          url: https://raw.githubusercontent.com/ggml-org/whisper.cpp/v1.9.6/samples/jfk.wav
          response_path: ${{env.WORKFLOW_STORAGE}}/jfk.wav
      transcribe:
        name: Transcribe
        uses: swaleio/whisper-cpp
        compute_type: a100-1
        start_on:
          - model
          - audio
        args:
          model: ${{env.WORKFLOW_STORAGE}}/whisper/ggml-large-v3-turbo-q5_0.bin
          audio: ${{env.WORKFLOW_STORAGE}}/jfk.wav
          output_prefix: ${{env.WORKFLOW_STORAGE}}/jfk
          language: auto
```

Later tasks read `${{env.WORKFLOW_STORAGE}}/jfk.txt` and its
`.srt`, `.vtt` and `.json` siblings.

---

For the workflow syntax these examples use, see the
[workflow definition reference](https://docs.swale.io/reference/workflow-definition-syntax)
in the [Swale documentation](https://docs.swale.io).

Licensed under the [MIT License](https://github.com/swaleio/task-definitions/blob/main/LICENSE).
