Skip to main content

AI-powered CLI that translates natural language to safe, previewable ffmpeg commands with comprehensive testing and clean architecture

Project description

๐ŸŽฌ ai-ffmpeg-cli

PyPI version PyPI Downloads Python 3.10+ License: MIT codecov CI/CD Pipeline

Stop Googling ffmpeg commands. Just describe what you want.

aiclip preview

ai-ffmpeg-cli is an AI-powered CLI that translates natural language into safe, previewable ffmpeg commands. Built for developers, content creators, and anyone who works with media files but doesn't want to memorize complex syntax.

โœจ Why ai-ffmpeg-cli?

  • ๐Ÿค– AI-Native: Translate plain English to perfect ffmpeg commands
  • ๐Ÿ”’ Safety First: Preview every command before execution
  • โšก 10x Faster: Skip the documentation, Stack Overflow, and trial-and-error
  • ๐ŸŽฏ Battle-Tested: Generates reliable, production-ready commands
  • ๐Ÿ”„ Smart Defaults: Sensible codec and quality settings out of the box
  • ๐Ÿงช Well-Tested: 87%+ test coverage with comprehensive error handling
  • ๐Ÿ—๏ธ Clean Architecture: Modular design with clear separation of concerns
# Instead of this...
ffmpeg -i input.mp4 -vf "scale=1280:720" -c:v libx264 -c:a aac -b:v 2000k output.mp4

# Just say this...
aiclip "convert input.mp4 to 720p with good quality"

๐Ÿš€ Quick Start

Installation

# Install from PyPI
pip install ai-ffmpeg-cli

# Use the 'aiclip' command (CLI name is different from package name)
aiclip "your command here"

# Or with Homebrew (coming soon)
brew install aiclip

Setup

# Set your OpenAI API key
export OPENAI_API_KEY="sk-your-key-here"

# Or create a .env file
echo "OPENAI_API_KEY=sk-your-key-here" > .env

First Command

Interactive mode (type your request after launching):

aiclip
convert this video to 720p
โ”Œโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ # โ”‚ Command                                                  โ”‚
โ”œโ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ 1 โ”‚ ffmpeg -i input.mp4 -vf scale=1280:720 -c:v libx264...   โ”‚
โ””โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
Run these commands? [Y/n]

Or run a one-shot command (no interactive prompt):

aiclip --dry-run "convert input.mp4 to 720p with good quality"

๐Ÿ“– Usage Examples

Video Processing

# Convert formats
aiclip "convert input.mov to mp4 with h264 and aac"

# Resize videos  
aiclip "downscale video.mp4 to 720p"
aiclip "make input.mp4 1080p resolution"

# Compress files
aiclip "compress large-video.mp4 to smaller size"
aiclip "reduce file size with CRF 23"

Audio Operations

# Extract audio
aiclip "extract audio from movie.mp4 to mp3"
aiclip "get audio track from video as wav"

# Remove audio
aiclip "remove audio from video.mp4"

Trimming & Cutting

# Time-based cutting
aiclip "trim first 30 seconds from video.mp4"
aiclip "keep segment from 2:15 to 3:45 in input.mp4"
aiclip "cut out middle 5 minutes"

Image Extraction

# Thumbnails
aiclip "create thumbnail at 10 seconds from video.mp4"
aiclip "extract frame at 2:30 as PNG"

# Frame sequences
aiclip "extract one frame every 5 seconds"
aiclip "get all frames from video as images"

Advanced Operations

# Overlays
aiclip "add watermark logo.png to top-right of video.mp4"  
aiclip "overlay text on video at position 10:10"

# Batch processing
aiclip "convert all .mov files to .mp4"

๐ŸŽ›๏ธ Command Line Options

# One-shot mode (no interaction)
aiclip "your command here"

# Skip confirmation prompts  
aiclip --yes "convert video.mp4 to 720p"

# Preview only (don't execute)
aiclip --dry-run "compress input.mp4"

# Use different AI model
aiclip --model gpt-4o-mini "extract audio"

# Increase timeout for complex requests
aiclip --timeout 120 "complex processing task"

# Verbose logging for troubleshooting
aiclip --verbose "your command"

Subcommands and option placement

You can also use the explicit nl subcommand. Put global options before the subcommand:

aiclip --yes nl "thumbnail at 10s from test.mp4"
aiclip --dry-run --model gpt-4o-mini nl "compress input.mp4"

Do not invoke the binary twice:

# Incorrect
aiclip aiclip --yes nl "..."

๐Ÿ”ง Configuration

aiclip uses environment variables and .env files for configuration:

# Required
OPENAI_API_KEY=sk-your-openai-api-key

# Optional
AICLIP_MODEL=gpt-4o              # AI model to use
AICLIP_DRY_RUN=false            # Preview commands by default
AICLIP_TIMEOUT=60               # LLM timeout in seconds
AICLIP_MAX_FILE_SIZE=524288000  # Max file size (500MB)
AICLIP_RATE_LIMIT=60            # Rate limit requests per minute

๐ŸŽฏ Smart Defaults & Safety

  • Preview First: Every command is shown before execution
  • Overwrite Protection: Warns before overwriting existing files
  • Sensible Codecs: Automatically chooses h264+aac for MP4, libx265 for compression
  • Stream Copy: Uses -c copy for trimming when possible (faster, lossless)
  • Context Aware: Scans your directory to suggest input files and durations
  • Input Validation: Sanitizes all inputs to prevent command injection
  • Error Recovery: Graceful handling of network timeouts and API failures

