# Speech to Text: Audio and Video to TXT or SRT (`loquela/speech-to-text`) Actor

Transcribe audio and video files to plain text or SRT subtitles. Upload a file or give an https link. English plus 24 European languages. Pay per second of audio, charged only after the transcript is saved; failed runs are not charged for audio.

- **URL**: https://apify.com/loquela/speech-to-text.md
- **Developed by:** [Loquela Remote](https://apify.com/loquela) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.05 / 1,000 audio seconds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Speech to Text: audio and video to TXT or SRT

Turn one audio or video file into a transcript: plain text, or SRT subtitles with timings. Upload a file or give an https link, choose the format, and start the run. The transcript lands in the run's dataset, ready to download or pass to the next step of your workflow.

Transcription is done by [Loquela Remote](https://api.getloquela.com), a hosted speech-to-text service.

### What you get

- **Plain text or SRT.** SRT cues carry start and end times, ready for video players and editors.
- **Audio and video files.** WAV, MP3, M4A, AAC, OGG/Opus, WebM, FLAC and AIFF, plus video with sound (MP4, MOV, MKV). Only the sound is used.
- **25 languages.** English by default. Also Bulgarian, Croatian, Czech, Danish, Dutch, Estonian, Finnish, French, German, Greek, Hungarian, Italian, Latvian, Lithuanian, Maltese, Polish, Portuguese, Romanian, Russian, Slovak, Slovenian, Spanish, Swedish and Ukrainian, or automatic detection.
- **Pay per second of audio.** The length is measured from the audio itself, and you are charged only after the transcript is saved.

### How to use it

1. Upload a file in **Audio file**, or paste an https link in **Audio URL**. Use one, not both. The form starts with a short sample file, so clear it before adding a link.
2. Pick **Output format**: plain text or SRT subtitles.
3. Optional: set **Language**, for example `es` for Spanish, or `auto` to detect it. Leave it empty for English.
4. Start the run. The transcript appears in the **Output** tab.

### Input

| Field | What it takes |
| --- | --- |
| Audio file | One uploaded audio or video file. |
| Audio URL | An `https` link to one audio or video file. The link must lead straight to the file: redirects are not followed. The link is stored encrypted, since links can carry access tokens. |
| Output format | `txt` (plain text, the default) or `srt` (subtitles with timings). |
| Language | Optional. A two-letter code (`en`, `es`, `de`, `fr`, ...), a code with a region (`es-MX`), or `auto`. Empty means English. |

### Output

One dataset item per run:

```json
{
  "format": "srt",
  "transcript": "1\n00:00:00,409 --> 00:00:08,490\nThey were voyaging across the deserts of the sky, a host of nomads on the march, voyaging high over Ireland westward bound\n\n",
  "audioSeconds": 9.06,
  "billedSeconds": 10,
  "partial": false,
  "requestId": "req_..."
}
```

| Field | Meaning |
| --- | --- |
| `format` | `txt` or `srt`, as asked. |
| `transcript` | The transcript. |
| `audioSeconds` | The audio's length, measured from the audio. |
| `billedSeconds` | Seconds charged for this run. |
| `partial` | `true` when part of the audio could not be transcribed. A partial transcript is saved but not charged. |
| `requestId` | Identifies the transcription request, if you need to ask about it. |

### Pricing

**$0.00005 per second of audio on paid Apify plans**: $0.003 a minute, $0.18 an hour. On Apify's free plan, $0.0001 per second ($0.006 a minute). Seconds are rounded up to the next whole second, once per run. Apify also adds its standard start charge of $0.00005 per run.

You are not charged for audio when:

- the run fails or is stopped,
- the audio is refused before transcription (too long, too large, not audio, unsupported language),
- the transcript is partial.

A restarted run is never charged twice, and never sends the audio twice once it has a transcript.

### Limits

| | Paid Apify plans | Free Apify plan |
| --- | --- | --- |
| Audio length per run | 60 minutes | 2 minutes |
| File size | 100 MB | 100 MB |

- A file with several audio tracks counts the longest of its first four.
- If your **Maximum cost per run** cannot cover the audio's length, the run stops before transcribing and says how much it covers.
- If the run's timeout is too short for the audio, the run stops before transcribing and says how long to allow.
- Transcription capacity is shared. When it is busy, the run waits and retries a few times, then stops without charging.

### Use it from the API

Start a run and get the transcript in one call:

```sh
curl -X POST "https://api.apify.com/v2/acts/loquela~speech-to-text/run-sync-get-dataset-items" \
  -H "Authorization: Bearer YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"audioUrl": "https://example.com/interview.mp3", "outputFormat": "srt"}'
```

A synchronous call waits up to 5 minutes. For longer files, start the run asynchronously and read the dataset when it finishes.

### Where your data is kept

- **The transcript** is saved in the run's default dataset, in your Apify account.
- **Your input** is kept with the run. The Audio URL field is stored encrypted.
- **An uploaded file** stays in the key-value store Apify put it in.
- **The audio** is sent over HTTPS to Loquela Remote for transcription. See its [privacy policy](https://api.getloquela.com/legal/privacy).
- **The run log** records sizes, durations, the audio link's host name and the request ID. It never records the link's path or query, the transcript, or any key.
- The Actor's own working copy of the audio is deleted when the run ends.

Apify deletes a run's default storages after your plan's retention period. Delete the dataset or the uploaded file yourself to remove them sooner.

### Sample file

The prefilled sample is utterance 1089-134691-0016 from the [LibriSpeech ASR corpus](https://www.openslr.org/12) (test-clean), by Vassil Panayotov and others, used under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/). It was converted to MP3. LibriSpeech is drawn from LibriVox public-domain audiobook recordings.

# Actor input Schema

## `audioFile` (type: `string`):

Upload one audio or video file: WAV, MP3, M4A, AAC, OGG/Opus, WebM, FLAC, AIFF, MP4, MOV or MKV. Up to 60 minutes of audio and 100 MB (2 minutes on a free Apify plan). The form starts with a 9-second sample; replace it, or clear it to use Audio URL.

## `audioUrl` (type: `string`):

Or an https link straight to one audio or video file. Redirects are not followed. Stored encrypted, since links can carry access tokens.

## `outputFormat` (type: `string`):

Plain text, or SRT subtitles with timings.

## `language` (type: `string`):

Optional. Empty means English. auto detects the language. Or a code: bg, cs, da, de, el, en, es, et, fi, fr, hr, hu, it, lt, lv, mt, nl, pl, pt, ro, ru, sk, sl, sv or uk (a region such as es-MX is fine).

## Actor input object example

```json
{
  "audioFile": "https://api.apify.com/v2/key-value-stores/CLYAZMZQ8gvIOTQJ3/records/sample.mp3",
  "outputFormat": "txt"
}
```

# Actor output Schema

## `transcript` (type: `string`):

One dataset item with the transcript (plain text or SRT), the audio's measured length, the seconds billed, whether it is partial, and the request ID.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "audioFile": "https://api.apify.com/v2/key-value-stores/CLYAZMZQ8gvIOTQJ3/records/sample.mp3"
};

// Run the Actor and wait for it to finish
const run = await client.actor("loquela/speech-to-text").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "audioFile": "https://api.apify.com/v2/key-value-stores/CLYAZMZQ8gvIOTQJ3/records/sample.mp3" }

# Run the Actor and wait for it to finish
run = client.actor("loquela/speech-to-text").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "audioFile": "https://api.apify.com/v2/key-value-stores/CLYAZMZQ8gvIOTQJ3/records/sample.mp3"
}' |
apify call loquela/speech-to-text --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,loquela/speech-to-text"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/XlPVmI3gQ0aAIGvjb/builds/TyrxT9DaMQFoNWZ69/openapi.json
