返回 Skill 列表
extension
分类: 内容与媒体无需 API Key

media-processing

使用FFmpeg(视频/音频编码、转换、流媒体、过滤、硬件加速)、ImageMagick(图像处理、格式转换、批量处理、效果、合成)和RMBG(基于AI的背景移除)处理多媒体文件。当需要转换媒体格式、使用特定编解码器(如H.264、H.265、VP9)编码视频、调整/裁剪图片大小、从图片中移除背景、从视频中提取音频、应用滤镜和效果、优化文件大小、创建流媒体清单(如HLS/DASH)、生成缩略图、批量处理图片、创建合成图片或实现媒体处理流水线时使用。支持100多种格式,硬件加速(如NVENC、QSV),以及复杂的滤镜图。

person作者: jakexiaohubgithub

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

# 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

# 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