Fat Files Compressor is a Python-based command-line tool for compressing various file types, including videos, audio, images, and PDFs. It uses popular tools like ffmpeg, pngquant, and ghostscript to reduce file sizes while maintaining configurable quality levels. Ideal for users who need to save disk space or optimize files for sharing.
- Supported Formats:
- Videos:
.mp4,.mkv,.avi,.mov - Audio:
.mp3,.aac,.wav,.flac - Images:
.jpg,.jpeg,.png,.webp,.gif - Documents:
.pdf
- Videos:
- Quality Presets:
- Fast and strong compression (lowest quality)
- Balanced (recommended)
- High quality (less compression)
- Automatic dependency checking with an option to install missing tools.
- Progress bar for batch compression using
tqdm. - Detailed output showing original size, compressed size, savings, and processing time.
- Logs errors to
compression.logfor debugging.
- Python 3.6 or higher
- Linux environment (Arch Linux recommended, but works on other distributions)
The script requires the following tools:
ffmpeg: For video, audio, JPEG, WebP, and GIF compression.pngquant: For PNG compression.ghostscript: For PDF compression.
Install them on Arch Linux:
sudo pacman -S ffmpeg pngquant ghostscript- Clone the repository:
git clone https://github.com/fast-archer/fat-files-compressor.git cd fat-files-compressor - Ensure the script is executable:
chmod +x fatfiles.py
Run the script from the command line:
./fatfiles.py- Enter the folder path containing files to compress.
- Choose to compress all files (
a) or a specific file by number (n). - Select a quality preset (1–3):
1: Fast and strong compression (lowest quality)2: Balanced (recommended)3: High quality (less compression)
- Compressed files are saved in a
compressedsubfolder.
$ ./fatfiles.py
Fat Files Compressor v1.0
Enter folder path: /home/user/Pictures/sw
Folder contents:
1. example.mp4
2. image.png
3. document.pdf
Compress (a) all files or (n) file number? a
Choose quality level:
1. Fast and strong compression (lowest quality)
2. Balanced (recommended)
3. High quality (less compression)
Your choice (1-3): 2
Compressing files: 100%|██████████████████████████| 3/3 [00:15<00:00, 5.00s/it]
Done! All compressed files are in the 'compressed' folder.- Large files (>100 MB) trigger a confirmation prompt to avoid long processing times.
- If a dependency is missing, the script prompts to install it via
pacman. - WebP compression uses
ffmpegwithlibwebpsupport. Ensure yourffmpegis compiled with WebP support (ffmpeg -h encoder=libwebp). - GIF compression may be slow for large files due to palette optimization.
Contributions are welcome! Feel free to open issues or submit pull requests for new features, bug fixes, or additional format support.
For discussions or suggestions, reach out:
- Email: epidermis_essential@proton.me
- Inktree: here
- Built with
ffmpeg,pngquant, andghostscript. - Inspired by the need to efficiently compress media and documents.
.png)