Created
December 24, 2018 05:46
-
-
Save johnnyopao/e3a372f666dab2ac60790e4308a731f9 to your computer and use it in GitHub Desktop.
ffmpeg - Convert videos to smaller scale. Clean up filenames. Backup original
This file contains 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
for vid in */*.mp4 | |
do | |
new_file_name=$(echo $vid | awk '{ gsub(/ /, "-"); gsub(/[&|\+|{|}]/, ""); gsub(/-+/, "-"); gsub(/-_-/, "-"); gsub(/(-[0-9]{3,})/, "") }; 1') | |
ffmpeg -i "./$vid" -filter:v "scale=w=800:h=-1" "./${new_file_name}" | |
backup_dir="./backup/$(dirname "$vid")" | |
mkdir -p $backup_dir && cp "./$vid" $backup_dir | |
rm "./${vid}" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment