summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2021-01-30 15:57:03 +0100
committerJonas Smedegaard <dr@jones.dk>2021-01-31 17:45:48 +0100
commitc8608128ba9222f27b69937e60d0a72290a28dfb (patch)
treee24f8c1e3d0d08fb0e5749bc7a5d63b0660f5cf6
parentd1a2dc07623282aa772243d146731c239fe37edd (diff)
fix support encoding vp8/vp9 streams with ffmpeg
-rwxr-xr-xlocalvideowebencode10
1 files changed, 5 insertions, 5 deletions
diff --git a/localvideowebencode b/localvideowebencode
index 7ef22a6..08dddd7 100755
--- a/localvideowebencode
+++ b/localvideowebencode
@@ -205,7 +205,7 @@ title=${title:-$stem}
# Avoid melt for VP8 and VP9: multipass broken for these codecs
#use_ffmpeg_vp8=yes
#use_ffmpeg_vp9=yes
-use_vpxenc=yes
+#use_vpxenc=yes
# Avoid discrete audio encoders if possible: may cause sync problems
#use_oggenc=yes
#use_opusenc=yes
@@ -473,11 +473,11 @@ _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 -pre:v $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"
+_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"
_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 -pre:v $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"
+_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"
_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_pcm="$_melt_downmix acodec=pcm_s16le"
@@ -528,7 +528,7 @@ if [ -n "$loudness" ] && [ -z "$silence$_melt_loudness" ]; then
echo >&2 "Loudness data: $_melt_loudness"
fi
-if [ -n "$multipass" ] && [ -n "$webm$vp9" ]; then
+if [ -n "$multipass" ] && [ -n "${webm:+$use_vpxenc$use_ffmpeg_vp8$use_oggenc}${vp9:+$use_vpxenc$use_ffmpeg_vp9$use_opusenc}" ]; then
echo >&2 "Analyzing video complexity..."
if [ -n "$use_vpxenc" ]; then
$melt $_melt_infiles $filters \
@@ -551,7 +551,7 @@ if [ -n "$multipass" ] && [ -n "$webm$vp9" ]; then
fi
fi
-if [ -n "$use_oggenc$use_opusenc$use_vpxenc" ] && [ -n "$webm$vp9" ]; then
+if [ -n "${webm:+$use_vpxenc$use_ffmpeg_vp8$use_oggenc}${vp9:+$use_vpxenc$use_ffmpeg_vp9$use_opusenc}" ]; then
echo >&2 "Encoding video${channels:+ and extracting audio}, as discrete files..."
$melt $_melt_infiles \
${channels:+$audioprefilters \