Batch Video Transcoder is a CLI tool for GPU-accelerated transcoding of a large number of Video files to reduce the size, while ensuring preservation of video quality. It uses FFmpeg to transcode the Video files and VMAF to analyze the output quality. If the desired quality threshold has not been met, the Video will be transcoded again.
Transcode a single file and keep the result in the out directory:
python batch-video-transcoder.py -i .\test-file.mp4 -o .\outTranscode multiple files from the in directory and keep the results in the out directory:
python batch-video-transcoder.py -i .\in\* -t 14 --vmaf-workers 2 -cq 38 -q 95 -o .\outGet help:
python batch-video-transcoder.py --helpHelp command:
usage: batch-video-transcoder.py [-h] [-i INPUT [INPUT ...]] [-o OUTPUT] [-cq [0 - 50]] [-q [0 - 100]] [-v] [-t THREADS] [--transcode-workers TRANSCODE_WORKERS] [--vmaf-workers VMAF_WORKERS]
options:
-h, --help show this help message and exit
-i INPUT [INPUT ...], --input INPUT [INPUT ...]
input file path (default: None)
-o OUTPUT, --output OUTPUT
output directory path (default: ./out)
-cq [0 - 50], --init-cq [0 - 50]
initial constant quality (cq) value to transcode with, decreases by 2 on every step (default: 40)
-q [0 - 100], --quality-treshold [0 - 100]
the quality level, below which the file will be transcoded again with higher cq (default: 95)
-v, --verbose
-t THREADS, --threads THREADS
number of threads to video transcodecompute on (default: 14)
--transcode-workers TRANSCODE_WORKERS
number of paralel workers to transcode on (default: 1)
--vmaf-workers VMAF_WORKERS
number of paralel workers to compute vmaf on (default: 1)
You don't need to install, just download or clone the repo. If the requirements below are met, you should be able to run the batch-video-transcoder.py directly.
- Python >= 3.10 (I think, developed and tested on 3.12)
- Nvidia GPU with
hevc_nvenc ffmpegcompiled withvmafin thePATHenvironmental variable
Tested on Windows 11, but I don't see a reason why it shouldn't work on Linux
I used gyan.dev Windows build available through winget, which is recommended on the FFmpeg download page and is compiled with VMAF.
winget install Gyan.FFmpegGNU General Public License v3.0 or later
See LICENSE to see full text