Skip to content

Instantly share code, notes, and snippets.

@liamcurry
Forked from markupboy/html5video.sh
Created May 14, 2012 20:24
Show Gist options
  • Save liamcurry/2696512 to your computer and use it in GitHub Desktop.
Save liamcurry/2696512 to your computer and use it in GitHub Desktop.

Revisions

  1. Liam Curry revised this gist May 14, 2012. 1 changed file with 20 additions and 16 deletions.
    36 changes: 20 additions & 16 deletions html5video.sh
    Original file line number Diff line number Diff line change
    @@ -1,16 +1,8 @@
    #!/bin/sh

    ####################################
    # Output file for HTML5 video #
    # Requirements: #
    # - handbrakecli #
    # - ffmpeg #
    # - ffmpeg2theora #
    # #
    # usage: #
    # ./html5video.sh infile.mp4 #
    # #
    ###################################
    # Output file for HTML5 video
    # requirements: ffmpeg .6+
    # usage: ./html5video.sh infile.mp4 640x360

    target_directory='converted'
    file=`basename $1`
    @@ -20,10 +12,22 @@ destination="$filepath/$target_directory"

    if ! test -d "$destination"
    then
    mkdir $destination
    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
    # Ogg/Theora
    ffmpeg -i $1 \
    -acodec libvorbis -ac 2 -ab 96k -ar 44100 \
    -b:v 345k -s $2 $destination/$filename.ogv

    # WebM/vp8
    ffmpeg -i $1 \
    -acodec libvorbis -ac 2 -ab 96k -ar 44100 \
    -b:v 345k -s $2 $destination/$filename.webm

    # MP4/h264
    ffmpeg -i $1 \
    -acodec libfaac -ab 96k \
    -vcodec libx264 \
    -level 21 -refs 2 -b:v 345k -bt 345k \
    -threads 0 -s $2 $destination/$filename.mp4
  2. @markupboy markupboy revised this gist Feb 8, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion html5video.sh
    Original file line number Diff line number Diff line change
    @@ -26,4 +26,4 @@ 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
    ffmpeg -i $destination/$filename.mp4 -acodec libvorbis -vcodec libvpx $destination/$filename.webm
  3. @markupboy markupboy revised this gist Feb 8, 2011. 1 changed file with 10 additions and 7 deletions.
    17 changes: 10 additions & 7 deletions html5video.sh
    Original file line number Diff line number Diff line change
    @@ -13,14 +13,17 @@
    ###################################

    target_directory='converted'
    filename=${1%.*}
    file=`basename $1`
    filename=${file%.*}
    filepath=`dirname $1`
    destination="$filepath/$target_directory"

    if ! test -d "${target_directory}"
    if ! test -d "$destination"
    then
    mkdir $target_directory
    mkdir $destination
    fi

    HandBrakeCLI -i $1 -o $target_directory/$filename.mp4 --encoder x264 --vb 900 --ab 128 --optimize
    ffmpeg2theora $target_directory/$filename.mp4
    mv $target_directory/$filename.ogv $target_directory/$filename.ogg
    ffmpeg -i $target_directory/$filename.mp4 -acodec libvorbis -vcodec libvpx $target_directory/$filename.webm
    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
  4. @markupboy markupboy created this gist Feb 8, 2011.
    26 changes: 26 additions & 0 deletions html5video.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    #!/bin/sh

    ####################################
    # Output file for HTML5 video #
    # Requirements: #
    # - handbrakecli #
    # - ffmpeg #
    # - ffmpeg2theora #
    # #
    # usage: #
    # ./html5video.sh infile.mp4 #
    # #
    ###################################

    target_directory='converted'
    filename=${1%.*}

    if ! test -d "${target_directory}"
    then
    mkdir $target_directory
    fi

    HandBrakeCLI -i $1 -o $target_directory/$filename.mp4 --encoder x264 --vb 900 --ab 128 --optimize
    ffmpeg2theora $target_directory/$filename.mp4
    mv $target_directory/$filename.ogv $target_directory/$filename.ogg
    ffmpeg -i $target_directory/$filename.mp4 -acodec libvorbis -vcodec libvpx $target_directory/$filename.webm