Created
February 8, 2011 15:43
-
-
Save markupboy/816610 to your computer and use it in GitHub Desktop.
automated conversion of a file to all three html5 compatible video formats - h.264, ogg, and webm
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/sh | |
#################################### | |
# Output file for HTML5 video # | |
# Requirements: # | |
# - handbrakecli # | |
# - ffmpeg # | |
# - ffmpeg2theora # | |
# # | |
# usage: # | |
# ./html5video.sh infile.mp4 # | |
# # | |
################################### | |
target_directory='converted' | |
file=`basename $1` | |
filename=${file%.*} | |
filepath=`dirname $1` | |
destination="$filepath/$target_directory" | |
if ! test -d "$destination" | |
then | |
mkdir $destination | |
fi | |
HandBrakeCLI -i $1 -o $destination/$filename.mp4 --encoder x264 --vb 900 --ab 128 --optimize | |
ffmpeg2theora $destination/$filename.mp4 | |
mv $destination/$filename.ogv $destination/$filename.ogg | |
ffmpeg -i $destination/$filename.mp4 -acodec libvorbis -vcodec libvpx $destination/$filename.webm |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Newer versions of ffmpeg can convert to all HTML5 video types, without ffmpeg2theora or HandBrakeCLI. I simplified the script in this fork: https://gist.github.com/2696512