Skip to content

Instantly share code, notes, and snippets.

@rogeriolino
Last active January 27, 2018 13:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rogeriolino/b2abcbbc0f7bd8ebc18b4cd0975f5a3b to your computer and use it in GitHub Desktop.
Save rogeriolino/b2abcbbc0f7bd8ebc18b4cd0975f5a3b to your computer and use it in GitHub Desktop.
Scale MP4 video to 320px using ffmpeg
#
# Video Scaler
# https://gist.github.com/rogeriolino/b2abcbbc0f7bd8ebc18b4cd0975f5a3b
#
# Place the MP4 files in the same video-scaler.sh script directory.
# Finished (done) files will placed in $FINISHED_DIR directory.
# New resized files will placed in $OUTPUT_DIR directory.
#
SCALE=320
OUTPUT_DIR=output
FINISHED_DIR=converted
mkdir -p $OUTPUT_DIR
mkdir -p $FINISHED_DIR
echo "Scaling..."
find -maxdepth 1 -name "*.mp4" -exec ffmpeg -i {} -vf scale=$SCALE:-1 $OUTPUT_DIR/{}-$SCALE.mp4 \; -exec mv {} $FINISHED_DIR \;
echo "done!"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment