Skip to main content

Video Caption Generator

Generate captions from video files with automatic language detection and support for SRT/VTT output formats.

Problem Statement

Who: Content creators, video editors, accessibility teams
Why: Manual captioning is time-consuming and expensive. Automated captions improve accessibility and SEO.

What You’ll Build

A recipe that extracts audio from video, transcribes it, and generates properly formatted caption files.

Input/Output Contract

Prerequisites

Required: OPENAI_API_KEY environment variable must be set.

Step-by-Step Build

1

Create Recipe Directory

2

Create TEMPLATE.yaml

Create the recipe metadata file:
3

Create recipe.py

Implement the main recipe logic:
4

Create test_recipe.py

Write tests for the recipe:
5

Create README.md

Document the recipe:

Inputs

Outputs

Requirements

  • OPENAI_API_KEY environment variable
  • ffmpeg (optional, for audio extraction)
  • praisonaiagents package

Examples

Basic Usage

Specify Language and Format

Troubleshooting

Run Locally

Using CLI

Using Python SDK

Deploy & Integrate: 6 Integration Models

When to use: Python applications, Jupyter notebooks, direct integration
Deployment note: Runs in-process, lowest latency, requires Python environment.
Safety: Ensure video files are from trusted sources. Recipe writes to local filesystem.

Troubleshooting

Symptom: Error message about ffmpeg not being installed.Solution:
The recipe will still work without ffmpeg but may have reduced quality.
Symptom: Authentication error from OpenAI.Solution:
Symptom: Captions contain errors or miss words.Solutions:
  • Specify the language explicitly instead of auto-detect
  • Ensure audio quality is good (reduce background noise)
  • Try a different model by setting OPENAI_MODEL=gpt-4o
Symptom: Recipe times out on long videos.Solution:
  • Split video into smaller segments
  • Use async/event-driven integration model
  • Increase timeout in config

Next Steps