| compress.sh | ||
| README.md | ||
🧰 FFmpeg Batch Compressor
A simple shell script for Linux that batch-compresses video files using FFmpeg (H.265 / HEVC).
It automatically skips videos that are already compressed or re-encodes broken/incomplete ones.
✨ Features
- Compresses MKV, MP4, AVI, MOV, FLV, WEBM, WMV, TS and more.
- Keeps subtitles, audio, and metadata intact.
- Automatically skips completed files.
- Re-encodes files if they're broken, too small, or have mismatched duration.
- Creates a
compressed/folder automatically. - Tested and confirmed working on Arch-based distros (e.g. CachyOS, Arch Linux, Manjaro).
🧩 Requirements
-
🐧 Linux (preferably Arch-based systems)
-
🧠 Shell: Bash (works in Konsole, Fish, or any standard terminal)
-
⚙️ Packages:
sudo pacman -S ffmpeg -
(Optional)
chmodpermission to make it executable.
🚀 Installation & Usage
1. Clone or copy the repository
git clone https://your-repo-link.git
cd ffmpeg-batch-compressor
2. Make the script executable
chmod +x compress.sh
3. Run it in a folder containing your video files
./compress.sh
By default, it creates a compressed/ folder inside the current directory
and saves all processed videos there.
🧠 Optional: Run on another folder
You can also run the script on a specific path:
/path/to/compress.sh /path/to/videos
(requires a small edit in the script — or simply cd into that folder first)
⚙️ Output Info
- Video codec:
libx265(H.265 / HEVC) - Audio codec:
AAC(96 kbps) - Quality: CRF 24, preset
medium - Expected reduction: 60-80% smaller with near-lossless quality
💡 Example
If your folder looks like this:
/home/user/Anime/
├── Episode01.mkv
├── Episode02.mp4
└── compress.sh
After running ./compress.sh, you'll get:
/home/user/Anime/compressed/
├── Episode01.mkv
└── Episode02.mp4
🎚 Recommended CRF Values
21→ Higher quality, slightly larger size23-24→ Balanced (default)26-28→ Smaller size, minor quality loss
🧾 License
MIT License — free to use, modify, and share.
👩💻 Author
SarahQT — built for easy, reliable video compression on Arch-based Linux systems.