Skip to content

Instantly share code, notes, and snippets.

@cultab
Created May 6, 2025 00:24
Show Gist options
  • Save cultab/62df41830460856c0c86a1a1ce5d555e to your computer and use it in GitHub Desktop.
Save cultab/62df41830460856c0c86a1a1ce5d555e to your computer and use it in GitHub Desktop.
reencode videos to save space
#!/bin/sh
mkdir -p converted
for folder in ./Shadowplay/*/; do
echo FOLDER: $folder
for file in "${folder}"*; do
printf "\tFILE: %s" $file
file=$(basename "$file")
name=${file%.*}
printf "\tNAME: %s" $file
if [ -f ./converted/"${name}.mp4" ]; then
printf "\tskipping..."
continue
fi
ffmpeg -i "${folder}${file}" -vf "scale=-1:'min(720, ih)'" -vcodec libx265 -crf 28 ./converted/"${name}.mp4"
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment