diff options
-rwxr-xr-x | localvideowebencode | 26 |
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." |