Compress images, gifs, video, and audio to a target file size using ffmpeg.
Project description
cli-compress
Compress images, gifs, video, and audio to a target file size with ffmpeg.
Requirements
- Python 3.8+
- ffmpeg + ffprobe on PATH
- macOS:
brew install ffmpeg - Linux:
sudo apt install ffmpeg - Windows:
winget install ffmpeg
- macOS:
Install
pip install -e .
This gives you a compress command on Windows, Linux, and macOS.
Usage
compress input.mp4 -s 10mb
compress photo.png -s 200kb
compress meme.gif -s 3mb
compress song.wav -s 5mb
compress video.mov -s 1gb -o out.mp4
-s/--sizeacceptskb,mb,gb(alsokib/mib/gib, same thing) or a raw byte count.-o/--outputis optional; defaults to<name>_compressed.<ext>.- Lossless audio (
.wav,.flac) can't be bitrate-targeted, so it's re-encoded to.mp3by default. .pnghas no useful quality knob for size targeting, so it's re-encoded to.jpgby default.
Video and audio use bitrate math against the clip's duration. Images and gifs iteratively shrink resolution (and fps, for gifs) until they fit.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cli_compress-0.1.0.tar.gz.
File metadata
- Download URL: cli_compress-0.1.0.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
178f8d17620de04eb0d8913f038a5c65297da6ae04be1d4837e12f2a72ed0178
|
|
| MD5 |
0edae8d806919c862a1d79aa24f9a5d1
|
|
| BLAKE2b-256 |
5d6a6916e1c6be6ed4877cf86bb27726eacf3b33a15fc02ec05d6512bdce731b
|
File details
Details for the file cli_compress-0.1.0-py3-none-any.whl.
File metadata
- Download URL: cli_compress-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
90df987b622c72c3f12a4d894d80b072ab608960a0cc2cc729b566a11e2e23f6
|
|
| MD5 |
a1973253042ddd69f7c0ebe06c133fbe
|
|
| BLAKE2b-256 |
1c87b0e1c3c931f44f1dab4174136eedfaeb1d1fb7cab6f640ee0e8617e360ad
|