# Audio And Video Transcriber (OpenAI GPT-4o-transcribe) (`stanvanrooy6/audio-video-transcriber`)

Downloads videos from public URLs, extracts audio, and transcribes them using OpenAI

- **URL**: https://beta-securitybyobscurity.apify.com/stanvanrooy6/audio-video-transcriber.md
- **Developed by:** [Stan Van Rooy](https://beta-securitybyobscurity.apify.com/stanvanrooy6) (community)
- **Categories:** Automation, Integrations, AI
- **Stats:** 36 total users, 8 monthly users, 100.0% runs succeeded, 3 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

$5.00/month + usage

To use this Actor, you pay a monthly rental fee to the developer. The rent is subtracted from your prepaid usage every month after the free trial period.
You also pay for the Apify platform usage, which gets cheaper the higher Apify subscription plan you have.

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

# README

## Video Transcriber Actor 🎤🎬

This Apify Actor automates the process of downloading videos from public URLs, extracting their audio content, and then transcribing the audio into text using OpenAI's powerful speech-to-text models (GPT-4o Mini Transcribe or GPT-4o Transcribe).

### Features

- **Batch Video Processing**: Provide a list of video URLs and get transcriptions for all of them.
- **Powered by OpenAI**: Utilizes state-of-the-art AI models (`gpt-4o-mini-transcribe` or `gpt-4o-transcribe`) for accurate transcriptions.
- **Configurable Transcription**: Adjust settings like language, prompt, and temperature to fine-tune transcription results.
- **Robust Error Handling**: Implements retries for network issues or temporary API failures.
- **Parallel Processing**: Downloads and transcribes multiple videos concurrently for faster results.
- **Secure API Key Handling**: Your OpenAI API key is treated as a secret input.

### Use Cases

- Transcribing lectures, talks, or presentations.
- Generating subtitles or text content from video podcasts.
- Making video content searchable by transcribing its audio.
- Analyzing spoken content in a collection of videos.

### Input Configuration

The actor requires the following input fields. Your OpenAI API key is essential for the transcription service to work.

| Field                           | Type     | Description                                                                                                                               | Default Value                |
| :------------------------------ | :------- | :---------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------- |
| `video_urls`                    | `Array`  | **Required.** A list of public direct URLs to video files (e.g., MP4, MOV, AVI). Each URL will be processed.                             | `[]` (Example prefilled)     |
| `openai_api_key`                | `String` | **Required.** Your OpenAI API key. This is treated as a secret and stored securely.                                                       | N/A                          |
| `openai_model`                  | `String` | The OpenAI model for transcription. `gpt-4o-mini-transcribe` is fast & cost-effective; `gpt-4o-transcribe` may offer higher accuracy. | `gpt-4o-mini-transcribe`     |
| `openai_transcription_language` | `String` | Optional. Language of the audio in ISO-639-1 format (e.g., `en` for English). If omitted, OpenAI attempts auto-detection.             | `""` (Empty String)         |
| `openai_transcription_prompt`   | `String` | Optional. Text prompt to guide the model's style or vocabulary (e.g., for specific jargon or names).                                  | N/A                          |
| `openai_transcription_temperature`| `String` | Sampling temperature (0.0-1.0, provided as a string e.g., `"0.2"`). Lower values are more deterministic.                               | `"0.0"`                      |
| `max_concurrent_tasks`          | `Integer`| Maximum number of videos to process in parallel.                                                                                          | `5`                          |
| `max_retries`                   | `Integer`| Number of times to retry processing a video if an error occurs.                                                                     | `3`                          |

**Example Input JSON:**

```json
{
    "video_urls": [
        "https://www.ffmpeg.org/example-assets/Counting_Atoms_preview.mp4",
        "https://another-public-domain.com/another-video.mp4"
    ],
    "openai_api_key": "sk-yourSecretOpenAiApiKeyGoesHere",
    "openai_model": "gpt-4o-mini-transcribe",
    "openai_transcription_language": "en",
    "openai_transcription_prompt": "Focus on scientific terminology.",
    "openai_transcription_temperature": "0.2",
    "max_concurrent_tasks": 5,
    "max_retries": 3
}
```

### Output

The actor saves each transcription result as a separate item in the Apify Dataset. Each item will have the following structure:

```json
{
  "download_url": "https://www.example.com/video.mp4",
  "transcription": "This is the transcribed text from the video...",
  "status": "succeeded" // or "failed"
}
```

If a video fails to process after all retries, the `transcription` will be `null`, `status` will be `failed`, and an `error` field will contain the error message.

### How to Use

1. Go to the Actor page on the [Apify Store](https://apify.com/store).
2. Click on "Try actor".
3. Fill in the input configuration fields, especially `video_urls` and your `openai_api_key`.
4. Click "Start" to run the actor.
5. When the run finishes, you can find the results in the "Dataset" tab of the run console.

### Technical Details

- The actor uses `ffmpeg` to extract audio from video files. Ensure the video formats are compatible with common `ffmpeg` builds.
- Video downloads are performed asynchronously.
- Transcription tasks are processed in parallel using Python's `multiprocessing`.

### Limitations

- **URL Accessibility**: Video URLs must be publicly accessible and direct links to video files. Redirects are followed, but complex authentication or sites requiring browser interaction are not supported.
- **OpenAI API Limits**: Your OpenAI API usage is subject to your OpenAI account's rate limits and quotas. Long videos or large batches might take time or hit these limits.
- **Video Size/Length**: Extremely large video files might lead to increased processing time or memory usage. The actor downloads the entire video into memory before audio extraction.
- **CDN Link Stability**: If using temporary CDN links (e.g., from some social media platforms), they may expire. Prefer stable, direct URLs.

### Support & Issues

If you encounter any issues or have suggestions for improvement, please [open an issue on the GitHub repository](https://github.com/your-github-username/your-repo-name/issues) for this actor (if applicable, or provide another contact method).

***

*Happy Transcribing!*

# Actor input Schema

## `video_urls` (type: `array`):

A list of public direct URLs to video files (e.g., MP4, MOV, AVI). Each URL will be processed individually.

## `openai_api_key` (type: `string`):

Your OpenAI API key for transcription services. This is treated as a secret and stored securely.

## `openai_model` (type: `string`):

The OpenAI model for transcription. 'gpt-4o-mini-transcribe' is fast and cost-effective. 'gpt-4o-transcribe' may offer higher accuracy.

## `openai_transcription_language` (type: `string`):

The language of the audio in ISO-639-1 format (e.g., 'en' for English, 'es' for Spanish). If omitted, OpenAI attempts auto-detection.

## `openai_transcription_prompt` (type: `string`):

An optional text prompt to guide the model's style, vocabulary, or to correct specific words/names. Can significantly improve accuracy for domain-specific content.

## `openai_transcription_temperature` (type: `string`):

Sampling temperature (0.0-1.0). Enter as a string, e.g., "0.2". Higher values make output more random; lower make it more deterministic. Default is "0.0".

## `max_concurrent_tasks` (type: `integer`):

The maximum number of videos to process in parallel. Adjust based on resources and API rate limits.

## `max_retries` (type: `integer`):

Number of times to retry processing a video if an error occurs (e.g., download/API failure).

## Actor input object example

```json
{
  "video_urls": [
    "https://video-waw2-2.xx.fbcdn.net/v/t42.1790-2/491492112_1402816654194790_3706138403446461337_n.?_nc_cat=101&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=5O1B48KVJpgQ7kNvwGXHySW&_nc_oc=Adny69uv0eWaQebdAhzOss9b5jHn0NcNQQYJRpRHOHSUgsLNPSc9ZIYgn99hG1dZm5o&_nc_zt=28&_nc_ht=video-waw2-2.xx&_nc_gid=eOXmIfiQ86pPQHpqaVsbAg&oh=00_AfINNjrKb1Eln1R5IGcCSa6-bJfXMKSDblreeG2oDgBxOA&oe=682BD862"
  ],
  "openai_model": "gpt-4o-mini-transcribe",
  "openai_transcription_language": "",
  "openai_transcription_temperature": "0.0",
  "max_concurrent_tasks": 5,
  "max_retries": 3
}
```

# 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 = {
    "video_urls": [
        "https://video-waw2-2.xx.fbcdn.net/v/t42.1790-2/491492112_1402816654194790_3706138403446461337_n.?_nc_cat=101&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=5O1B48KVJpgQ7kNvwGXHySW&_nc_oc=Adny69uv0eWaQebdAhzOss9b5jHn0NcNQQYJRpRHOHSUgsLNPSc9ZIYgn99hG1dZm5o&_nc_zt=28&_nc_ht=video-waw2-2.xx&_nc_gid=eOXmIfiQ86pPQHpqaVsbAg&oh=00_AfINNjrKb1Eln1R5IGcCSa6-bJfXMKSDblreeG2oDgBxOA&oe=682BD862"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("stanvanrooy6/audio-video-transcriber").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 = { "video_urls": ["https://video-waw2-2.xx.fbcdn.net/v/t42.1790-2/491492112_1402816654194790_3706138403446461337_n.?_nc_cat=101&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=5O1B48KVJpgQ7kNvwGXHySW&_nc_oc=Adny69uv0eWaQebdAhzOss9b5jHn0NcNQQYJRpRHOHSUgsLNPSc9ZIYgn99hG1dZm5o&_nc_zt=28&_nc_ht=video-waw2-2.xx&_nc_gid=eOXmIfiQ86pPQHpqaVsbAg&oh=00_AfINNjrKb1Eln1R5IGcCSa6-bJfXMKSDblreeG2oDgBxOA&oe=682BD862"] }

# Run the Actor and wait for it to finish
run = client.actor("stanvanrooy6/audio-video-transcriber").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 '{
  "video_urls": [
    "https://video-waw2-2.xx.fbcdn.net/v/t42.1790-2/491492112_1402816654194790_3706138403446461337_n.?_nc_cat=101&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=5O1B48KVJpgQ7kNvwGXHySW&_nc_oc=Adny69uv0eWaQebdAhzOss9b5jHn0NcNQQYJRpRHOHSUgsLNPSc9ZIYgn99hG1dZm5o&_nc_zt=28&_nc_ht=video-waw2-2.xx&_nc_gid=eOXmIfiQ86pPQHpqaVsbAg&oh=00_AfINNjrKb1Eln1R5IGcCSa6-bJfXMKSDblreeG2oDgBxOA&oe=682BD862"
  ]
}' |
apify call stanvanrooy6/audio-video-transcriber --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Audio And Video Transcriber (OpenAI GPT-4o-transcribe)",
        "description": "Downloads videos from public URLs, extracts audio, and transcribes them using OpenAI",
        "version": "1.0",
        "x-build-id": "aZu7xGrnGTATvcYfm"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/stanvanrooy6~audio-video-transcriber/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-stanvanrooy6-audio-video-transcriber",
                "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/stanvanrooy6~audio-video-transcriber/runs": {
            "post": {
                "operationId": "runs-sync-stanvanrooy6-audio-video-transcriber",
                "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/stanvanrooy6~audio-video-transcriber/run-sync": {
            "post": {
                "operationId": "run-sync-stanvanrooy6-audio-video-transcriber",
                "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": [
                    "video_urls",
                    "openai_api_key"
                ],
                "properties": {
                    "video_urls": {
                        "title": "Video URLs",
                        "type": "array",
                        "description": "A list of public direct URLs to video files (e.g., MP4, MOV, AVI). Each URL will be processed individually.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "openai_api_key": {
                        "title": "OpenAI API Key",
                        "type": "string",
                        "description": "Your OpenAI API key for transcription services. This is treated as a secret and stored securely."
                    },
                    "openai_model": {
                        "title": "OpenAI Transcription Model",
                        "enum": [
                            "gpt-4o-mini-transcribe",
                            "gpt-4o-transcribe"
                        ],
                        "type": "string",
                        "description": "The OpenAI model for transcription. 'gpt-4o-mini-transcribe' is fast and cost-effective. 'gpt-4o-transcribe' may offer higher accuracy.",
                        "default": "gpt-4o-mini-transcribe"
                    },
                    "openai_transcription_language": {
                        "title": "Audio Language (Optional)",
                        "type": "string",
                        "description": "The language of the audio in ISO-639-1 format (e.g., 'en' for English, 'es' for Spanish). If omitted, OpenAI attempts auto-detection.",
                        "default": ""
                    },
                    "openai_transcription_prompt": {
                        "title": "Transcription Prompt (Optional)",
                        "type": "string",
                        "description": "An optional text prompt to guide the model's style, vocabulary, or to correct specific words/names. Can significantly improve accuracy for domain-specific content."
                    },
                    "openai_transcription_temperature": {
                        "title": "Transcription Temperature",
                        "pattern": "^(0(\\.\\d+)?|1(\\.0+)?|[01])$",
                        "type": "string",
                        "description": "Sampling temperature (0.0-1.0). Enter as a string, e.g., \"0.2\". Higher values make output more random; lower make it more deterministic. Default is \"0.0\".",
                        "default": "0.0"
                    },
                    "max_concurrent_tasks": {
                        "title": "Maximum Concurrent Tasks",
                        "minimum": 1,
                        "type": "integer",
                        "description": "The maximum number of videos to process in parallel. Adjust based on resources and API rate limits.",
                        "default": 5
                    },
                    "max_retries": {
                        "title": "Maximum Retries per Video",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Number of times to retry processing a video if an error occurs (e.g., download/API failure).",
                        "default": 3
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
