3 releases
Uses new Rust 2024
| 0.1.2 | Oct 6, 2025 |
|---|---|
| 0.1.1 | Oct 6, 2025 |
| 0.1.0 | Sep 14, 2025 |
#196 in Command line utilities
309 downloads per month
130KB
3K
SLoC
CompressCLI
A powerful FFmpeg wrapper CLI built in Rust. Simplifies complex video and image compression and provides batch processing capabilities.
Features
- 🎥 Video Compression: Support for H.264, H.265, VP9, and AV1 codecs
- 🖼️ Image Compression: JPEG, PNG, WebP optimization with quality control
- 📦 Batch Processing: Process entire directories with parallel execution
- ⚡ Performance: Multi-threaded processing with progress tracking
- 🎛️ Presets: Built-in quality presets (ultrafast, fast, medium, slow, veryslow)
- 🔧 Customizable: Extensive command-line options and configuration files
- 📊 Progress Tracking: Real-time progress bars and compression statistics
- 🔍 Dry Run: Preview operations without modifying files
Installation
Install from Cargo
cargo install compresscli
Prebuilt Binaries (Recommended)
Download from GitHub Releases:
- Windows: Download and run the MSI installer
- Linux: Download tarball, extract, and run
./install.sh - macOS: Download tarball, extract, and run
./install.sh
Build from Source
git clone https://github.com/amitxd75/compresscli.git
cd compresscli
cargo build --release
Prerequisites
- FFmpeg: Required for video compression
- Ubuntu/Debian:
sudo apt install ffmpeg - macOS:
brew install ffmpeg - Windows: Download from ffmpeg.org
- Ubuntu/Debian:
Shell Autocompletion
Only for linux Tab completion for Bash, Zsh, Fish, and PowerShell:
./scripts/setup-completions.sh
Quick Start
# Video compression
compresscli video input.mp4 --preset medium
compresscli video input.mp4 --codec h265 --crf 20
# Image compression
compresscli image photo.jpg --preset web
compresscli image photo.png --format webp --quality 80
# Batch processing
compresscli batch ./videos --videos --preset medium --recursive
compresscli batch ./photos --images --preset web
Command Reference
Video Options
| Option | Description | Example |
|---|---|---|
--preset |
Compression preset | fast, medium, slow |
--codec |
Video codec | h264, h265, vp9, av1 |
--crf |
Constant Rate Factor (0-51) | --crf 23 |
--bitrate |
Target bitrate | --bitrate 2M |
--resolution |
Target resolution | --resolution 1920x1080 |
--fps |
Target framerate | --fps 30 |
--audio-codec |
Audio codec | aac, mp3, opus |
--no-audio |
Remove audio track | |
--start |
Start time for trimming | --start 00:01:30 |
--end |
End time for trimming | --end 00:05:00 |
--two-pass |
Enable two-pass encoding |
Image Options
| Option | Description | Example |
|---|---|---|
--preset |
Image preset | web, high, lossless |
--quality |
Image quality (1-100) | --quality 85 |
--format |
Output format | jpeg, png, webp |
--resize |
Resize to dimensions | --resize 1920x1080 |
--max-width |
Maximum width | --max-width 1920 |
--max-height |
Maximum height | --max-height 1080 |
--optimize |
Enable optimization | |
--progressive |
Progressive JPEG | |
--lossless |
Lossless compression |
Global Options
| Option | Description |
|---|---|
--output-dir |
Output directory |
--overwrite |
Overwrite existing files |
--dry-run |
Preview without executing |
--verbose |
Verbose output |
--jobs |
Parallel jobs (batch mode) |
Other Commands
| Command | Description |
|---|---|
info |
Show system information and dependencies |
presets list |
List all available presets |
presets show <name> |
Show details of a specific preset |
completions <shell> |
Generate shell completion scripts |
Configuration
CompressCLI uses YAML configuration files located at:
- Linux:
~/.config/compresscli/config.yaml - macOS:
~/Library/Application Support/compresscli/config.yaml - Windows:
%APPDATA%\compresscli\config.yaml
Example Configuration
video_presets:
custom_high:
codec: H265
crf: 18
audio_codec: Aac
audio_bitrate: "256k"
preset: "slow"
two_pass: true
extra_args: []
image_presets:
web_optimized:
quality: 85
optimize: true
progressive: true
lossless: false
default_settings:
parallel_jobs: 4
preserve_metadata: true
backup_originals: false
Presets
Video Presets
- ultrafast: Fastest compression, larger files (CRF 28)
- fast: Fast compression, good for quick processing (CRF 25)
- medium: Balanced quality and speed (CRF 23) - Default
- slow: Better compression, smaller files (CRF 20)
- veryslow: Best compression, H.265 codec (CRF 18)
Image Presets
- web: Optimized for web use (Quality 85)
- high: High quality (Quality 95)
- lossless: Maximum quality (Quality 100)
Usage Tips
- Use
--presetfor quick compression:fast,medium,slow - Use
--dry-runto preview operations - Use
--jobs Nfor parallel processing - Use
compresscli infoto check FFmpeg installation
Troubleshooting
FFmpeg not found: Install with sudo apt install ffmpeg (Linux) or brew install ffmpeg (macOS)
Permission errors: Use --overwrite or --output-dir ./output
Memory issues: Reduce --jobs or use faster presets
Contributing
- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Make your changes and add tests
- Run tests:
cargo test - Submit a pull request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
Dependencies
~25MB
~469K SLoC