media-processing

96
4
Source

Process multimedia files with FFmpeg (video/audio encoding, conversion, streaming, filtering, hardware acceleration) and ImageMagick (image manipulation, format conversion, batch processing, effects, composition). Use when converting media formats, encoding videos with specific codecs (H.264, H.265, VP9), resizing/cropping images, extracting audio from video, applying filters and effects, optimizing file sizes, creating streaming manifests (HLS/DASH), generating thumbnails, batch processing images, creating composite images, or implementing media processing pipelines. Supports 100+ formats, hardware acceleration (NVENC, QSV), and complex filtergraphs.

Install

mkdir -p .claude/skills/media-processing && curl -L -o skill.zip "https://mcp.directory/api/skills/download/173" && unzip -o skill.zip -d .claude/skills/media-processing && rm skill.zip

Installs to .claude/skills/media-processing

About this skill

Media Processing Skill

Process video, audio, and images using FFmpeg and ImageMagick command-line tools for conversion, optimization, streaming, and manipulation tasks.

When to Use This Skill

Use when:

  • Converting media formats (video, audio, images)
  • Encoding video with codecs (H.264, H.265, VP9, AV1)
  • Processing images (resize, crop, effects, watermarks)
  • Extracting audio from video
  • Creating streaming manifests (HLS/DASH)
  • Generating thumbnails and previews
  • Batch processing media files
  • Optimizing file sizes and quality
  • Applying filters and effects
  • Creating composite images or videos

Tool Selection Guide

FFmpeg: Video/Audio Processing

Use FFmpeg for:

  • Video encoding, conversion, transcoding
  • Audio extraction, conversion, mixing
  • Live streaming (RTMP, HLS, DASH)
  • Video filters (scale, crop, rotate, overlay)
  • Hardware-accelerated encoding
  • Media file inspection (ffprobe)
  • Frame extraction, concatenation
  • Codec selection and optimization

ImageMagick: Image Processing

Use ImageMagick for:

  • Image format conversion (PNG, JPEG, WebP, GIF)
  • Resizing, cropping, transformations
  • Batch image processing (mogrify)
  • Visual effects (blur, sharpen, sepia)
  • Text overlays and watermarks
  • Image composition and montages
  • Color adjustments, filters
  • Thumbnail generation

Decision Matrix

TaskToolWhy
Video encodingFFmpegNative video codec support
Audio extractionFFmpegDirect stream manipulation
Image resizeImageMagickOptimized for still images
Batch imagesImageMagickmogrify for in-place edits
Video thumbnailsFFmpegFrame extraction built-in
GIF creationFFmpeg or ImageMagickFFmpeg for video source, ImageMagick for images
StreamingFFmpegLive streaming protocols
Image effectsImageMagickRich filter library

Installation

macOS

brew install ffmpeg imagemagick

Ubuntu/Debian

sudo apt-get install ffmpeg imagemagick

Windows

# Using winget
winget install ffmpeg
winget install ImageMagick.ImageMagick

# Or download binaries
# FFmpeg: https://ffmpeg.org/download.html
# ImageMagick: https://imagemagick.org/script/download.php

Verify Installation

ffmpeg -version
ffprobe -version
magick -version
# or
convert -version

Quick Start Examples

Video Conversion

# Convert format (copy streams, fast)
ffmpeg -i input.mkv -c copy output.mp4

# Re-encode with H.264
ffmpeg -i input.avi -c:v libx264 -crf 22 -c:a aac output.mp4

# Resize video to 720p
ffmpeg -i input.mp4 -vf scale=-1:720 -c:a copy output.mp4

Audio Extraction

# Extract audio (no re-encoding)
ffmpeg -i video.mp4 -vn -c:a copy audio.m4a

# Convert to MP3
ffmpeg -i video.mp4 -vn -q:a 0 audio.mp3

Image Processing

# Convert format
magick input.png output.jpg

# Resize maintaining aspect ratio
magick input.jpg -resize 800x600 output.jpg

# Create square thumbnail
magick input.jpg -resize 200x200^ -gravity center -extent 200x200 thumb.jpg

Batch Image Resize

# Resize all JPEGs to 800px width
mogrify -resize 800x -quality 85 *.jpg

# Output to separate directory
mogrify -path ./output -resize 800x600 *.jpg

Video Thumbnail

# Extract frame at 5 seconds
ffmpeg -ss 00:00:05 -i video.mp4 -vframes 1 -vf scale=320:-1 thumb.jpg

HLS Streaming

# Generate HLS playlist
ffmpeg -i input.mp4 \
  -c:v libx264 -preset fast -crf 22 -g 48 \
  -c:a aac -b:a 128k \
  -f hls -hls_time 6 -hls_playlist_type vod \
  playlist.m3u8

Image Watermark

# Add watermark to corner
magick input.jpg watermark.png -gravity southeast \
  -geometry +10+10 -composite output.jpg

Common Workflows

Optimize Video for Web

# H.264 with good compression
ffmpeg -i input.mp4 \
  -c:v libx264 -preset slow -crf 23 \
  -c:a aac -b:a 128k \
  -movflags +faststart \
  output.mp4

Create Responsive Images

# Generate multiple sizes
for size in 320 640 1024 1920; do
  magick input.jpg -resize ${size}x -quality 85 "output-${size}w.jpg"
done

Extract Video Segment

# From 1:30 to 3:00 (re-encode for precision)
ffmpeg -i input.mp4 -ss 00:01:30 -to 00:03:00 \
  -c:v libx264 -c:a aac output.mp4

Batch Image Optimization

# Convert PNG to optimized JPEG
mogrify -path ./optimized -format jpg -quality 85 -strip *.png

Video GIF Creation

# High quality GIF with palette
ffmpeg -i input.mp4 -vf "fps=15,scale=640:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" output.gif

Image Blur Effect

# Gaussian blur
magick input.jpg -gaussian-blur 0x8 output.jpg

Advanced Techniques

Multi-Pass Video Encoding

# Pass 1 (analysis)
ffmpeg -y -i input.mkv -c:v libx264 -b:v 2600k -pass 1 -an -f null /dev/null

# Pass 2 (encoding)
ffmpeg -i input.mkv -c:v libx264 -b:v 2600k -pass 2 -c:a aac output.mp4

Hardware-Accelerated Encoding

# NVIDIA NVENC
ffmpeg -hwaccel cuda -i input.mp4 -c:v h264_nvenc -preset fast -crf 22 output.mp4

# Intel QuickSync
ffmpeg -hwaccel qsv -c:v h264_qsv -i input.mp4 -c:v h264_qsv output.mp4

Complex Image Pipeline

# Resize, crop, border, adjust
magick input.jpg \
  -resize 1000x1000^ \
  -gravity center \
  -crop 1000x1000+0+0 +repage \
  -bordercolor black -border 5x5 \
  -brightness-contrast 5x10 \
  -quality 90 \
  output.jpg

Video Filter Chains

# Scale, denoise, watermark
ffmpeg -i video.mp4 -i logo.png \
  -filter_complex "[0:v]scale=1280:720,hqdn3d[v];[v][1:v]overlay=10:10" \
  -c:a copy output.mp4

Animated GIF from Images

# Create with delay
magick -delay 100 -loop 0 frame*.png animated.gif

# Optimize size
magick animated.gif -fuzz 5% -layers Optimize optimized.gif

Media Analysis

Inspect Video Properties

# Detailed JSON output
ffprobe -v quiet -print_format json -show_format -show_streams input.mp4

# Get resolution
ffprobe -v error -select_streams v:0 \
  -show_entries stream=width,height \
  -of csv=s=x:p=0 input.mp4

Image Information

# Basic info
identify image.jpg

# Detailed format
identify -verbose image.jpg

# Custom format
identify -format "%f: %wx%h %b\n" image.jpg

Performance Tips

  1. Use CRF for quality control - Better than bitrate for video
  2. Copy streams when possible - Avoid re-encoding with -c copy
  3. Hardware acceleration - GPU encoding 5-10x faster
  4. Appropriate presets - Balance speed vs compression
  5. Batch with mogrify - In-place image processing
  6. Strip metadata - Reduce file size with -strip
  7. Progressive JPEG - Better web loading with -interlace Plane
  8. Limit memory - Prevent crashes on large batches
  9. Test on samples - Verify settings before batch
  10. Parallel processing - Use GNU Parallel for multiple files

Reference Documentation

Detailed guides in references/:

  • ffmpeg-encoding.md - Video/audio codecs, quality optimization, hardware acceleration
  • ffmpeg-streaming.md - HLS/DASH, live streaming, adaptive bitrate
  • ffmpeg-filters.md - Video/audio filters, complex filtergraphs
  • imagemagick-editing.md - Format conversion, effects, transformations
  • imagemagick-batch.md - Batch processing, mogrify, parallel operations
  • format-compatibility.md - Format support, codec recommendations

Common Parameters

FFmpeg Video

  • -c:v - Video codec (libx264, libx265, libvpx-vp9)
  • -crf - Quality (0-51, lower=better, 23=default)
  • -preset - Speed/compression (ultrafast to veryslow)
  • -b:v - Video bitrate (e.g., 2M, 2500k)
  • -vf - Video filters

FFmpeg Audio

  • -c:a - Audio codec (aac, mp3, opus)
  • -b:a - Audio bitrate (e.g., 128k, 192k)
  • -ar - Sample rate (44100, 48000)

ImageMagick Geometry

  • 800x600 - Fit within (maintains aspect)
  • 800x600! - Force exact size
  • 800x600^ - Fill (may crop)
  • 800x - Width only
  • x600 - Height only
  • 50% - Scale percentage

Troubleshooting

FFmpeg "Unknown encoder"

# Check available encoders
ffmpeg -encoders | grep h264

# Install codec libraries
sudo apt-get install libx264-dev libx265-dev

ImageMagick "not authorized"

# Edit policy file
sudo nano /etc/ImageMagick-7/policy.xml
# Change <policy domain="coder" rights="none" pattern="PDF" />
# to <policy domain="coder" rights="read|write" pattern="PDF" />

Memory errors

# Limit memory usage
ffmpeg -threads 4 input.mp4 output.mp4
magick -limit memory 2GB -limit map 4GB input.jpg output.jpg

Resources

More by mrgoonie

View all →

chrome-devtools

mrgoonie

Browser automation, debugging, and performance analysis using Puppeteer CLI scripts. Use for automating browsers, taking screenshots, analyzing performance, monitoring network traffic, web scraping, form automation, and JavaScript debugging.

11018

sequential-thinking

mrgoonie

Use when complex problems require systematic step-by-step reasoning with ability to revise thoughts, branch into alternative approaches, or dynamically adjust scope. Ideal for multi-stage analysis, design planning, problem decomposition, or tasks with initially unclear scope.

11016

simplification-cascades

mrgoonie

Find one insight that eliminates multiple components - "if this is true, we don't need X, Y, or Z"

682

ai-multimodal

mrgoonie

Process and generate multimedia content using Google Gemini API. Capabilities include analyze audio files (transcription with timestamps, summarization, speech understanding, music/sound analysis up to 9.5 hours), understand images (captioning, object detection, OCR, visual Q&A, segmentation), process videos (scene detection, Q&A, temporal analysis, YouTube URLs, up to 6 hours), extract from documents (PDF tables, forms, charts, diagrams, multi-page), generate images (text-to-image, editing, composition, refinement). Use when working with audio/video files, analyzing images or screenshots, processing PDF documents, extracting structured data from media, creating images from text prompts, or implementing multimodal AI features. Supports multiple models (Gemini 2.5/2.0) with context windows up to 2M tokens.

942

ui-styling

mrgoonie

Create beautiful, accessible user interfaces with shadcn/ui components (built on Radix UI + Tailwind), Tailwind CSS utility-first styling, and canvas-based visual designs. Use when building user interfaces, implementing design systems, creating responsive layouts, adding accessible components (dialogs, dropdowns, forms, tables), customizing themes and colors, implementing dark mode, generating visual designs and posters, or establishing consistent styling patterns across applications.

971

meta-pattern-recognition

mrgoonie

Spot patterns appearing in 3+ domains to find universal principles

861

You might also like

flutter-development

aj-geddes

Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.

291790

drawio-diagrams-enhanced

jgtolentino

Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.

213415

godot

bfollington

This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.

213296

nano-banana-pro

garg-aayush

Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.

222234

ui-ux-pro-max

nextlevelbuilder

"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."

173201

rust-coding-skill

UtakataKyosui

Guides Claude in writing idiomatic, efficient, well-structured Rust code using proper data modeling, traits, impl organization, macros, and build-speed best practices.

166173

Stay ahead of the MCP ecosystem

Get weekly updates on new skills and servers.