๐Ÿ“Š Supported Operations

Operation Examples ffmpeg Equivalent
Convert "convert to mp4", "make it h264" -c:v libx264 -c:a aac
Resize "720p", "1920x1080", "scale to 50%" -vf scale=1280:720
Compress "make smaller", "CRF 28" -c:v libx265 -crf 28
Extract Audio "get audio as mp3" -q:a 0 -map a
Trim "first 30 seconds", "2:15 to 3:45" -ss 00:02:15 -to 00:03:45
Thumbnail "frame at 10s" -ss 00:00:10 -vframes 1
Overlay "watermark top-right" -filter_complex overlay=W-w-10:10
Batch "all *.mov files" Shell loops with glob patterns

๐Ÿ› ๏ธ Development

# Clone and setup
git clone https://github.com/d-k-patel/ai-ffmpeg-cli.git
cd ai-ffmpeg-cli
make setup

# Run tests
make test

# Check code quality  
make lint

# Format code
make format

# Try demo commands
make demo

# Run with coverage
make test-cov

Development Commands

# Full development setup
make setup          # Create virtual environment and install dependencies
make install        # Install package in development mode
make test           # Run test suite
make test-cov       # Run tests with coverage report
make lint           # Check code quality
make format         # Format code
make security       # Run security checks
make demo           # Run demonstration commands
make docs           # Generate and serve documentation
make clean          # Remove build artifacts

๐Ÿ“‹ Requirements

  • Python 3.10+ (uses modern type hints)
  • ffmpeg installed and available in PATH
    • macOS: brew install ffmpeg
    • Ubuntu: sudo apt install ffmpeg
    • Windows: Download from ffmpeg.org
  • OpenAI API key for natural language processing

๐Ÿ†˜ Troubleshooting

Common Issues

"OPENAI_API_KEY is required"

# Set your API key
export OPENAI_API_KEY="sk-your-key-here"
# Or add it to .env file

"ffmpeg not found in PATH"

# Install ffmpeg
brew install ffmpeg          # macOS
sudo apt install ffmpeg      # Ubuntu
# Windows: download from ffmpeg.org

"Failed to parse natural language prompt"

  • Try being more specific in your request
  • Use --model gpt-4o for better accuracy
  • Increase timeout with --timeout 120
  • Check your internet connection

"No input files found"

  • Ensure files exist in current directory
  • Check file extensions match your request
  • Use ls to verify available files

Getting Help

๐Ÿค Contributing

We love contributions! Whether it's:

  • ๐Ÿ› Bug reports and feature requests
  • ๐Ÿ“– Documentation improvements
  • ๐Ÿงช Test cases for edge scenarios
  • ๐Ÿ’ป Code contributions for new features
  • ๐ŸŽจ Examples and tutorials

See our Contributing Guide to get started.

Development Setup

# Fork and clone
git clone https://github.com/yourusername/ai-ffmpeg-cli.git
cd ai-ffmpeg-cli

# Setup development environment
make setup

# Run pre-commit checks
make pre-commit

# Run full pipeline
make all

๐Ÿ“ˆ What's Next?

  • ๐Ÿ”„ Batch Templates: Save and reuse complex workflows
  • ๐ŸŽ›๏ธ GUI Mode: Visual interface for non-CLI users
  • โšก Local Models: Run without internet using local AI
  • ๐Ÿข Team Features: Shared commands and analytics
  • ๐Ÿ”Œ Integrations: GitHub Actions, Docker, CI/CD pipelines
  • ๐Ÿ“Š Analytics: Usage statistics and performance insights

๐Ÿ“… Release Information

Current Version: 0.2.2
Release Date: August 20, 2025
Python Support: 3.10+
License: MIT

๐Ÿ“„ License

MIT License - see LICENSE file for details.

โญ Support

If aiclip saves you time, please:

  • โญ Star this repository
  • ๐Ÿฆ Share on social media
  • ๐Ÿ“ Write a review or blog post
  • ๐Ÿ’ฌ Tell your developer friends

Made with โค๏ธ by developers who got tired of Googling ffmpeg commands
๐ŸŽฌ Turn your words into perfect video commands

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

ai_ffmpeg_cli-0.2.2.tar.gz (65.3 kB view details)

Uploaded Source

Built Distribution

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

ai_ffmpeg_cli-0.2.2-py3-none-any.whl (42.2 kB view details)

Uploaded Python 3

File details

Details for the file ai_ffmpeg_cli-0.2.2.tar.gz.

File metadata

  • Download URL: ai_ffmpeg_cli-0.2.2.tar.gz
  • Upload date:
  • Size: 65.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for ai_ffmpeg_cli-0.2.2.tar.gz
Algorithm Hash digest
SHA256 04baa2530891c71c55e6c826d842211ea41afea4e1cdb3b9cc4b3c38eff40dd4
MD5 2470896862bd987b596235fb0d0746d9
BLAKE2b-256 d4260c6c120c7d548c976b1aa1b44a132dc454b1d0d0a9af613bf09c2532bdd0

See more details on using hashes here.

File details

Details for the file ai_ffmpeg_cli-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: ai_ffmpeg_cli-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 42.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for ai_ffmpeg_cli-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6de7efb4ddc91f430bbb326b68c6a5a42274c300a369d9aeaaf8d26709302055
MD5 28f46109e68cec1d9811809a75a06fb5
BLAKE2b-256 b39fdf3f578102192e16dccb899904c533e5a663d664d25bc74cd524f79c983a

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