Skip to content

Instantly share code, notes, and snippets.

@ifthenelse
Created November 16, 2018 13:32
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 ifthenelse/4260b965dd70a1e6b499b033404f4ba3 to your computer and use it in GitHub Desktop.
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
#!/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