Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.