# Transcribe | Transcribe any video or audio (`rexreus/transcribe`) Actor

Transcribe any video or audio from YouTube, TikTok, Instagram, Twitter, and 1000+ sites

- **URL**: https://apify.com/rexreus/transcribe.md
- **Developed by:** [REXREUS D.O](https://apify.com/rexreus) (community)
- **Categories:** Videos, Social media, AI
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js/docs.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python/docs.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

<p align="center">
  <h1 align="center">🎙️ Universal Video/Audio Transcriber</h1>
  <img src="https://i.imgur.com/YKJGrzf.png" align="center">
  <p align="center">
    <strong>Transcribe any video or audio from YouTube, TikTok, Instagram, Twitter, and 1000+ sites</strong>
  </p>
  <p align="center">
    <em>Powered by OpenAI · Groq · AssemblyAI · Deepgram — your choice of AI engine</em>
  </p>
  <p align="center">
    <a href="#-quick-start"><img src="https://img.shields.io/badge/Quick_Start-3_steps-green?style=flat-square" alt="Quick Start"></a>
    <a href="https://apify.com"><img src="https://img.shields.io/badge/Runs_on-Apify-ff443e?style=flat-square" alt="Apify"></a>
    <a href="https://nodejs.org"><img src="https://img.shields.io/badge/Node.js-≥20-339933?style=flat-square&logo=node.js&logoColor=white" alt="Node.js"></a>
    <a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue?style=flat-square" alt="License"></a>
  </p>
</p>

---

### ✨ Why This Actor?

| Feature | What You Get |
|---------|-------------|
| 🌐 **1000+ platforms** | YouTube, TikTok, Instagram, Twitter, Vimeo, SoundCloud, and virtually any site with video/audio |
| 🤖 **4 AI providers** | OpenAI Whisper, Groq (free tier!), AssemblyAI, Deepgram — pick the best fit |
| 💰 **Free tier option** | Groq offers generous free API credits — start transcribing for $0 |
| 📝 **Multiple formats** | JSON (full metadata), SRT (subtitles), VTT (web captions), TXT (plain text) |
| 🌍 **99+ languages** | Auto-detect or specify language — from English to Japanese to Arabic |
| 🔊 **Speaker diarization** | Identify *who said what* with AssemblyAI or Deepgram |
| 🔄 **Batch processing** | Paste 1 URL or 100 — the actor handles them all with per-URL error isolation |
| 📏 **No length limits** | Automatic compression + smart chunking handles hours of audio |
| 🔗 **Direct media URLs** | Bypass extraction entirely for direct MP3/MP4/WAV links |
| 🛡️ **Resilient by design** | Automatic retries, graceful error handling, state persistence across migrations |

---

### 🚀 Quick Start

#### Option 1: On Apify (Recommended)

1. **Open the Actor** on [Apify Console](https://console.apify.com)
2. **Paste your URLs** — YouTube, TikTok, Instagram, etc.
3. **Choose a provider** — OpenAI, Groq, AssemblyAI, or Deepgram
4. **Enter your API key** — Get one from your chosen provider
5. **Click Start** — Results appear in the Dataset within minutes

#### Option 2: Local Development

```bash
## Clone the repository
git clone https://github.com/your-username/universal-transcriber.git
cd universal-transcriber

## Install dependencies
npm install

## Set up your API key
cp .env.example .env
## Edit .env and add your API key

## Run
npm start
````

***

### 📊 Provider Comparison

Choose the provider that fits your needs:

| Provider | Price/min | Best For | File Limit | Timestamps | Translation | Diarization |
|----------|-----------|----------|------------|------------|-------------|-------------|
| **OpenAI** | $0.006 | All-around accuracy | 25 MB\* | ✅ | ✅ | ❌ |
| **Groq** | FREE tier | Speed + budget | 25 MB\* | ✅ | ✅ | ❌ |
| **AssemblyAI** | $0.0035 | Long videos + accuracy | ∞ | ✅ | ❌ | ✅ |
| **Deepgram** | $0.0043 | Low latency | ∞ | ✅ | ❌ | ✅ |

*\*Files over 25 MB are automatically compressed and chunked — no manual work needed.*

#### Available Models

| Model | Provider | Highlights |
|-------|----------|------------|
| `whisper-1` | OpenAI | Classic, reliable, all output formats |
| `gpt-4o-transcribe` | OpenAI | Newer architecture, better at context |
| `gpt-4o-mini-transcribe` | OpenAI | Cheapest OpenAI option |
| `whisper-large-v3` | Groq | High accuracy, free tier available |
| `whisper-large-v3-turbo` | Groq | Fastest option, free tier |
| `universal-3-pro` | AssemblyAI | Best overall accuracy, no file limit |
| `universal-2` | AssemblyAI | 99 languages, no file limit |
| `nova-3` | Deepgram | Latest Deepgram, best accuracy |
| `nova-2` | Deepgram | Proven and stable |

***

### 🔧 How It Works

```
┌─────────────────────────────────────────────────────────────────┐
│                        Input: URLs + Provider                    │
└──────────────────────────────┬──────────────────────────────────┘
                               │
                               ▼
┌──────────────────────────────────────────────────────────────────┐
│  1. EXTRACTION (yt-dlp)                                         │
│     • Downloads audio from 1000+ platforms                      │
│     • Extracts metadata (title, duration, platform)             │
│     • Retries with exponential backoff on failure               │
└──────────────────────────────┬──────────────────────────────────┘
                               │
                               ▼
┌──────────────────────────────────────────────────────────────────┐
│  2. COMPRESSION (ffmpeg)                                         │
│     • Converts to 16kHz mono 64kbps MP3                         │
│     • ~50 minutes of audio fits in 25 MB                        │
│     • Reduces API costs by minimizing file size                 │
└──────────────────────────────┬──────────────────────────────────┘
                               │
                               ▼
┌──────────────────────────────────────────────────────────────────┐
│  3. CHUNKING (if needed)                                        │
│     • Silence-aware splitting at 25 MB boundaries               │
│     • Preserves word boundaries (no mid-word cuts)              │
│     • Tracks time offsets for seamless merging                  │
└──────────────────────────────┬──────────────────────────────────┘
                               │
                               ▼
┌──────────────────────────────────────────────────────────────────┐
│  4. TRANSCRIPTION (AI Provider)                                  │
│     • Sends to OpenAI / Groq / AssemblyAI / Deepgram            │
│     • Handles provider-specific API formats                     │
│     • Merges chunks with correct time offsets                   │
└──────────────────────────────┬──────────────────────────────────┘
                               │
                               ▼
┌──────────────────────────────────────────────────────────────────┐
│  5. OUTPUT FORMATTING                                            │
│     • JSON — Full metadata + word/segment timestamps            │
│     • SRT  — Standard subtitle format                           │
│     • VTT  — Web Video Text Tracks                              │
│     • TXT  — Clean plain text                                   │
└──────────────────────────────┬──────────────────────────────────┘
                               │
                               ▼
┌──────────────────────────────────────────────────────────────────┐
│  6. STORAGE (Apify Platform)                                     │
│     • Results → Dataset (searchable, exportable)                │
│     • Status → Key-Value Store (real-time progress)             │
│     • Per-URL error isolation (one failure ≠ batch failure)     │
└──────────────────────────────────────────────────────────────────┘
```

***

### 🌐 YouTube Extraction

This actor automatically uses Apify **residential proxy** for YouTube extraction to bypass bot detection. No manual proxy configuration is needed — it's enabled by default in the actor input.

***

### 📥 Input

#### Basic Usage

```json
{
  "urls": [
    { "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ" },
    { "url": "https://www.tiktok.com/@user/video/1234567890" }
  ],
  "provider": "openai",
  "model": "whisper-1",
  "openaiApiKey": "sk-...",
  "outputFormats": ["json", "srt"]
}
```

#### Full Options

```json
{
  "urls": [{ "url": "https://www.youtube.com/watch?v=..." }],
  "directMediaUrls": ["https://example.com/audio.mp3"],
  "provider": "groq",
  "model": "whisper-large-v3-turbo",
  "groqApiKey": "gsk_...",
  "outputFormats": ["json", "srt", "vtt", "txt"],
  "language": "en",
  "translateToEnglish": false,
  "prompt": "This is a technical discussion about Kubernetes and Docker.",
  "speakerDiarization": false,
  "audioFormat": "mp3",
  "maxDurationMinutes": 0,
  "debugMode": false,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

#### Input Fields Reference

| Field | Type | Required | Default | Description |
|-------|------|----------|---------|-------------|
| `urls` | Array | ✅ Yes | — | List of video/audio URLs to transcribe |
| `directMediaUrls` | Array | No | — | Direct links to media files (bypasses extraction) |
| `provider` | String | No | `openai` | `openai`, `groq`, `assemblyai`, or `deepgram` |
| `model` | String | No | `whisper-1` | Transcription model (see provider comparison) |
| `openaiApiKey` | String | \* | — | Required when provider is `openai` |
| `groqApiKey` | String | \* | — | Required when provider is `groq` |
| `assemblyaiApiKey` | String | \* | — | Required when provider is `assemblyai` |
| `deepgramApiKey` | String | \* | — | Required when provider is `deepgram` |
| `outputFormats` | Array | No | `["json"]` | Output formats: `json`, `srt`, `vtt`, `txt` |
| `language` | String | No | auto | ISO-639-1 code (e.g., `en`, `id`, `ja`) |
| `translateToEnglish` | Boolean | No | `false` | Translate non-English to English |
| `prompt` | String | No | — | Context prompt for better accuracy |
| `speakerDiarization` | Boolean | No | `false` | Identify speakers (AssemblyAI/Deepgram only) |
| `audioFormat` | String | No | `mp3` | Extraction format: `mp3`, `m4a`, `wav`, `webm`, `flac` |
| `maxDurationMinutes` | Integer | No | `0` | Skip videos longer than X min (0 = no limit) |
| `debugMode` | Boolean | No | `false` | Verbose logging for troubleshooting |

***

### 📤 Output

Each URL produces a record in the Dataset:

```json
{
  "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
  "title": "Rick Astley - Never Gonna Give You Up (Official Music Video)",
  "provider": "openai",
  "model": "whisper-1",
  "language": "en",
  "duration": 213,
  "status": "success",
  "transcript": {
    "text": "We're no strangers to love...",
    "segments": [
      {
        "start": 0.0,
        "end": 4.5,
        "text": "We're no strangers to love"
      }
    ]
  },
  "formats": {
    "json": { "..." : "..." },
    "srt": "1\n00:00:00,000 --> 00:00:04,500\nWe're no strangers to love\n\n...",
    "txt": "We're no strangers to love..."
  },
  "metadata": {
    "platform": "youtube",
    "extractionTime": 3.2,
    "compressionRatio": 0.85,
    "totalChunks": 1
  },
  "error": null
}
```

#### Output Formats

**JSON** — Full structured data with timestamps, confidence scores, and segments:

```json
{
  "text": "Full transcription text...",
  "segments": [
    { "start": 0.0, "end": 4.5, "text": "First segment..." },
    { "start": 4.5, "end": 8.2, "text": "Second segment..." }
  ]
}
```

**SRT** — Standard subtitle format for video players:

```srt
1
00:00:00,000 --> 00:00:04,500
We're no strangers to love

2
00:00:04,500 --> 00:00:08,200
You know the rules and so do I
```

**VTT** — Web-compatible subtitle format:

```vtt
WEBVTT

00:00:00.000 --> 00:00:04.500
We're no strangers to love

00:00:04.500 --> 00:00:08.200
You know the rules and so do I
```

**TXT** — Clean plain text:

```
We're no strangers to love
You know the rules and so do I
```

***

### 🏗️ Architecture

```
src/
├── main.js           # Entry point — orchestrates the full pipeline
├── config.js         # Provider definitions, validation, constants
├── extractor.js      # yt-dlp wrapper with retry + error classification
├── processor.js      # ffmpeg compression + silence-aware chunking
├── formatter.js      # Output format converters (JSON/SRT/VTT/TXT)
├── storage.js        # Apify Dataset + KVS persistence
├── state.js          # Resumable state tracking across migrations
├── utils.js          # Retry logic, temp dirs, platform detection
└── providers/
    ├── base.js       # Abstract provider interface
    ├── openai.js     # OpenAI Whisper + GPT-4o transcription
    ├── groq.js       # Groq Whisper (OpenAI-compatible API)
    ├── assemblyai.js # AssemblyAI (URL-based, no file upload)
    ├── deepgram.js   # Deepgram (URL-based, streaming-capable)
    └── index.js      # Provider factory
```

#### Key Design Decisions

- **Compression-first**: Audio is compressed to 16kHz mono 64kbps before sending to APIs — this means ~50 min of audio fits in 25 MB, dramatically reducing costs
- **Silence-aware chunking**: When files exceed provider limits, we split at silence boundaries instead of cutting mid-sentence
- **Per-URL isolation**: One failed URL never aborts the entire batch — errors are captured and stored alongside successful results
- **Provider abstraction**: Adding a new provider requires only implementing the `BaseProvider` interface — no changes to the pipeline
- **State persistence**: Progress is saved to Apify KVS, so if the actor migrates servers mid-batch, it resumes where it left off

***

### 🔑 Getting API Keys

#### OpenAI

1. Go to [platform.openai.com](https://platform.openai.com)
2. Navigate to **API Keys**
3. Create a new key starting with `sk-...`
4. Pricing: $0.006/min (whisper-1), $0.02/min (gpt-4o-transcribe)

#### Groq (Recommended for Free Tier!)

1. Go to [console.groq.com](https://console.groq.com)
2. Sign up for a free account
3. Create an API key
4. Pricing: **Free tier available** with generous rate limits

#### AssemblyAI

1. Go to [assemblyai.com](https://www.assemblyai.com)
2. Sign up and get your API key
3. Pricing: $0.0035/min — best value for long videos

#### Deepgram

1. Go to [deepgram.com](https://deepgram.com)
2. Sign up for $200 free credit
3. Create an API key
4. Pricing: $0.0043/min

***

### 🛠️ Development

#### Prerequisites

- Node.js ≥ 20
- ffmpeg (for audio compression)
- yt-dlp (for audio extraction from URLs)

#### Local Setup

```bash
## Install dependencies
npm install

## Create environment file
cp .env.example .env
## Add your API key to .env

## Run
npm start

## Run tests
npm test
```

#### Adding a New Provider

1. Create `src/providers/your-provider.js` extending `BaseProvider`
2. Implement `transcribe(audioBuffer, options)` and `get supportsTimestamps()`
3. Add your provider to `PROVIDERS` and `MODEL_TO_PROVIDER` in `config.js`
4. Update the factory in `providers/index.js`

```javascript
// src/providers/your-provider.js
import { BaseProvider } from './base.js';

export class YourProvider extends BaseProvider {
  constructor(apiKey) {
    super(apiKey);
    // Initialize your SDK client
  }

  async transcribe(audioBuffer, options = {}) {
    // Call your provider's API
    return { text: '...', segments: [...] };
  }

  get supportsTimestamps() {
    return true;
  }
}
```

***

### 🐳 Docker

The actor runs in a Docker container with all dependencies pre-installed:

```dockerfile
FROM apify/actor-node:22-alpine

## Install ffmpeg + yt-dlp
RUN apk add --no-cache ffmpeg curl \
    && curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp \
       -o /usr/local/bin/yt-dlp \
    && chmod +x /usr/local/bin/yt-dlp

## Install Node.js dependencies
COPY package*.json ./
RUN npm install --omit=dev

## Copy source code
COPY . ./
```

Build and run locally:

```bash
docker build -t universal-transcriber .
docker run --env-file .env universal-transcriber
```

***

### 📋 Supported Platforms

yt-dlp supports **1000+** sites. Here are the most popular:

| Platform | Status | Notes |
|----------|--------|-------|
| YouTube | ✅ | Videos, Shorts, Playlists |
| TikTok | ✅ | Public videos |
| Instagram | ✅ | Reels, Posts, Stories |
| Twitter/X | ✅ | Public tweets with video |
| Facebook | ✅ | Public videos |
| Vimeo | ✅ | All videos |
| SoundCloud | ✅ | Tracks, playlists |
| Twitch | ✅ | VODs, clips |
| Reddit | ✅ | Video posts |
| Dailymotion | ✅ | All videos |
| LinkedIn | ✅ | Public videos |
| Direct URLs | ✅ | MP3, MP4, WAV, M4A, WEBM, OGG, FLAC |
| ...and 990+ more | ✅ | See [yt-dlp supported sites](https://github.com/yt-dlp/yt-dlp/blob/master/supportedsites.md) |

***

### ❓ FAQ

**Q: How much does it cost?**
A: Depends on the provider. Groq offers a free tier. OpenAI charges $0.006/min. For a 1-hour video, expect ~$0.36 with OpenAI or $0 with Groq's free tier.

**Q: How long does transcription take?**
A: Extraction + compression typically takes 1-3 minutes. API transcription is usually 10-30% of the audio duration. A 10-minute video is typically done in under 5 minutes total.

**Q: Can I transcribe private/unlisted videos?**
A: Yes, if you provide a proxy configuration or the platform allows access via the URL alone. For geo-restricted content, use the proxy settings.

**Q: What about very long videos (2+ hours)?**
A: The actor automatically compresses and chunks long audio. AssemblyAI and Deepgram have no file size limits, making them ideal for very long content.

**Q: Can I translate non-English audio to English?**
A: Yes! Enable `translateToEnglish` with OpenAI `whisper-1` or Groq `whisper-large-v3`.

**Q: How do I identify different speakers?**
A: Enable `speakerDiarization` with AssemblyAI or Deepgram. This adds speaker labels (SPEAKER 1, SPEAKER 2, etc.) to the output.

**Q: Can I run this locally without Apify?**
A: Yes! Install ffmpeg and yt-dlp, set your API key in `.env`, and run `npm start`.

***

### 🤝 Contributing

Contributions are welcome! Here's how:

1. Fork the repository
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

***

### 📄 License

This project is licensed under the MIT License — see the [LICENSE](LICENSE) file for details.

***

### 🙏 Acknowledgments

- [yt-dlp](https://github.com/yt-dlp/yt-dlp) — The incredible media downloader powering extraction
- [ffmpeg](https://ffmpeg.org/) — The Swiss army knife for audio processing
- [Apify](https://apify.com/) — The platform that makes deployment effortless
- OpenAI, Groq, AssemblyAI, Deepgram — The AI engines making transcription possible

***

<p align="center">
  <strong>⭐ Star this repo if you find it useful!</strong>
</p>

<p align="center">
  Made with ❤️ for the transcription community
</p>

# Actor input Schema

## `urls` (type: `array`):

List of video or audio URLs to transcribe.

## `directMediaUrls` (type: `array`):

Direct links to audio/video files (MP3, MP4, WAV, M4A, WEBM, OGG, FLAC). Bypasses yt-dlp extraction.

## `provider` (type: `string`):

Select the transcription provider.

## `model` (type: `string`):

Select the transcription model. Models vary by accuracy, speed, language support, and output format support.

## `openaiApiKey` (type: `string`):

Your OpenAI API key (starts with 'sk-...'). Required if provider is OpenAI.

## `groqApiKey` (type: `string`):

Your Groq API key. Required if provider is Groq. Get free at console.groq.com.

## `assemblyaiApiKey` (type: `string`):

Your AssemblyAI API key. Required if provider is AssemblyAI.

## `deepgramApiKey` (type: `string`):

Your Deepgram API key. Required if provider is Deepgram.

## `outputFormats` (type: `array`):

Select output formats. SRT/VTT require timestamp support (available with OpenAI whisper-1, AssemblyAI, and Deepgram).

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

ISO-639-1 language code (e.g., 'en', 'id', 'ja'). Improves accuracy and speed. Leave empty for auto-detection.

## `translateToEnglish` (type: `boolean`):

Translate non-English audio to English. Only works with OpenAI whisper-1 and Groq whisper-large-v3.

## `prompt` (type: `string`):

Guide the transcription with context — proper nouns, technical terms, vocabulary. Max 244 tokens. Supported by OpenAI and Groq.

## `proxyConfiguration` (type: `object`):

Apify residential proxy is auto-enabled for YouTube extraction to bypass bot detection. No manual configuration needed.

## `youtubeCookies` (type: `string`):

Optional: Netscape-format YouTube cookies for higher reliability. Not required — residential proxy handles most cases automatically.

## `audioFormat` (type: `string`):

Audio format for extraction. MP3 is recommended for best compatibility.

## `maxDurationMinutes` (type: `integer`):

Skip videos longer than this. Set to 0 for no limit.

## `speakerDiarization` (type: `boolean`):

Identify different speakers in the audio. Adds speaker labels to JSON output. Only supported by AssemblyAI and Deepgram.

## `debugMode` (type: `boolean`):

Enable verbose logging with detailed extraction, compression, and API call information.

## Actor input object example

```json
{
  "urls": [
    {
      "url": "https://www.youtube.com/shorts/kT1aootPiWM"
    }
  ],
  "provider": "openai",
  "model": "whisper-1",
  "outputFormats": [
    "json"
  ],
  "translateToEnglish": false,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  },
  "audioFormat": "mp3",
  "maxDurationMinutes": 0,
  "speakerDiarization": false,
  "debugMode": false
}
```

# Actor output Schema

## `transcriptions` (type: `string`):

All transcription results. Each record contains URL, metadata, transcript, and download links.

## `subtitleFiles` (type: `string`):

SRT, VTT, and TXT files stored in key-value store. Download URLs are in the dataset records.

# 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 = {
    "urls": [
        {
            "url": "https://www.youtube.com/shorts/kT1aootPiWM"
        }
    ],
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("rexreus/transcribe").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 = {
    "urls": [{ "url": "https://www.youtube.com/shorts/kT1aootPiWM" }],
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("rexreus/transcribe").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{
  "urls": [
    {
      "url": "https://www.youtube.com/shorts/kT1aootPiWM"
    }
  ],
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call rexreus/transcribe --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=rexreus/transcribe",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Transcribe | Transcribe any video or audio",
        "description": "Transcribe any video or audio from YouTube, TikTok, Instagram, Twitter, and 1000+ sites",
        "version": "0.0",
        "x-build-id": "2eI2a0R0Fq2lKi0pk"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/rexreus~transcribe/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-rexreus-transcribe",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/rexreus~transcribe/runs": {
            "post": {
                "operationId": "runs-sync-rexreus-transcribe",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/rexreus~transcribe/run-sync": {
            "post": {
                "operationId": "run-sync-rexreus-transcribe",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "urls"
                ],
                "properties": {
                    "urls": {
                        "title": "Video/Audio URLs",
                        "minItems": 1,
                        "type": "array",
                        "description": "List of video or audio URLs to transcribe.",
                        "items": {
                            "type": "object",
                            "required": [
                                "url"
                            ],
                            "properties": {
                                "url": {
                                    "type": "string",
                                    "title": "URL of a web page",
                                    "format": "uri"
                                }
                            }
                        }
                    },
                    "directMediaUrls": {
                        "title": "Direct media file URLs (optional)",
                        "type": "array",
                        "description": "Direct links to audio/video files (MP3, MP4, WAV, M4A, WEBM, OGG, FLAC). Bypasses yt-dlp extraction."
                    },
                    "provider": {
                        "title": "Provider",
                        "enum": [
                            "openai",
                            "groq",
                            "assemblyai",
                            "deepgram"
                        ],
                        "type": "string",
                        "description": "Select the transcription provider.",
                        "default": "openai"
                    },
                    "model": {
                        "title": "Model",
                        "enum": [
                            "whisper-1",
                            "gpt-4o-transcribe",
                            "gpt-4o-mini-transcribe",
                            "whisper-large-v3",
                            "whisper-large-v3-turbo",
                            "universal-3-pro",
                            "universal-2",
                            "nova-3",
                            "nova-2"
                        ],
                        "type": "string",
                        "description": "Select the transcription model. Models vary by accuracy, speed, language support, and output format support.",
                        "default": "whisper-1"
                    },
                    "openaiApiKey": {
                        "title": "OpenAI API Key",
                        "type": "string",
                        "description": "Your OpenAI API key (starts with 'sk-...'). Required if provider is OpenAI."
                    },
                    "groqApiKey": {
                        "title": "Groq API Key",
                        "type": "string",
                        "description": "Your Groq API key. Required if provider is Groq. Get free at console.groq.com."
                    },
                    "assemblyaiApiKey": {
                        "title": "AssemblyAI API Key",
                        "type": "string",
                        "description": "Your AssemblyAI API key. Required if provider is AssemblyAI."
                    },
                    "deepgramApiKey": {
                        "title": "Deepgram API Key",
                        "type": "string",
                        "description": "Your Deepgram API key. Required if provider is Deepgram."
                    },
                    "outputFormats": {
                        "title": "Output formats",
                        "minItems": 1,
                        "uniqueItems": true,
                        "type": "array",
                        "description": "Select output formats. SRT/VTT require timestamp support (available with OpenAI whisper-1, AssemblyAI, and Deepgram).",
                        "items": {
                            "type": "string",
                            "enum": [
                                "json",
                                "srt",
                                "vtt",
                                "txt"
                            ],
                            "enumTitles": [
                                "JSON (full metadata + segments)",
                                "SRT (subtitle file)",
                                "VTT (web subtitle)",
                                "TXT (plain text)"
                            ]
                        },
                        "default": [
                            "json"
                        ]
                    },
                    "language": {
                        "title": "Source language (optional)",
                        "type": "string",
                        "description": "ISO-639-1 language code (e.g., 'en', 'id', 'ja'). Improves accuracy and speed. Leave empty for auto-detection."
                    },
                    "translateToEnglish": {
                        "title": "Translate to English",
                        "type": "boolean",
                        "description": "Translate non-English audio to English. Only works with OpenAI whisper-1 and Groq whisper-large-v3.",
                        "default": false
                    },
                    "prompt": {
                        "title": "Context prompt (optional)",
                        "maxLength": 1000,
                        "type": "string",
                        "description": "Guide the transcription with context — proper nouns, technical terms, vocabulary. Max 244 tokens. Supported by OpenAI and Groq."
                    },
                    "proxyConfiguration": {
                        "title": "Proxy configuration",
                        "type": "object",
                        "description": "Apify residential proxy is auto-enabled for YouTube extraction to bypass bot detection. No manual configuration needed."
                    },
                    "youtubeCookies": {
                        "title": "YouTube Cookies (Optional)",
                        "type": "string",
                        "description": "Optional: Netscape-format YouTube cookies for higher reliability. Not required — residential proxy handles most cases automatically."
                    },
                    "audioFormat": {
                        "title": "Extracted audio format",
                        "enum": [
                            "mp3",
                            "m4a",
                            "wav",
                            "webm",
                            "flac"
                        ],
                        "type": "string",
                        "description": "Audio format for extraction. MP3 is recommended for best compatibility.",
                        "default": "mp3"
                    },
                    "maxDurationMinutes": {
                        "title": "Max video duration",
                        "minimum": 0,
                        "maximum": 1440,
                        "type": "integer",
                        "description": "Skip videos longer than this. Set to 0 for no limit.",
                        "default": 0
                    },
                    "speakerDiarization": {
                        "title": "Speaker diarization (AssemblyAI/Deepgram only)",
                        "type": "boolean",
                        "description": "Identify different speakers in the audio. Adds speaker labels to JSON output. Only supported by AssemblyAI and Deepgram.",
                        "default": false
                    },
                    "debugMode": {
                        "title": "Debug mode",
                        "type": "boolean",
                        "description": "Enable verbose logging with detailed extraction, compression, and API call information.",
                        "default": false
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
