summaryrefslogtreecommitdiff
path: root/localvideowebencode
diff options
context:
space:
mode:
Diffstat (limited to 'localvideowebencode')
-rwxr-xr-xlocalvideowebencode20
1 files changed, 12 insertions, 8 deletions
diff --git a/localvideowebencode b/localvideowebencode
index 75dfcdb..1f22272 100755
--- a/localvideowebencode
+++ b/localvideowebencode
@@ -154,7 +154,7 @@ html favoring open formats with optional non-JavaScript Flash fallback.
hq high exact slow 2xCQ¹
exact medium exact slow 2xCQ¹
quality medium vary medium Q²
- ¹ avc uses 1-pass
+ ¹ theora uses CBR, avc uses 1-pass
² vp8 uses "soft-CQ" (CQ with very high bitrate)
(default: normal)
--quality Quality rate factor: auto [integer] none
@@ -227,6 +227,10 @@ compression=normal
# 5) optionally pick dirty/hq settings
# * check that --compression=quality has similar filesize as normal
+# Theora seems to compress ~100% worse than H.264
+# (reportedly 76% worse in 2010, and libtheora has not improved since)
+# <http://compression.ru/video/codec_comparison/h264_2010/>
+factor_theora=200/100
# VP8 is rumored to compress ~20% worse than H.264
factor_vp8=120/100
# VP9 compresses ~30% better than H.264 for practical use-cases
@@ -307,7 +311,7 @@ qkey_theora=q
qkey_vp8=crf
qkey_vp9=crf
qkey_avc=crf
-q_theora=5
+q_theora=6
q_vp8=33
cpu_vp8=2
q_vp9=33
@@ -321,16 +325,14 @@ case "$compression" in
normal) :;;
dirty)
gpu=${gpu:-auto}
- q_theora=1
cpu_vp8=4
cpu_vp9=4
preset_avc=veryfast
;;
hq)
multipass=yes
- no_multipass_theora=yes # TODO: try with ffmpeg2theora
+ no_q_theora=yes
no_multipass_avc=yes
- q_theora=6
cpu_vp8=0
cpu_vp9=1
preset_avc=veryslow
@@ -534,7 +536,7 @@ fi
if [ -n "$_pixels" ] && [ -n "$_frames" ]; then
bitrate_avc=$(perl -E '$refsize=640*360;' \
-E "say int( +(($_pixels/\$refsize)**0.75*\$refsize*$_frames*$refbpp) )")
- bitrate_theora=$bitrate_avc # FIXME
+ bitrate_theora=$(perl -E "say int( +($bitrate_avc*$factor_theora) )") #"
bitrate_vp8=$(perl -E "say int( +($bitrate_avc*$factor_vp8) )") #"
bitrate_vp9=$(perl -E "say int( +($bitrate_avc*$factor_vp9) )") #"
fi
@@ -720,8 +722,8 @@ _ffmpeg_misc_avc="${no_gpu:+ -movflags +faststart}"
# format options
# emulate VP8 Constant Quality using "loose" Constrained Quality
-_melt_theora="vcodec=libtheora$_melt_bitrate_theora $qkey_theora=$q_theora"
-_ffmpeg_theora="-c:v libtheora$_ffmpeg_bitrate_theora -$qkey_theora:v $q_theora"
+_melt_theora="vcodec=libtheora$_melt_bitrate_theora${q_theora:+ $qkey_theora=$q_theora}"
+_ffmpeg_theora="-c:v libtheora$_ffmpeg_bitrate_theora${q_theora:+ -$qkey_theora:v $q_theora}"
_melt_vp8="vcodec=$encoder_vp8${pre_vp8:+ vpreset=$pre_vp8}${preset_vp8:+ preset=$preset_vp8}$_melt_bitrate_vp8${q_vp8:+ ${no_bitrate_vp8:+vb=$((bitrate_vp8*10)) }$qkey_vp8=$q_vp8}$_melt_misc_vp8"
_ffmpeg_vp8="-c:v $encoder_vp8${pre_vp8:+ -vpre $pre_vp8}${preset_vp8:+ preset $preset_vp8}$_ffmpeg_bitrate_vp8${q_vp8:+ ${no_bitrate_vp8:+-b:v $((bitrate_vp8*10)) }-$qkey_vp8 $q_vp8}$_ffmpeg_misc_vp8"
_vpxenc_vp8="--codec=vp8$_vpxenc_bitrate_vp8 --end-usage=${no_q_vp8:+vbr}${q_vp8:+cq --cq-level=$q_vp8}$_vpxenc_misc_vp8"
@@ -791,6 +793,8 @@ fi
if [ -n "${ogv:+$multipass_theora}${webm:+$multipass_vp8}${webm_vp9:+$multipass_vp9}${mp4:+$multipass_avc}" ]; then
echo >&2 "Analyzing video complexity..."
render melt $_melt_infiles $filters \
+ ${ogv:+${use_melt_theora:+-consumer avformat:$stem.ogv $_melt_ogv \
+ pass=1 passlogfile=${stem}_theora}} \
${webm:+${use_melt_vp8:+-consumer avformat:$stem.webm $_melt_webm \
pass=1 passlogfile=${stem}_vp8}} \
${webm_vp9:+${use_melt_vp9:+-consumer avformat:${stem}_vp9.webm $_melt_webm_vp9 \