Skip to content

Instantly share code, notes, and snippets.

@jesusgoku
Created February 6, 2019 13:13
Show Gist options
  • Save jesusgoku/a339b30bccd2e8b6ea4b5f1b9208781c to your computer and use it in GitHub Desktop.
Save jesusgoku/a339b30bccd2e8b6ea4b5f1b9208781c to your computer and use it in GitHub Desktop.
Shell script for create HTML5 video formats
#!/usr/bin/env bash
SOURCE="$1"
# x264
ffmpeg -i "$SOURCE" -y -c:a aac -c:v libx264 -ac 2 -ar 44100 -b:a 96k -b:v 768k "${SOURCE/%.*/-html5-x264.mp4}" > /dev/null 2>&1 &
# x265
ffmpeg -i "$SOURCE" -y -c:a aac -c:v libx265 -ac 2 -ar 44100 -b:a 96k -b:v 768k "${SOURCE/%.*/-html5-x265.mp4}" > /dev/null 2>&1 &
# VP8
# ffmpeg -i "$SOURCE" -y -c:a libvorbis -c:v libvpx -ac 2 -ar 44100 -b:a 96k -b:v 768k -threads 4 "${SOURCE/%.*/-html5-vp8.webm}" > /dev/null 2>&1 &
# VP9
# ffmpeg -i "$SOURCE" -y -c:a libvorbis -c:v libvpx-vp9 -ac 2 -ar 44100 -b:a 96k -b:v 768k -threads 4 "${SOURCE/%.*/-html5-vp9.webm}" > /dev/null 2>&1 &
# Vorbis
ffmpeg -i "$SOURCE" -c:a libvorbis -c:v libtheora -ac 2 -ar 44100 -b:a 96k -b:v 768k "${SOURCE/%.*/-html5.ogv}" > /dev/null 2>&1 &
wait
echo "All formats created"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment