
If you’ve ever tried to convert a large library of video files on Linux, you know the struggle. CPU encoding (like standard x264 or x265) provides great quality but can take hours—or even days—to finish a batch.
If you have an AMD GPU, you are sitting on a goldmine of untapped power. Today, I’m sharing a powerful shell script designed to squeeze every bit of performance out of your AMD hardware using VA-API and AMF acceleration.
Why Use This Script?
While FFmpeg is the industry standard, its command-line arguments can be intimidating and hardware-specific. This script acts as a “smart wrapper” that handles the complexity for you.
Key Features:
- Hardware Optimized: Automatically detects your AMD architecture (Polaris, Vega, RDNA 1/2/3) and applies the best settings.
- AV1 Support: Ready for the latest RDNA 3 cards (RX 7000 series) for cutting-edge compression.
- Smart B-Frames: Automatically manages B-frame settings per architecture to prevent crashes and ensure stability.
- Zero-Copy Pipeline: Uses a high-efficiency hardware pipeline to minimize CPU overhead.
- Batch Processing: Convert a single file, a specific list, or an entire folder in one go.
How to Get Started
1. Installation
First, make sure the script is executable. Open your terminal and run:
wget https://github.com/waelisa/ffmpeg-Batch-convert/raw/refs/heads/main/ffmpeg-Batch-convert.sh
chmod +x ffmpeg-Batch-convert.sh
The script can even help you install the necessary tools (ffmpeg, vainfo, etc.) automatically:
./ffmpeg-Batch-convert.sh --install-deps
2. Basic Usage
The syntax is designed to be “human-readable.” To convert all from files in a folder to what you want, simply run:
./ffmpeg-Batch-convert.sh *.mkv to mp4
./ffmpeg-Batch-convert.sh *.mp4 to mkv
or anything you want
3. Choosing Your Quality
You don’t need to remember complex bitrates. Use built-in presets:
- Max Quality:
./ffmpeg-Batch-convert.sh video.mkv -p maxquality to mp4 - High Compression: Great for saving space on mobile devices.
- Balanced: The perfect middle ground (Default).
Advanced Power User Tips
Target File Size
Need to fit a video onto a specific USB drive or send it via a chat app? Tell the script exactly how big the output should be:
Bash
./ffmpeg-Batch-convert.sh movie.mkv --target-size 500M to mp4
Maintain Folder Structure
If you are converting a complex library with many subfolders, use the --keep-tree flag. This will recreate your original folder structure inside the output directory so you don’t lose your organization.
Dry Run
Not sure what the script will do? Use --dry-run to see the exact FFmpeg commands that would be executed without actually starting the conversion.
Conclusion
Stop letting your GPU sit idle. Whether you’re archiving old footage, preparing videos for a Emby server, or shrinking files for your phone, this script makes AMD hardware encoding on Linux easier than ever.
Check out the project on GitHub: https://github.com/waelisa/ffmpeg-Batch-convert
Happy Encoding!