media-compress
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 common formats like JPG, PNG, WebP, MP4, MOV, WebM. Triggers on phrases like "compress image", "compress video", "reduce file size", "convert to webp/mp4", "resize image", "make image smaller", "batch compress", "optimize media".
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/1987566643/media-compressMedia Compression Skill
Compress and convert images and videos with intelligent defaults. Supports single files and batch processing.
Supported Formats
Images: JPG, PNG, WebP, BMP, TIFF, GIF → JPG, PNG, WebP Videos: MP4, MOV, AVI, MKV, WebM, FLV, WMV, M4V → MP4
Prerequisites
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
Quick Start
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
Common Use Cases
1. Upload to Website (Image)
Most websites need images under 500KB:
python scripts/compress_image.py photo.jpg --max-size 500kb --format webp
2. Email Attachment (Image)
Email often has 25MB limit:
python scripts/compress_image.py scan.pdf.jpg --max-size 5mb --quality 90
3. Social Media Video
Platforms prefer 720p, smaller files:
python scripts/compress_video.py clip.mov --height 720 --crf 23 --preset fast
4. Archive Old Videos
Maximum compression for storage:
python scripts/compress_video.py old_video.avi --crf 28 --preset slow --height 480
5. Convert Format Only
Keep quality, just change format:
# Image
python scripts/compress_image.py image.png --format jpg --quality 95
# Video
python scripts/compress_video.py video.mov --output video.mp4 --crf 18
Parameters Reference
Image (compress_image.py)
Metadata
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skillPaste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-1987566643-media-compress": {
"enabled": true,
"auto_update": true
}
}
}