summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2021-01-29 17:21:37 +0100
committerJonas Smedegaard <dr@jones.dk>2021-02-03 16:56:45 +0100
commiteb588d140b3e6bd765691e7e9b16018b6803f7da (patch)
tree7ff4c99af47c3411005c35643265b29e781c18ee
parent33512e3ce2165944311cbd8af20b9c9baa752927 (diff)
streamline variables for presets and profiles
-rwxr-xr-xlocalvideowebencode24
1 files changed, 14 insertions, 10 deletions
diff --git a/localvideowebencode b/localvideowebencode
index f16587d..1d6bc2e 100755
--- a/localvideowebencode
+++ b/localvideowebencode
@@ -225,7 +225,8 @@ cpu_vp8=2
#crf_vp9=10
cpu_vp9=5
crf_h264=23
-speedpreset_h264=medium
+preset_h264=medium
+profile_h264=baseline
case "$compression" in
normal) :;;
dirty)
@@ -238,7 +239,7 @@ case "$compression" in
qscale_theora=6
cpu_vp8=0
cpu_vp9=1
- speedpreset_h264=veryslow
+ preset_h264=veryslow
;;
*) exit1 "Unknown compression mode \"$compression\".";;
esac
@@ -353,18 +354,21 @@ if [ -n "$_width" ] && [ -n "$_height" ]; then
fi
_frames="${framerate:-$framerate_in}"
-sizepreset_vpx=libvpx-360p
+preset_vp8=libvpx-360p
+preset_vp9=libvpx-360p
webm_qmin=0
webm_qmax=63
webm_lag=16
webm_tokenparts_log2=0
if [ -n "$_pixels" ] && [ $_pixels -ge $((1024*768)) ]; then
- sizepreset_vpx=libvpx-720p
+ preset_vp8=libvpx-720p
+ preset_vp9=libvpx-720p
webm_qmin=11
webm_qmax=51
webm_tokenparts_log2=2
if [ -n "$_frames" ] && [ $_frames -gt 40 ]; then
- sizepreset_vpx=libvpx-720p50_60
+ preset_vp8=libvpx-720p50_60
+ preset_vp9=libvpx-720p50_60
webm_lag=25
fi
fi
@@ -476,14 +480,14 @@ _melt_postfilters_audio="${limit:+-filter ladspa.1077}"
# codec options
_melt_theora="vcodec=libtheora${bitrate:+ vb=$bitrate} qscale=$qscale_theora"
-_melt_vp8="vcodec=libvpx vpreset=$sizepreset_vpx${bitrate_vp8:+ vb=$bitrate_vp8 minrate=$((bitrate_vp8/20)) maxrate=$((bitrate_vp8*12))}${crf_vp8:+ crf=$crf_vp8} cpu-used=$cpu_vp8"
-_ffmpeg_vp8="-c:v libvpx -vpre $sizepreset_vpx${bitrate_vp8:+ -b:v $bitrate_vp8 -minrate $((bitrate_vp8/20)) -maxrate $((bitrate_vp8*12))}${crf_vp8:+ -crf $crf_vp8} -cpu-used $cpu_vp8"
+_melt_vp8="vcodec=libvpx${preset_vp8:+ vpreset=$preset_vp8}${bitrate_vp8:+ vb=$bitrate_vp8 minrate=$((bitrate_vp8/20)) maxrate=$((bitrate_vp8*12))}${crf_vp8:+ crf=$crf_vp8} cpu-used=$cpu_vp8"
+_ffmpeg_vp8="-c:v libvpx${preset_vp8:+ -vpre $preset_vp8}${bitrate_vp8:+ -b:v $bitrate_vp8 -minrate $((bitrate_vp8/20)) -maxrate $((bitrate_vp8*12))}${crf_vp8:+ -crf $crf_vp8} -cpu-used $cpu_vp8"
_vpxenc_vpx="--min-q=$webm_qmin --max-q=$webm_qmax${multipass:+ --minsection-pct=5 --maxsection-pct=1200} --kf-max-dist=120 --auto-alt-ref=1 --lag-in-frames=$webm_lag --arnr-maxframes=7 --arnr-strength=5 --arnr-type=3"
_vpxenc_vp8="--codec=vp8${bitrate_vp8:+ --target-bitrate=$((bitrate_vp8/1000))} --good --end-usage=${vbr_vp8:+vbr}${crf_vp8:+cq --cq-level=$crf_vp8} --cpu-used=$cpu_vp8 $_vpxenc_vpx --token-parts=$webm_tokenparts_log2"
-_melt_vp9="vcodec=libvpx-vp9 vpreset=$sizepreset_vpx${bitrate_vp9:+ vb=$bitrate_vp9 minrate=$((bitrate_vp9/20)) maxrate=$((bitrate_vp9*12))}${crf_vp9:+ crf=$crf_vp9} cpu-used=$cpu_vp9"
-_ffmpeg_vp9="-c:v libvpx-vp9 -vpre $sizepreset_vpx${bitrate_vp9:+ -b:v $bitrate_vp9 -minrate $((bitrate_vp9/20)) -maxrate $((bitrate_vp9*12))}${crf_vp9:+ -crf $crf_vp9} -cpu-used $cpu_vp9"
+_melt_vp9="vcodec=libvpx-vp9${preset_vp9:+ vpreset=$preset_vp9}${bitrate_vp9:+ vb=$bitrate_vp9 minrate=$((bitrate_vp9/20)) maxrate=$((bitrate_vp9*12))}${crf_vp9:+ crf=$crf_vp9} cpu-used=$cpu_vp9"
+_ffmpeg_vp9="-c:v libvpx-vp9${preset_vp9:+ -vpre $preset_vp9}${bitrate_vp9:+ -b:v $bitrate_vp9 -minrate $((bitrate_vp9/20)) -maxrate $((bitrate_vp9*12))}${crf_vp9:+ -crf $crf_vp9} -cpu-used $cpu_vp9"
_vpxenc_vp9="--codec=vp9${bitrate_vp9:+ --target-bitrate=$((bitrate_vp9/1000))} --good --end-usage=${vbr_vp9:+vbr}${crf_vp9:+cq --cq-level=$crf_vp9} --cpu-used=$cpu_vp9 $_vpxenc_vpx --tile-columns=$webm_tokenparts_log2 --tile-rows=$webm_tokenparts_log2"
-_melt_h264="vcodec=libx264 vpreset=$speedpreset_h264 vprofile=baseline${x264tune:+ tune=$x264tune} maxrate=${bitrate} bufsize=$((bitrate*2)) threads=0 movflags=+faststart crf=$crf_h264"
+_melt_h264="vcodec=libx264${preset_h264:+ vpreset=$preset_h264}${profile_h264:+ vprofile=$profile_h264}${x264tune:+ tune=$x264tune} maxrate=${bitrate} bufsize=$((bitrate*2)) threads=0 movflags=+faststart crf=$crf_h264"
_melt_pcm="$_melt_downmix acodec=pcm_s16le"
_melt_vorbis="$_melt_downmix acodec=libvorbis aq=$quality_vorbis"
_ffmpeg_vorbis="$_ffmpeg_downmix -c:a libvorbis -aq $quality_vorbis"