ffmpeg-processing
Professional video and audio processing - transcode, edit, stream, and analyze media files
When & Why to Use This Skill
The FFmpeg Processing skill is a comprehensive media manipulation toolkit that enables Claude to perform professional-grade video and audio tasks. Leveraging FFmpeg 8.0, it supports high-performance transcoding, stream extraction, complex filtering, and hardware acceleration (CUDA). This skill is designed to automate media workflows, from simple format conversions to advanced streaming preparations and technical media analysis, making it an essential tool for developers and content creators.
Use Cases
- Automated Media Conversion: Batch convert legacy video formats (MKV, AVI) to web-optimized MP4 or high-efficiency H.265/HEVC to reduce storage costs and improve compatibility.
- Social Media Content Optimization: Generate high-quality GIFs, add watermarks, and crop videos to specific aspect ratios (9:16 or 1:1) for platforms like TikTok, Instagram, and YouTube Shorts.
- Audio Engineering & Extraction: Extract high-fidelity audio tracks from video files, normalize volume levels using 'loudnorm' filters, and convert between formats like AAC, MP3, and FLAC.
- Streaming Infrastructure Support: Generate HLS or DASH streaming manifests and segments for web-based video players, and utilize RTMP for live streaming workflows.
- Technical Media Analysis: Programmatically extract detailed metadata including resolution, bitrate, and codec information using ffprobe for media asset management and quality assurance.
- Video Editing Automation: Perform precise trimming, concatenation of multiple clips, and apply complex visual filters like blurring or speed adjustments without manual editing software.
| name | FFmpeg Processing |
|---|---|
| description | Professional video and audio processing - transcode, edit, stream, and analyze media files |
FFmpeg Processing Skill
Comprehensive media processing with FFmpeg 8.0 for video/audio transcoding, editing, streaming, and analysis.
Capabilities
- Video/audio transcoding and format conversion
- Stream extraction and muxing
- Video editing (cut, concat, filters)
- Resolution and codec conversion
- Subtitle handling
- Streaming protocols (HLS, DASH, RTMP)
- Image sequence generation
- Audio processing and normalization
- Hardware acceleration (CUDA)
When to Use
- Convert media formats
- Extract audio from video
- Create video thumbnails
- Resize and crop videos
- Merge or split media files
- Generate streaming manifests
- Apply filters and effects
- Analyze media properties
Basic Commands
Info and Analysis
ffmpeg -i input.mp4 # Show file info
ffprobe -v quiet -print_format json -show_format -show_streams input.mp4
Format Conversion
ffmpeg -i input.avi output.mp4 # Convert to MP4
ffmpeg -i input.mp4 -c copy output.mkv # Copy streams (fast)
Resolution and Quality
# Scale to 720p
ffmpeg -i input.mp4 -vf scale=-2:720 output.mp4
# Set bitrate
ffmpeg -i input.mp4 -b:v 2M -b:a 192k output.mp4
# Set quality (CRF)
ffmpeg -i input.mp4 -c:v libx264 -crf 23 output.mp4
Extract Audio
ffmpeg -i video.mp4 -vn -acodec libmp3lame -q:a 2 audio.mp3
ffmpeg -i video.mp4 -vn -c:a copy audio.aac
Extract Frames
# All frames as images
ffmpeg -i input.mp4 frame%04d.png
# One frame per second
ffmpeg -i input.mp4 -vf fps=1 frame%04d.png
# Single frame at timestamp
ffmpeg -ss 00:01:30 -i input.mp4 -frames:v 1 thumbnail.jpg
Advanced Operations
Cutting and Trimming
# Cut from 10s to 30s
ffmpeg -ss 00:00:10 -to 00:00:30 -i input.mp4 -c copy output.mp4
# First 60 seconds
ffmpeg -t 60 -i input.mp4 -c copy output.mp4
Concatenation
# Create file list (list.txt)
# file 'video1.mp4'
# file 'video2.mp4'
ffmpeg -f concat -safe 0 -i list.txt -c copy output.mp4
Filters
# Crop to 16:9
ffmpeg -i input.mp4 -vf "crop=1920:1080:0:0" output.mp4
# Add watermark
ffmpeg -i input.mp4 -i logo.png -filter_complex "overlay=10:10" output.mp4
# Speed up 2x
ffmpeg -i input.mp4 -vf "setpts=0.5*PTS" -af "atempo=2.0" output.mp4
# Blur face (coordinates x:y:w:h)
ffmpeg -i input.mp4 -vf "boxblur=10:5:x=100:y=100:w=200:h=200" output.mp4
Subtitles
# Burn subtitles into video
ffmpeg -i input.mp4 -vf subtitles=subs.srt output.mp4
# Add subtitle track
ffmpeg -i video.mp4 -i subs.srt -c copy -c:s mov_text output.mp4
Audio Processing
# Normalize audio
ffmpeg -i input.mp4 -af "loudnorm" output.mp4
# Extract specific channel
ffmpeg -i stereo.mp3 -map_channel 0.0.0 left.mp3
# Mix audio tracks
ffmpeg -i video.mp4 -i audio.mp3 -c:v copy -map 0:v:0 -map 1:a:0 output.mp4
Streaming
# HLS streaming
ffmpeg -i input.mp4 \
-codec: copy \
-start_number 0 \
-hls_time 10 \
-hls_list_size 0 \
-f hls playlist.m3u8
# RTMP stream
ffmpeg -re -i input.mp4 -c:v libx264 -preset veryfast -maxrate 3000k \
-bufsize 6000k -pix_fmt yuv420p -g 50 -c:a aac -b:a 160k -ac 2 \
-f flv rtmp://server/live/streamkey
CUDA Hardware Acceleration
# List encoders
ffmpeg -encoders | grep nvenc
# H.264 encoding with CUDA
ffmpeg -hwaccel cuda -i input.mp4 -c:v h264_nvenc -preset fast output.mp4
# Decode and encode with CUDA
ffmpeg -hwaccel cuda -hwaccel_output_format cuda -i input.mp4 \
-c:v h264_nvenc -preset p4 output.mp4
Batch Processing
# Convert all MKV to MP4
for f in *.mkv; do
ffmpeg -i "$f" -c copy "${f%.mkv}.mp4"
done
# Generate thumbnails
for f in *.mp4; do
ffmpeg -ss 00:00:05 -i "$f" -frames:v 1 "${f%.mp4}.jpg"
done
Presets and Profiles
YouTube Upload
ffmpeg -i input.mp4 \
-c:v libx264 -preset slow -crf 18 \
-c:a aac -b:a 192k \
-pix_fmt yuv420p \
-movflags +faststart \
youtube.mp4
Web Optimization
ffmpeg -i input.mp4 \
-c:v libx264 -crf 23 -preset faster \
-vf scale=-2:720 \
-c:a aac -b:a 128k \
-movflags +faststart \
web.mp4
GIF Creation
ffmpeg -i input.mp4 -vf "fps=10,scale=480:-1:flags=lanczos" \
-c:v gif output.gif
# Better quality (two-pass with palette)
ffmpeg -i input.mp4 -vf "fps=10,scale=480:-1:flags=lanczos,palettegen" palette.png
ffmpeg -i input.mp4 -i palette.png \
-lavfi "fps=10,scale=480:-1:flags=lanczos[x];[x][1:v]paletteuse" output.gif
Analysis Commands
# Get duration
ffprobe -v error -show_entries format=duration \
-of default=noprint_wrappers=1:nokey=1 input.mp4
# Get resolution
ffprobe -v error -select_streams v:0 \
-show_entries stream=width,height \
-of csv=s=x:p=0 input.mp4
# Get bitrate
ffprobe -v error -show_entries format=bit_rate \
-of default=noprint_wrappers=1:nokey=1 input.mp4
Common Codecs
Video
- H.264 (libx264) - Universal compatibility
- H.265 (libx265) - Better compression
- VP9 (libvpx-vp9) - Open standard
- AV1 (libaom-av1) - Modern codec
Audio
- AAC (aac) - Universal
- MP3 (libmp3lame) - Legacy
- Opus (libopus) - Best quality/bitrate
- FLAC (flac) - Lossless
Troubleshooting
Sync Issues
# Fix A/V sync
ffmpeg -i input.mp4 -itsoffset 0.5 -i input.mp4 \
-map 0:v -map 1:a -c copy output.mp4
Corrupted Files
# Attempt repair
ffmpeg -err_detect ignore_err -i corrupted.mp4 -c copy repaired.mp4
Performance Tips
- Use
-c copywhen possible (no re-encoding) - Enable hardware acceleration for batch jobs
- Use appropriate presets (faster/fast/medium/slow)
- Limit threads with
-threads Nif needed - Monitor with
-progressflag
Related Skills
- jupyter-notebooks - Analyze with Python
- docker-manager - Batch processing in containers
Notes
- FFmpeg 8.0 with full codec support
- CUDA acceleration available
- Supports 100+ formats
- Real-time processing capable
- Pipe support for streaming workflows