SuperAPI AI Directory

media-processor

Design & creation

View repository

Updated 10-15 19:56

About this skill

Media Processor

Task Objective

  • This Skill is used for: processing video and image files, performing format conversion, resolution adjustment, compression, and other operations
  • Capabilities include:
    • Video format conversion (MP4/AVI/MOV/MKV, etc.)
    • Video resolution adjustment and compression
    • Image format conversion (JPG/PNG/GIF/WebP, etc.)
    • Image resolution adjustment and compression
    • Batch processing support
  • Trigger condition: triggered when the user needs to process video or image files

Prerequisites

  • Dependency description: This Skill depends on the following system tools
    • FFmpeg: video processing tool
    • ImageMagick: image processing tool
  • System dependency installation: system dependencies will be automatically installed when the Skill is used for the first time
    apt-get update && apt-get install -y ffmpeg imagemagick
    

Operation Steps

Standard Process

  1. Requirements Analysis

    • Identify the input file type (video/image)
    • Determine the target format, resolution, and quality requirements
    • Assess whether batch processing is needed
  2. Choose Processing Method

    • Video processing: call scripts/ the video processing script in
    • Image processing: call scripts/ the image processing script in
  3. Execute Processing

    • For simple operations (such as a single format conversion): directly call the corresponding script
    • For complex operations (such as multi-step processing): the agent will call multiple scripts in combination
  4. Result Verification

    • Check whether the output file is generated
    • Verify whether the file format and parameters meet expectations

Common Operation Guide

Video Format Conversion

  • Call scripts/video_convert.py
  • Parameters: input_path (input path), output_path (output path), output_format (target format)
  • Example: Convert AVI to MP4

Video Compression

  • Call scripts/video_compress.py
  • Parameters: input_path, output_path, bitrate (target bitrate), crf (quality control factor)
  • Example: Compress video to 2Mbps

Video Resolution Adjustment

  • Call scripts/video_scale.py
  • Parameters: input_path, output_path, width, height
  • Example: Adjust to 1920x1080

Image Format Conversion

  • Call scripts/image_convert.py
  • Parameters: input_path, output_path, output_format, quality
  • Example: Convert PNG to JPG

Image Scaling

  • Call scripts/image_scale.py
  • Parameters: input_path, output_path, width, height, maintain_aspect
  • Example: Scale proportionally to 1024x768

Image Compression

  • Call scripts/image_compress.py
  • Parameters: input_path, output_path, quality, method (compression method)
  • Example: Set quality to 85%

Batch Processing

  • When multiple files need to be processed, the agent will call the corresponding scripts in a loop
  • Use wildcard patterns to match files (such as *.avi、images/*.png)
  • Generate the corresponding output path for each file

Resource Index

Notes

  • Make sure the input file path is correct, use a relative path (./ prefix)
  • The output path must include the complete file name and extension
  • Quality parameter ranges: image quality 1-100, video CRF 18-28 (the smaller the value, the higher the quality)
  • Please be patient when processing large files; the agent will continuously monitor the execution status
  • If custom parameters are needed (such as codec, frame rate, etc.), please refer to the corresponding reference documentation

Usage examples

Example 1: Video format conversion

# 将 video.avi 转换为 video.mp4
python scripts/video_convert.py \
  --input ./video.avi \
  --output ./video.mp4 \
  --format mp4

Example 2: Batch image conversion

# 将所有 PNG 转换为 JPG
for file in ./images/*.png; do
  output="${file%.png}.jpg"
  python scripts/image_convert.py \
    --input "$file" \
    --output "$output" \
    --format jpg \
    --quality 85
done

Example 3: Video compression and scaling

# 先缩放再压缩
python scripts/video_scale.py \
  --input ./input.mp4 \
  --output ./temp.mp4 \
  --width 1280 \
  --height 720

python scripts/video_compress.py \
  --input ./temp.mp4 \
  --output ./output.mp4 \
  --bitrate 2M