From 8440867cc4fcbe371f9868cf76c9be213a334a4c Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Thu, 2 Sep 2010 17:59:43 +0200 Subject: Misc. improvements to localvideowebencode. --- localvideowebencode | 47 ++++++++++++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 17 deletions(-) (limited to 'localvideowebencode') diff --git a/localvideowebencode b/localvideowebencode index 65b8384..5b4d429 100755 --- a/localvideowebencode +++ b/localvideowebencode @@ -1,7 +1,8 @@ #!/bin/sh -# Origin: http://diveintohtml5.org/video.html -# See also: http://camendesign.com/code/video_for_everybody +# Origins: +# http://diveintohtml5.org/video.html +# http://camendesign.com/code/video_for_everybody set -e @@ -13,29 +14,41 @@ filebase=$(echo "$infile" | perl -pe 's/\.[^.]*//') size=${1:-320x200} width=$(echo "$size" | perl -pe 's/[^x]*x//') height=$(echo "$size" | perl -pe 's/x[^x]*//') +heightplus=${height:+$(($height+4))} ## Theora/Vorbis/Ogg ffmpeg2theora --videobitrate 200 --max_size "$size" --output "$filebase.ogv" "$infile" ## H.264/AAC/MP4 -#HandBrakeCLI --preset "iPhone & iPod Touch" --vb 200 ${width:+--width "$width"} --two-pass --turbo --optimize --input "$infile" --output "$filebase.mp4" HandBrakeCLI --preset "iPhone & iPod Touch" --vb 200 ${width:+--maxWidth "$width"} ${height:+--maxHeight "$height"} --two-pass --turbo --optimize --input "$infile" --output "$filebase.mp4" ## VP8/Vorbis/WebM -ffmpeg -pass 1 -passlogfile "$infile" -threads 16 -keyint_min 0 -g 250 -skip_threshold 0 -qmin 1 -qmax 51 -i "$infile" -vcodec libvpx -b 204800 -s "$size" -aspect 4:3 -an -f webm -y NUL -ffmpeg -pass 2 -passlogfile "$infile" -threads 16 -keyint_min 0 -g 250 -skip_threshold 0 -qmin 1 -qmax 51 -i "$infile" -vcodec libvpx -b 204800 -s "$size" -aspect 4:3 -acodec libvorbis -ac 2 -y "$filebase.webm" +! ffmpeg -codecs | grep -iw vp8 || webm=yes +[ -z "$webm" ] || ffmpeg -pass 1 -passlogfile "$infile" -threads 16 -keyint_min 0 -g 250 -skip_threshold 0 -qmin 1 -qmax 51 -i "$infile" -vcodec libvpx -b 204800 -s "$size" -aspect 4:3 -an -f webm -y NUL +[ -z "$webm" ] || ffmpeg -pass 2 -passlogfile "$infile" -threads 16 -keyint_min 0 -g 250 -skip_threshold 0 -qmin 1 -qmax 51 -i "$infile" -vcodec libvpx -b 204800 -s "$size" -aspect 4:3 -acodec libvorbis -ac 2 -y "$filebase.webm" + +## JPEG preview +ffmpegthumbnailer -s0 -i "$filebase.ogv" -o "$filebase.jpg" + +## TODO: resolve flash player to use +[ -z "$flashplayer" ] || flash=yes cat >"$filebase.html" < - - - - - - - -

Download video as MP4, WebM, or Ogg.

-
- + + +

Download Video: +open classic Format:"Ogg", +${webm:+open modern Format:"WebM",} +closed Format:"MP4". +

EOF -- cgit v1.2.3