🎁 Get the FREE AI Skills Starter Guide β€” Subscribe β†’
BytesAgainBytesAgain
πŸ¦€ ClawHub

Media Compress

by @1987566643

Compress and convert images and videos using ffmpeg. Use when the user wants to reduce file size, change format, resize, or optimize media files. Handles com...

Versionv1.1.0
πŸ’‘ Examples

Image Compression

# Compress to target size (auto-adjusts quality)
python scripts/compress_image.py photo.jpg --max-size 200kb

Resize + compress

python scripts/compress_image.py photo.png --width 800 --output photo_small.jpg

Convert to WebP (better compression)

python scripts/compress_image.py photo.jpg --format webp

Batch compress entire folder

python scripts/compress_image.py ./photos --output ./compressed --quality 80

Preview mode - see what will happen without compressing

python scripts/compress_image.py photo.jpg --max-size 500kb --preview

Keep backup of original file

python scripts/compress_image.py photo.jpg --max-size 500kb --backup

Video Compression

# Compress with default settings (good balance)
python scripts/compress_video.py video.mp4 --output video_small.mp4

Resize to 720p

python scripts/compress_video.py video.mp4 --height 720

Target specific file size (approximate)

python scripts/compress_video.py video.mp4 --target-size 50mb

Lower quality for smaller file

python scripts/compress_video.py video.mp4 --crf 28

Batch process all videos in folder

python scripts/compress_video.py ./videos --output ./compressed --height 480

Preview mode - see what will happen without compressing

python scripts/compress_video.py video.mp4 --height 720 --preview

Keep backup of original file

python scripts/compress_video.py video.mp4 --height 720 --backup

βš™οΈ Configuration

ffmpeg must be installed:

  • Ubuntu/Debian: sudo apt update && sudo apt install ffmpeg
  • macOS: brew install ffmpeg
  • Windows: Download from https://ffmpeg.org/download.html and add to PATH
  • Verify installation: ffmpeg -version

    πŸ“‹ Tips & Best Practices

    "ffmpeg not found"

    Install ffmpeg first:
    # Ubuntu/Debian
    sudo apt update && sudo apt install ffmpeg

    macOS

    brew install ffmpeg

    "Permission denied"

    Make scripts executable:
    chmod +x scripts/*.py
    

    Quality too low

    Increase quality setting:
    # Image
    python scripts/compress_image.py photo.jpg --quality 90

    Video

    python scripts/compress_video.py video.mp4 --crf 20

    File not smaller

  • Try lower quality or smaller dimensions
  • Some files are already optimally compressed
  • Use --max-size to force target size
  • Batch processing stops

    Check that all files in directory are valid images/videos. Corrupt files may cause errors.

    View on ClawHub
    TERMINAL
    clawhub install media-compress

    πŸ§ͺ Use this skill with your agent

    Most visitors already have an agent. Pick your environment, install or copy the workflow, then run the smoke-test prompt above.

    πŸ” Can't find the right skill?

    Search 60,000+ AI agent skills β€” free, no login needed.

    Search Skills β†’