Last active
December 1, 2018 16:56
-
-
Save dhoko/ebe0084901c42f5e8555c5155d6fdfe8 to your computer and use it in GitHub Desktop.
Resize a video (mp4/wmv) to HD (720p)
This file contains hidden or 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
#!/bin/bash | |
set -eo pipefail | |
FILENAME=$(basename -- "$1"); | |
EXT="${FILENAME##*.}"; | |
NAME="${FILENAME%.*}"; | |
OUTPUT=$(echo "$NAME-2.$EXT"); | |
echo $FILENAME; | |
echo $OUTPUT; | |
if [[ "$EXT" = "wmv" ]]; then | |
ffmpeg -i "$FILENAME" -s hd720 -c:v libx264 -crf 23 -c:a aac -strict -2 "$NAME.mp4"; | |
else | |
ffmpeg -i "$FILENAME" -filter:v scale=1280:-1 -c:a copy "$OUTPUT"; | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
if the height is not
/2
there is this version