Last active
June 25, 2025 05:22
-
-
Save mikemcbride/535e0da688bc8ebaab34af3a1e507ea6 to your computer and use it in GitHub Desktop.
Compress Video Files
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
# This script will loop through all files in the current directory and its subdirectories, | |
# and then will use ffmpeg to compress them using the H.265 codec. | |
# It will output the compressed files to a new directory called "optimized". | |
# This will retain the original directory structure, which is ideal for modifying video libraries like Plex. | |
for f in **/*; | |
if test -d $f; | |
mkdir -p optimized/$f; | |
else if test -f $f; | |
ffmpeg -i $f -vcodec libx265 -c:a copy -crf 28 -tag:v hvc1 optimized/$f; | |
end; | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment