Skip to content

Instantly share code, notes, and snippets.

@ctroncoso
Created June 17, 2016 02:54
Show Gist options
  • Save ctroncoso/0fb2c1d16dd4d4197d39c66eb310f607 to your computer and use it in GitHub Desktop.
Save ctroncoso/0fb2c1d16dd4d4197d39c66eb310f607 to your computer and use it in GitHub Desktop.
Bulk encoding any video ffmpeg can read to small (archive) version mp4
#!/usr/bin/env bash
PROCESSED_PATH="~/completed/"
SMALLIFIED_PATH="~/compressed/"
for file in "$@"; do
echo ${file%\.*}
if ffmpeg -y -i "${file}" -r 24 -vf 'scale=320:-2' -vcodec libx264 -preset veryfast -crf 20 -c:a aac -strict -2 -b:a 128k "small_${file%\.*}.mp4"
then mv "small_${file%\.*}.mp4" $SMALLIFIED_PATH && mv "${file}" $PROCESSED_PATH
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment