home / skills / dmdorta1111 / jac-v1 / media-processing

media-processing skill

/.claude/skills/media-processing

This skill streamlines media processing by using FFmpeg, ImageMagick, and RMBG to encode, convert, resize, remove backgrounds, and generate thumbnails.

npx playbooks add skill dmdorta1111/jac-v1 --skill media-processing

Review the files below or copy the command above to add this skill to your agents.

Files (23)
SKILL.md
3.2 KB
---
name: media-processing
description: Process multimedia files with FFmpeg (video/audio encoding, conversion, streaming, filtering, hardware acceleration), ImageMagick (image manipulation, format conversion, batch processing, effects, composition), and RMBG (AI-powered background removal). Use when converting media formats, encoding videos with specific codecs (H.264, H.265, VP9), resizing/cropping images, removing backgrounds from 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.
license: MIT
---

# Media Processing Skill

Process video, audio, and images using FFmpeg, ImageMagick, and RMBG CLI tools.

## Tool Selection

| Task | Tool | Reason |
|------|------|--------|
| Video encoding/conversion | FFmpeg | Native codec support, streaming |
| Audio extraction/conversion | FFmpeg | Direct stream manipulation |
| Image resize/effects | ImageMagick | Optimized for still images |
| Background removal | RMBG | AI-powered, local processing |
| Batch images | ImageMagick | mogrify for in-place edits |
| Video thumbnails | FFmpeg | Frame extraction built-in |
| GIF creation | FFmpeg/ImageMagick | FFmpeg for video, ImageMagick for images |

## Installation

```bash
# macOS
brew install ffmpeg imagemagick
npm install -g rmbg-cli

# Ubuntu/Debian
sudo apt-get install ffmpeg imagemagick
npm install -g rmbg-cli

# Verify
ffmpeg -version && magick -version && rmbg --version
```

## Essential Commands

```bash
# Video: Convert/re-encode
ffmpeg -i input.mkv -c copy output.mp4
ffmpeg -i input.avi -c:v libx264 -crf 22 -c:a aac output.mp4

# Video: Extract audio
ffmpeg -i video.mp4 -vn -c:a copy audio.m4a

# Image: Convert/resize
magick input.png output.jpg
magick input.jpg -resize 800x600 output.jpg

# Image: Batch resize
mogrify -resize 800x -quality 85 *.jpg

# Background removal
rmbg input.jpg                          # Basic (modnet)
rmbg input.jpg -m briaai -o output.png  # High quality
rmbg input.jpg -m u2netp -o output.png  # Fast
```

## Key Parameters

**FFmpeg:**
- `-c:v libx264` - H.264 codec
- `-crf 22` - Quality (0-51, lower=better)
- `-preset slow` - Speed/compression balance
- `-c:a aac` - Audio codec

**ImageMagick:**
- `800x600` - Fit within (maintains aspect)
- `800x600^` - Fill (may crop)
- `-quality 85` - JPEG quality
- `-strip` - Remove metadata

**RMBG:**
- `-m briaai` - High quality model
- `-m u2netp` - Fast model
- `-r 4096` - Max resolution

## References

Detailed guides in `references/`:
- `ffmpeg-encoding.md` - Codecs, quality, hardware acceleration
- `ffmpeg-streaming.md` - HLS/DASH, live streaming
- `ffmpeg-filters.md` - Filters, complex filtergraphs
- `imagemagick-editing.md` - Effects, transformations
- `imagemagick-batch.md` - Batch processing, parallel ops
- `rmbg-background-removal.md` - AI models, CLI usage
- `common-workflows.md` - Video optimization, responsive images, GIF creation
- `troubleshooting.md` - Error fixes, performance tips
- `format-compatibility.md` - Format support, codec recommendations

Overview

This skill processes video, audio, and images using FFmpeg, ImageMagick, and RMBG to handle encoding, conversion, filtering, and AI background removal. It supports hardware acceleration (NVENC, QSV), 100+ formats, complex filtergraphs, batch operations, and streaming manifest generation. Use it to optimize media for web, mobile, or streaming workflows and automate repetitive image/video tasks.

How this skill works

The skill invokes FFmpeg for video/audio tasks: re-encoding, codec selection (H.264, H.265, VP9), extracting audio, generating HLS/DASH manifests, and applying filtergraphs. ImageMagick handles still-image tasks like resizing, format conversion, effects, and batch processing via mogrify. RMBG runs local AI background removal with selectable models (briaai, u2netp) and resolution control for high-quality cutouts.

When to use it

  • Converting or re-encoding videos to target codecs and bitrates for web or mobile delivery
  • Creating streaming outputs (HLS/DASH) or generating multi-bitrate manifests
  • Extracting audio tracks, normalizing or converting audio formats
  • Resizing, cropping, composing, or batch-processing large sets of images
  • Removing image backgrounds for product photos, composites, or thumbnails

Best practices

  • Use hardware acceleration (NVENC/QSV) when available to speed up large encodes and reduce CPU load
  • Choose CRF + preset for predictable quality/size tradeoffs (e.g., -crf 22 -preset slow for H.264)
  • Batch-process images with mogrify and keep originals backed up to avoid accidental data loss
  • Strip metadata (-strip) and set JPEG quality (e.g., -quality 85) to reduce file size for web delivery
  • Select RMBG model by need: briaai for high quality, u2netp for speed; cap resolution for performance

Example use cases

  • Re-encode a camera .mov to H.264 MP4 with AAC audio and generate HLS renditions for streaming
  • Create responsive image sets by batch-resizing photos to multiple widths and stripping EXIF metadata
  • Remove backgrounds from product images using RMBG and composite them into a catalog layout
  • Extract podcast audio from recorded video files and normalize levels before publishing
  • Generate thumbnails and animated GIF previews from videos using FFmpeg filtergraphs

FAQ

How do I speed up large video encodes?

Enable hardware acceleration (NVENC or QSV) if your GPU supports it and use an appropriate preset to balance speed and quality.

Which RMBG model should I pick?

Use briaai for the best-quality background removal, u2netp for faster processing when throughput matters.