From bc09d38571ca70eb7b7e6a87fe42f382e3a048de Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Sun, 11 Sep 2011 20:44:45 +0200 Subject: Simplify bitrate handling: ffmpeg supports kilo. --- localvideowebencode | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/localvideowebencode b/localvideowebencode index 694fe36..a853be5 100755 --- a/localvideowebencode +++ b/localvideowebencode @@ -80,23 +80,19 @@ heightplus=${height:+$(($height+4))} profile=${profile:-lo} case "$profile" in lo) - bitrateKB=200 - bitrateB=204800 + bitrate=200 aspect=4:3 ;; lowide) - bitrateKB=200 - bitrateB=204800 + bitrate=200 aspect=16:9 ;; hi) - bitrateKB=600 - bitrateB=614400 + bitrate=600 aspect=4:3 ;; hiwide) - bitrateKB=600 - bitrateB=614400 + bitrate=600 aspect=16:9 ;; esac @@ -107,16 +103,16 @@ title=${title:-$filebase} # TODO: Check and fail if all needed tools are not available ## Theora/Vorbis/Ogg -ffmpeg2theora --videobitrate "$bitrateKB" --max_size "$size" --aspect "$aspect" --output "$filebase.ogv" "$infile" +ffmpeg2theora --videobitrate "$bitrate" --max_size "$size" --aspect "$aspect" --output "$filebase.ogv" "$infile" ## H.264/AAC/MP4 -HandBrakeCLI --preset "iPhone & iPod Touch" --vb "$bitrateKB" ${width:+--maxWidth "$width"} ${height:+--maxHeight "$height"} --two-pass --turbo --optimize --input "$infile" --output "$filebase.mp4" +HandBrakeCLI --preset "iPhone & iPod Touch" --vb "$bitrate" ${width:+--maxWidth "$width"} ${height:+--maxHeight "$height"} --two-pass --turbo --optimize --input "$infile" --output "$filebase.mp4" ## VP8/Vorbis/WebM ! ffmpeg -codecs | grep -iw vp8 || webm=yes # FIXME: check and fail if logfiles exist already -[ -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 "$bitrateB" -s "$size" -aspect "$aspect" -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 "$bitrateB" -s "$size" -aspect "$aspect" -acodec libvorbis -ac 2 -y "$filebase.webm" +[ -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 "$bitrate"k -s "$size" -aspect "$aspect" -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 "$bitrate"k -s "$size" -aspect "$aspect" -acodec libvorbis -ac 2 -y "$filebase.webm" rm "$infile"-*.log ## JPEG preview -- cgit v1.2.3