Skip to content

byteoxo/crunch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

20 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ¦€ Crunch

A easiest, blazingly fast, parallel media compression tool for normal people

Crates.io License Build Status Downloads

Installation β€’ Usage β€’ Examples β€’ Configuration β€’ Contributing


✨ Features

  • πŸš€ Blazingly Fast β€” Parallel & concurrent processing utilizing all CPU cores
  • 🎬 Video Compression β€” H.265/HEVC, VP9, AV1 encoding with optimal settings
  • πŸ–ΌοΈ Image Compression β€” WebP, AVIF, optimized JPEG/PNG output
  • 🎡 Audio Compression β€” Opus, AAC, MP3 with configurable bitrates
  • πŸ“ Batch Processing β€” Compress entire directories with one command
  • πŸ”„ Recursive Mode β€” Process nested subdirectories
  • πŸ“Š Progress Display β€” Real-time progress bars and statistics
  • βš™οΈ Highly Configurable β€” Fine-tune quality, format, and performance
  • πŸ›‘οΈ Safe Defaults β€” Sensible presets that just work

πŸ“¦ Installation

No external FFmpeg installation required β€” Crunch includes embedded FFmpeg binaries!

Step 1: Download

Download the appropriate binary for your platform from the Releases page:

Platform File
macOS (Intel) crunch-macos.zip
macOS (Apple Silicon) crunch-macos.zip
Linux (x64) crunch-linux.zip
Windows (x64) crunch-windows.zip

Step 2: Add to PATH

macOS / Linux

# Move the binary to a directory in your PATH
chmod +x crunch
sudo mv crunch /usr/local/bin/crunch

# Or add to your user bin directory
mkdir -p ~/.local/bin
mv crunch-* ~/.local/bin/crunch
chmod +x ~/.local/bin/crunch

# Add to PATH (add this line to ~/.bashrc or ~/.zshrc)
export PATH="$HOME/.local/bin:$PATH"

Windows

  1. Create a directory for the binary, e.g., C:\Program Files\crunch\
  2. Move crunch.exe to that directory and rename it to crunch.exe
  3. Add the directory to your system PATH:
    • Open Settings β†’ System β†’ About β†’ Advanced system settings
    • Click Environment Variables
    • Under System variables, find and select Path, then click Edit
    • Click New and add C:\Program Files\crunch\
    • Click OK to save

Step 3: Verify Installation

crunch --version
crunch --help

πŸš€ Usage

Quick Start

# Compress all media with default settings
crunch --default

# Compress only videos
crunch --videos

# Compress videos and images with specific formats
crunch --videos=mp4 --images=avif

# Specify compression directories
crunch --default --input=./media-folder/

Command Line Options

Usage: crunch [OPTIONS]

Options:
      --default
          Use default settings (videos=webm, images=webp)

  -p, --path [<PATH>]
          Path to process (default: current directory)

      --level [<LEVEL>]
          Compress leve

      --prefix [<PREFIX>]


      --videos [<VIDEOS>]
          Video format. Use --videos for default(webm) or --videos=FORMAT

      --images [<IMAGES>]
          Image format. Use --images for default(webp) or --images=FORMAT

      --audios [<AUDIOS>]
          Audios format. Use --audios for default(webp) or --audios=FORMAT

  -h, --help
          Print help (see a summary with '-h')

  -V, --version
          Print version

EXAMPLES:
    crunch --default                     Compress all media with default formats (video: webm, image: webp, audio: mp3)
    crunch --videos                      Compress videos only (default: webm)
    crunch --videos=webm                 Compress videos to webm
    crunch --images=webp                 Compress images to webp
    crunch --audio=mp3                   Compress audios to mp3

SUPPORTED FORMATS:
    Videos: webm, mp4, mkv, av1, etc.
    Images: webp, avif, jpg, png, etc.
    Audio:  opus, mp3, aac, flac, etc.

πŸ“– Examples

Basic Usage

# Compress all videos in current directory to WebM
crunch --videos

# Compress with maximum quality
crunch --videos --level=low

# Fast compression with lower quality
crunch --videos --level=high

# Full compression pipeline with custom settings
crunch \
  --videos=mp4 \
  --images=avif \
  --audio=opus \

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                         Crunch                               β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚   Scanner    β”‚   Scheduler  β”‚   Workers    β”‚   Reporter     β”‚
β”‚              β”‚              β”‚              β”‚                β”‚
β”‚  - Walk dirs β”‚  - Job queue β”‚  - FFmpeg    β”‚  - Progress    β”‚
β”‚  - Filter    β”‚  - Priority  β”‚  - Parallel  β”‚  - Statistics  β”‚
β”‚  - Classify  β”‚  - Balance   β”‚  - Async I/O β”‚  - Errors      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β”‚
                              β–Ό
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚     FFmpeg       β”‚
                    β”‚  (subprocess)    β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Development Setup

# Clone the repository
git clone https://github.com/yourname/crunch.git
cd crunch

# Install development dependencies
cargo build

# Run with debug output
RUST_LOG=debug cargo run -- --default

# Format code
cargo fmt

# Lint
cargo clippy

Commit Convention

We use Conventional Commits:

feat: add AV1 encoding support
fix: handle spaces in filenames
docs: update installation instructions
perf: optimize parallel job scheduling
refactor: split video module
test: add compression quality tests

Roadmap

  • GPU acceleration (NVENC, VideoToolbox)
  • Watch mode (auto-compress new files)
  • Web UI dashboard
  • Cloud storage integration (S3, GCS)
  • Custom FFmpeg preset files

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ™ Acknowledgments

  • FFmpeg β€” The powerhouse behind all media processing
  • Rayon β€” Data parallelism library for Rust
  • Clap β€” Command line argument parser
  • Indicatif β€” Progress bar library

If you find Crunch useful, please consider giving it a ⭐

Made with πŸ¦€ and ❀️

About

A easiest, blazingly fast parallel media compression tool for normal people

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages