summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2012-07-12 19:51:58 +0200
committerJonas Smedegaard <dr@jones.dk>2012-07-12 19:51:58 +0200
commit9d7e4f3e177480f6aa0d422a761a98005bc49920 (patch)
tree24c4f74eff6841b676d35a9ecba1e2df489908ed
parent36937354dda659f3c77dee2028a1caeddd3cdc3f (diff)
Set video bitrate (not generic bitrate), and leave unset by default (even if melt currently applies 200k limit internally). Unset audio sample rate and channel count by default. Use two-pass encoding only when bitrate explicitly set.
-rwxr-xr-xlocalvideowebencode26
1 files changed, 15 insertions, 11 deletions
diff --git a/localvideowebencode b/localvideowebencode
index b89e6b0..7634525 100755
--- a/localvideowebencode
+++ b/localvideowebencode
@@ -27,8 +27,8 @@ html favoring open formats with optional non-JavaScript Flash fallback.
(default: use input size)
-a, --aspect Display Aspect Ratio in melt format e.g. @16/9
(default: no aspect hinting)
- -b, --bitrate Bitrate in bytes, optionally ISO appreviated
- (default: 768k)
+ -b, --bitrate Video bitrate in bytes, with optional ISO suffix
+ (default: none)
-p, --profile Video format (melt): square_ntsc qcif_15 etc.
(default: none - reuse input format)
--h264profile MPEG-4 AVC target profile (baseline medium)
@@ -49,11 +49,16 @@ Examples:
Options before input files are passed to melt producer, and after to
melt avformat consumer.
-Defaults are optimized for 320x240 (qvga). For better quality use this:
+When video bitrate is set, 2-pass encoding is used for MPEG-4 output.
- size: 640x480 (use lower numbers for widescreen!)
- bitrate: 1120k
- h264profile: baseline
+Hints:
+ * Use max. 640x480 pixel size for widest compatibility
+ (ie. square-pixel 640x360 or anamorphic svcd_ntsc_wide for 16:9)
+ * Append these for single-mic speech: ac=1 ar=32000 ab=64k
+ * Set bitrate for optimal MPEG-4/WebM bits-per-pixel ratio:
+ + talking head: 0.1
+ + high-motion or detailed content: 0.15
+ (inspect result with mediainfo)
More info: <http://camendesign.com/code/video_for_everybody>
<http://www.streaminglearningcenter.com/>
@@ -68,7 +73,6 @@ exit1() {
}
# defaults
-bitrate=768k
h264profile=baseline
# parse cmdline options
@@ -129,15 +133,15 @@ title=${title:-$stem}
# TODO: When verified beneficial, add option real_time=-2
args_in="-progress $sample ${profile:+-profile $profile}${args_in:+ $args_in}"
-args=" ${bitrate:+b=${bitrate}} ${size:+s=$size} ${aspect:+aspect=$aspect}"
-args_audio="ac=2 ar=44100 ab=96k"
+args=" ${bitrate:+vb=${bitrate}} ${size:+s=$size} ${aspect:+aspect=$aspect}"
+args_audio="ab=96k"
## Theora/Vorbis/Ogg
melt -group $args_in $infiles -group $filters -consumer avformat:"$stem.ogg" f=ogg vcodec=libtheora $args acodec=libvorbis $args_audio $args_out
## H.264/AAC/MP4
-melt -group $args_in $infiles -group $filters -consumer avformat:/dev/null properties=x264-medium-pass1 properties=x264-medium-$h264profile $args $args_out
-melt -group $args_in $infiles -group $filters -consumer avformat:"$stem.mp4" pass=2 properties=x264-medium-$h264profile $args acodec=aac $args_audio $args_out
+[ -z "$bitrate" ] || melt -group $args_in $infiles -group $filters -consumer avformat:/dev/null properties=x264-medium-pass1 properties=x264-medium-$h264profile $args $args_out
+melt -group $args_in $infiles -group $filters -consumer avformat:"$stem.mp4" ${bitrate:+pass=2} properties=x264-medium-$h264profile $args acodec=aac $args_audio $args_out
mv "$stem.mp4" "$stem.mp4"~
qt-faststart "$stem.mp4"~ "$stem.mp4"
[ -f "$stem.mp4" ] && rm "$stem.mp4"~ || exit1 "failed to optimize with qt-faststart."