FFmpeg operations in natural language with best practices built-in. Use when working with audio/video files for conversion, extraction, trimming, resizing, or compression. Automatically applies smart defaults (stream copy for video when possible, efficient presets, CPU-only encoding).
Natural language FFmpeg operations with opinionated best practices for speed, reliability, and quality.
-c copy to avoid re-encoding (10x faster, no quality loss)fast preset for x264/x265 (good balance of speed/quality)When extracting audio from video:
# Standard audio extraction (AAC/MP3)
ffmpeg -i input.mp4 -vn -acodec copy output.aac
# For transcription (Whisper-optimized)
ffmpeg -i input.mp4 -vn -ar 16000 -ac 1 -c:a libmp3lame -b:a 64k output.mp3
Always ask: "Is this for transcription?" before choosing the format.
When converting video containers (e.g., MKV → MP4):
# Fast conversion (stream copy - no re-encoding)
ffmpeg -i input.mkv -c copy output.mp4
If stream copy fails (incompatible codecs), fall back to re-encoding:
# Fallback: re-encode with fast preset
ffmpeg -i input.mkv -c:v libx264 -preset fast -crf 23 -c:a aac -b:a 128k output.mp4
When trimming video (preserving quality):
# Fast trim (stream copy)
ffmpeg -ss 00:01:30 -to 00:02:45 -i input.mp4 -c copy output.mp4
# Accurate trim (re-encode if needed)
ffmpeg -i input.mp4 -ss 00:01:30 -to 00:02:45 -c:v libx264 -preset fast -crf 23 -c:a copy output.mp4
When resizing video:
# Resize to 720p (maintains aspect ratio)
ffmpeg -i input.mp4 -vf scale=-2:720 -c:v libx264 -preset fast -crf 23 -c:a copy output.mp4
# Resize to specific width (maintains aspect ratio)
ffmpeg -i input.mp4 -vf scale=1280:-2 -c:v libx264 -preset fast -crf 23 -c:a copy output.mp4
For WhatsApp/Telegram:
# Aggressive compression (under 50MB target)
ffmpeg -i input.mp4 -vf scale=-2:480 -c:v libx264 -preset fast -crf 28 -b:a 64k -ac 1 output.mp4
General compression:
# Balanced compression
ffmpeg -i input.mp4 -c:v libx264 -preset fast -crf 28 -c:a aac -b:a 96k output.mp4
veryfast presetfast presetUse scripts/ffmpeg_helper.py for common operations:
# Extract audio (auto-detects purpose)
python3 scripts/ffmpeg_helper.py extract-audio input.mp4 --ask-purpose
# Convert video (smart defaults)
python3 scripts/ffmpeg_helper.py convert input.mkv output.mp4
# Trim video (fast mode by default)
python3 scripts/ffmpeg_helper.py trim input.mp4 output.mp4 --start 00:01:30 --end 00:02:45
# Resize video
python3 scripts/ffmpeg_helper.py resize input.mp4 output.mp4 --height 720
# Compress for messaging
python3 scripts/ffmpeg_helper.py compress input.mp4 output.mp4 --target whatsapp
See references/presets.md for detailed preset explanations and use cases.
When stream copy fails:
When output is too large: