Skip to content

Instantly share code, notes, and snippets.

@semiaddict
Forked from markupboy/html5video.sh
Created February 16, 2012 23:33
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 semiaddict/1848770 to your computer and use it in GitHub Desktop.
Save semiaddict/1848770 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
####################################
# Output file for HTML5 video #
# Requirements: #
# - handbrakecli #
# - ffmpeg #
# - ffmpeg2theora #
# #
# usage: #
# .\html5video.bat infile.mp4 #
# #
###################################
@echo off
set target_directory=converted
set file=%~nx1
set filename=%~n1
set filepath=%~p1
set destination=%filepath%%target_directory%
IF NOT EXIST "%destination%" MD "%destination%"
HandBrakeCLI.exe -i %1 -o "%destination%\%filename%.mp4" --encoder x264 --vb 900 --ab 128 --optimize
ffmpeg2theora-0.28.exe "%destination%\%filename%.mp4"
MOVE "%destination%\%filename%.ogv" "%destination%\%filename%.ogg"
ffmpeg.exe -i "%destination%\%filename%.mp4" -acodec libvorbis -vcodec libvpx "%destination%\%filename%.webm"
#!/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