diff options
Diffstat (limited to 'localvideowebencode')
-rwxr-xr-x | localvideowebencode | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/localvideowebencode b/localvideowebencode index 60164aa..7d6eaee 100755 --- a/localvideowebencode +++ b/localvideowebencode @@ -125,6 +125,11 @@ formats=webm,vp9,mp4 samplestart=0 samplelength=150 compression=normal +# VP8 is rumored to compress ~20% worse than H.264 +factor_vp8=120/100 +# VP9 compresses natural video ~27% worse than H.264 (i.e. excluding animation) +# <http://infoscience.epfl.ch/record/200925/files/article-vp9-submited-v2.pdf> +factor_vp9=127/100 # parse cmdline options TEMP="`getopt -s sh -o hp:s:a:r:b:t: -l help,profile:,size:,aspect:,rate:,video:,refbpp:,formats:,audio:,audioprefilter:,loudness,loudness-data:,filter:,stem:,title:,sample,sample-start:,sample-length:,compression: -n "$PRG" -- "$@"`" || exit1 "Internal getopt error." @@ -311,10 +316,13 @@ if [ -n "$_pixels" ] && [ $_pixels -ge $((1024*768)) ]; then fi # compute average bitrate from reference data and "power of .75" rule +bitrate_vp8="$bitrate" +bitrate_vp9="$bitrate" if [ -n "$_pixels" ] && [ -n "$_frames" ]; then bitrate=$(perl -E '$refsize=640*360;' \ -E "say int( +(($_pixels/\$refsize)**0.75*\$refsize*$_frames*$refbpp) )") - bitrate_vp9=$(perl -E "say int( $bitrate/2 )") #" + bitrate_vp8=$(perl -E "say int( +($bitrate*$factor_vp8) )") #" + bitrate_vp9=$(perl -E "say int( +($bitrate*$factor_vp9) )") #" fi # default per-codec-channel bitrates @@ -362,7 +370,7 @@ _melt_sample="$infile_first ${sample:+in=${samplestart:-0} out=$((${samplestart: _melt_video="progressive=1${framerate:+ frame_rate_num="$framerate_num" frame_rate_den="$framerate_den"}${size:+ s=${width:+$width}x${height:+$height}}${aspect:+ aspect=$aspect}" _melt_ogg="$_melt_video f=ogg vcodec=libtheora${bitrate:+ vb=$bitrate} qscale=$qscale_theora" _melt_h264="$_melt_video f=mp4 vcodec=libx264 vpreset=$speedpreset_h264 vprofile=baseline${x264tune:+ tune=$x264tune} threads=0 movflags=+faststart crf=$crf_h264" -_melt_webm="$_melt_video f=webm vcodec=libvpx vpreset=libvpx-$webmpreset${bitrate:+ vb=$bitrate} crf=$crf_vp8 cpu-used=$cpu_vp8" +_melt_webm="$_melt_video f=webm vcodec=libvpx vpreset=libvpx-$webmpreset${bitrate_vp8:+ vb=$bitrate_vp8} crf=$crf_vp8 cpu-used=$cpu_vp8" _melt_img="$_melt_video f=image2" # CRF ignored with libvpx 1.3 _melt_vp9="$_melt_video f=webm vcodec=libvpx-vp9 vpreset=libvpx-$webmpreset${bitrate_vp9:+ vb=$bitrate_vp9} crf=$crf_vp9 cpu-used=$cpu_vp9" @@ -374,7 +382,7 @@ _melt_opus="$_melt_audio acodec=libopus${channels:+ ab=$(($channels*$bitrate_opu _melt_aac="$_melt_audio acodec=aac${channels:+ ab=$(($channels*$bitrate_aac))k}" avconv="avconv -threads auto -y -v warning" -_avconv_vp8="-c:v libvpx -pre:v libvpx-$webmpreset${bitrate:+ -b:v $bitrate} -crf $crf_vp8 -cpu-used $cpu_vp8" +_avconv_vp8="-c:v libvpx -pre:v libvpx-$webmpreset${bitrate_vp8:+ -b:v $bitrate_vp8} -crf $crf_vp8 -cpu-used $cpu_vp8" _avconv_vp9="-c:v libvpx-vp9 -pre:v libvpx-$webmpreset${bitrate_vp9:+ -b:v $bitrate_vp9} -crf $crf_vp9 -cpu-used $cpu_vp9" # resolve EBU R128 audio normalizing |