summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2011-09-11 20:44:45 +0200
committerJonas Smedegaard <dr@jones.dk>2011-09-11 20:44:45 +0200
commitbc09d38571ca70eb7b7e6a87fe42f382e3a048de (patch)
treed7f86c997b3a4af3cb8f302ae17b8679fec461bb
parent3d86ba79b44d1190770bd80a8dcf551dd4b26a23 (diff)
Simplify bitrate handling: ffmpeg supports kilo.
-rwxr-xr-xlocalvideowebencode20
1 files 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