Skip to main content

CLI tool to generate Final Cut Pro compatible subtitle files from audio/video files using Whisper

Project description

FCPXML Subtitle Generator

PyPI version Python License: MIT

A powerful CLI tool to generate subtitle files for Final Cut Pro (FCPXML) and Adobe Premiere Pro (SRT) from audio/video files using OpenAI's Whisper AI transcription.

🚀 Features

  • Multiple output formats: FCPXML for Final Cut Pro, SRT for Premiere Pro and other editors
  • Multiple file format support: MP3, MP4, WAV, M4A
  • Automatic audio extraction: Extracts audio from MP4 video files
  • AI-powered transcription: Uses OpenAI Whisper for accurate speech-to-text
  • Final Cut Pro integration: Generates FCPXML subtitle files with frame-accurate timing (30fps)
  • Adobe Premiere Pro support: Generates SRT subtitle files for universal compatibility
  • Multiple model sizes: Choose from tiny, base, small, medium, or large Whisper models for speed/quality balance
  • Multi-language support: Auto-detect or specify language for better accuracy
  • Easy installation: Available on PyPI with simple pip install

📦 Installation

Install from PyPI with a single command:

pip install fcpxml-subtitle-generator

Requirements:

  • Python 3.13 or higher
  • FFmpeg (for video processing)

🎯 Quick Start

Basic Usage

Generate Final Cut Pro subtitles from an audio file:

fs-gen input.mp3

Generate Premiere Pro subtitles from a video file:

fs-gen input.mp4 -f srt

Advanced Usage

# Generate SRT for Premiere Pro
fs-gen input.mp3 -f srt

# Specify output file
fs-gen input.mp3 -o custom_subtitles.fcpxml

# Use a different Whisper model (higher quality but slower)
fs-gen input.mp3 -m large -f srt

# Specify language for better accuracy
fs-gen input.mp3 -l en -f srt

# Combine all options for Premiere Pro
fs-gen input.mp4 -f srt -o subtitles.srt -m medium -l ko

📋 Command Line Arguments

Argument Short Description Default
input_file - Path to input audio/video file Required
--output -o Output subtitle file path input_filename.fcpxml or .srt
--format -f Output format (fcpxml or srt) fcpxml
--model -m Whisper model size base
--language -l Language code (e.g., 'en', 'ko', 'ja') Auto-detect
--help -h Show help message -

Whisper Model Sizes

Model Speed Quality Use Case
tiny Fastest Lowest Quick drafts
base Fast Good Default - balanced
small Medium Better Higher quality
medium Slow High Professional use
large Slowest Highest Maximum accuracy

Supported Languages

Common language codes:

  • en - English
  • ko - Korean
  • ja - Japanese
  • zh - Chinese
  • es - Spanish
  • fr - French
  • de - German
  • it - Italian
  • pt - Portuguese
  • ru - Russian

Auto-detection is used when no language is specified.

🎬 Output Formats

FCPXML (Final Cut Pro)

The tool generates FCPXML files that can be directly imported into Final Cut Pro as subtitle tracks:

  • Format: FCPXML 1.11 standard
  • Frame Rate: 30fps (1001/30000s per frame)
  • Text Encoding: UTF-8 with XML escaping
  • Timing: Frame-accurate subtitle positioning
  • Effect: Uses Basic Title effect for Final Cut Pro compatibility

SRT (Premiere Pro & Universal)

The tool also generates SRT files compatible with Adobe Premiere Pro and most video editors:

  • Format: SubRip Subtitle (.srt) standard
  • Time Format: HH:MM:SS,mmm → HH:MM:SS,mmm
  • Text Encoding: UTF-8
  • Compatibility: Adobe Premiere Pro, DaVinci Resolve, Avid, YouTube, Vimeo, and more

💡 Usage Examples

Process a Podcast for Final Cut Pro

fs-gen podcast.mp3
# Output: podcast.fcpxml

Video Interview for Premiere Pro with Korean Language

fs-gen interview.mp4 -f srt -l ko -m medium
# Output: interview.srt

High-Quality Transcription for Premiere Pro

fs-gen presentation.mp4 -f srt -m large -o presentation_subs.srt
# Output: presentation_subs.srt

Batch Processing (Shell)

# Process all MP4 files in current directory
for file in *.mp4; do
    fs-gen "$file" -m base -l en
done

🔧 Technical Details

  • Audio Processing: Temporary WAV files for MP4 audio extraction
  • AI Model: OpenAI Whisper with word-level timestamps
  • Frame Synchronization: Rounds to nearest 30fps frame boundary
  • Memory Usage: Optimized for large files with temporary file cleanup
  • Error Handling: Comprehensive error messages and graceful failures

🛠️ Development

Local Development Setup

# Clone the repository
git clone https://github.com/taejun0622/fcpxml-subtitle-generator.git
cd fcpxml-subtitle-generator

# Install in development mode
pip install -e .

# Run from source
python subtitle_generator.py input.mp3

Building from Source

# Install build tools
pip install build twine

# Build the package
python -m build

# The built files will be in dist/

🐛 Troubleshooting

Common Issues

FFmpeg not found:

# macOS
brew install ffmpeg

# Ubuntu/Debian
sudo apt install ffmpeg

# Windows
# Download from https://ffmpeg.org/download.html

Out of memory error:

# Use a smaller model
fs-gen input.mp4 -m tiny

Wrong language detected:

# Specify the language explicitly
fs-gen input.mp3 -l ko

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📞 Support

🙏 Acknowledgments

  • OpenAI Whisper for the amazing speech recognition
  • MoviePy for video/audio processing
  • The Python packaging community for excellent tools and documentation

Made with ❤️ for video editors and content creators

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fcpxml_subtitle_generator-0.1.1.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fcpxml_subtitle_generator-0.1.1-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file fcpxml_subtitle_generator-0.1.1.tar.gz.

File metadata

File hashes

Hashes for fcpxml_subtitle_generator-0.1.1.tar.gz
Algorithm Hash digest
SHA256 bb8b3058f7500d2c520404d0fb50f23c02e55458e17c205e78a43e2dc44de152
MD5 f29c596260828ec68cf2f39656628acc
BLAKE2b-256 9eaf20a80726b14746413f56d69fcdb2402db3cfc5d0f0c2e2b16efebfb6b610

See more details on using hashes here.

File details

Details for the file fcpxml_subtitle_generator-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for fcpxml_subtitle_generator-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b3a49fc499cade56b671e5702674450ca9a9fe085626e281f4a72ffd5dfee6e3
MD5 2591a4fd0d889a90dd10767004a0c263
BLAKE2b-256 ad46f0bb9ecaebd2894b2dfc13394def0e52cf52603c9ba235bab9a7c179d599

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page