Created
September 30, 2025 08:41
-
-
Save kevin-miles/14bc8d5d28d083fdf174a56a5cf69f6f to your computer and use it in GitHub Desktop.
FFMPEG Batch Compress Parallel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# A script to batch-compress MP4 files in parallel using GNU Parallel | |
# Create a directory for the output files if it doesn't exist | |
mkdir -p compressed | |
echo "Starting parallel processing..." | |
# Find all .mp4 files and pipe them to GNU Parallel to run ffmpeg jobs simultaneously | |
# --bar shows a progress bar | |
# {} is the placeholder for the input file (e.g., video.mp4) | |
# {/.} is the placeholder for the basename of the file without its extension (e.g., video) | |
find . -maxdepth 1 -name "*.mp4" | parallel --bar ffmpeg -n -i {} \ | |
-c:v libx264 \ | |
-crf 28 \ | |
-preset medium \ | |
-c:a aac \ | |
-b:a 128k \ | |
"compressed/{/.}_compressed.mp4" | |
echo "Batch processing complete." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment