Created
November 16, 2018 13:32
-
-
Save ifthenelse/4260b965dd70a1e6b499b033404f4ba3 to your computer and use it in GitHub Desktop.
Create compressed versions of video in mp4 and webm formats using zsh and ffmpeg
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
#!/bin/env zsh | |
# create webm and mp4 web version of video | |
webvideo() { | |
if [ -z "$1" ]; then | |
printf "\Video source not set\n" | |
exit 1 | |
fi | |
SOURCE="$1" | |
FILENAME="${SOURCE:r}" | |
ffmpeg -i "$SOURCE" -c:v libvpx -b:v 512k -c:a libvorbis "$FILENAME-web.webm" | |
ffmpeg -i "$SOURCE" -b:v 512k -vcodec mpeg1video -acodec copy -an "$FILENAME-web.mp4" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment