Skip to content

Instantly share code, notes, and snippets.

@cleverdevil
Created August 21, 2017 16:21
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 cleverdevil/9bfe959eb2311ea1c0195c96b2db5e90 to your computer and use it in GitHub Desktop.
Save cleverdevil/9bfe959eb2311ea1c0195c96b2db5e90 to your computer and use it in GitHub Desktop.
Convert an arbitrary video to HTML5 compatible formats and output the HTML needed to embed the video
#!/bin/sh
ffmpeg -i $1 -b:v 1500k -vcodec libx264 -g 30 html5-$1.mp4 &>/dev/null
ffmpeg -i $1 -b:v 1500k -vcodec libvpx -acodec libvorbis -ab 160000 -f webm -g 30 html5-$1.webm &>/dev/null
ffmpeg -i $1 -b:v 1500k -vcodec libtheora -acodec libvorbis -ab 160000 -g 30 html5-$1.ogv &>/dev/null
echo "<video controls>"
echo " <source src=\"html5-$1.mp4\" type=\"video/mp4\">"
echo " <source src=\"html5-$1.webm\" type=\"video/webm\">"
echo " <source src=\"html5-$1.ogg\" type=\"video/ogg\">"
echo "</video>"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment