summaryrefslogtreecommitdiff
path: root/localvideowebencode
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2021-02-06 20:32:38 +0100
committerJonas Smedegaard <dr@jones.dk>2021-02-06 20:32:38 +0100
commit8b14f381f36e45a8d661ab145b80b071b251064b (patch)
treeabf8eabc2d21ce677e1e4a98f2d4a0fa3003d9b2 /localvideowebencode
parent085d99f2fb2eb4b72b71fc2dbbfcb2c8cbb76d78 (diff)
fix avoid multipass for h264
Diffstat (limited to 'localvideowebencode')
-rwxr-xr-xlocalvideowebencode27
1 files changed, 15 insertions, 12 deletions
diff --git a/localvideowebencode b/localvideowebencode
index d8d650e..1afa68b 100755
--- a/localvideowebencode
+++ b/localvideowebencode
@@ -291,6 +291,7 @@ case "$compression" in
;;
hq)
multipass=yes
+ no_multipass_h264=yes
q_theora=6
cpu_vp8=0
cpu_vp9=1
@@ -298,6 +299,7 @@ case "$compression" in
;;
exact)
multipass=yes
+ no_multipass_h264=yes
;;
quality)
no_bitrate=yes
@@ -360,7 +362,6 @@ case "$gpu" in
;;
*) exit1 "Unknown GPU type \"$gpu\".";;
esac
-[ -n "$multipass" ] || singlepass=yes
[ -z "$gpu" ] && no_gpu=yes || eval "gpu_$gpu=yes"
# parse/resolve size and framerate
@@ -570,6 +571,8 @@ for vformat in vp8 vp9 h264; do
eval "[ -n \"\$q_$vformat\" ] || no_q_$vformat=yes"
[ -z "$gpu" ] || eval "[ -n \"\$no_gpu_encoder_$vformat\" ] || encoder_$vformat=${vformat}_$gpu"
[ h264 = "$vformat" ] || eval "[ -n \"$use_vpxenc\$use_ffmpeg_$vformat\" ] || use_melt_$vformat=yes"
+ [ -z "$multipass" ] || eval "[ -n \"\$no_multipass_$vformat\" ] || multipast_$vformat=yes"
+ eval "[ -n \"\$multipass_$vformat\" ] || singlepast_$vformat=yes"
done
if [ -n "$use_ffmpeg_vp8$use_ffmpeg_vp9$use_vpxenc" ]; then
[ -n "$use_oggenc" ] || use_ffmpeg_ogg=yes
@@ -696,7 +699,7 @@ if [ -n "$loudness" ] && [ -z "$silence$_melt_loudness" ]; then
echo >&2 "Loudness data: $_melt_loudness"
fi
-if [ -n "$multipass" ]; then
+if [ -n "${webm:+$multipass_vp8}${vp9:+$multipass_vp9}${mp4:+$multipass_h264}" ]; then
if [ -n "${webm:+$use_vpxenc}${vp9:+$use_vpxenc}" ]; then
echo >&2 "Analyzing video complexity, as discrete processes..."
$melt $_melt_infiles $filters $_melt_stdout \
@@ -752,23 +755,23 @@ if [ -n "${webm:+$use_vpxenc$use_ffmpeg_vp8$use_oggenc}${vp9:+$use_vpxenc$use_ff
| pee \
${webm:+${use_ffmpeg_vp8:+"$ffmpeg_chained \
$_ffmpeg_stdin $_ffmpeg_webm_onlyvideo \
- ${multipass:+-pass 2 -passlogfile ${stem}_vp8} \
+ ${multipass_vp8:+-pass 2 -passlogfile ${stem}_vp8} \
${stem}${channels:+_silent}.webm"}} \
${webm:+${use_vpxenc:+"$vpxenc_chained - $_vpxenc_vp8 \
- ${singlepass:+-p 1} \
- ${multipass:+-p 2 --pass=2 --fpf=${stem}_vp8.log} \
+ ${singlepass_vp8:+-p 1} \
+ ${multipass_vp8:+-p 2 --pass=2 --fpf=${stem}_vp8.log} \
-o ${stem}${channels:+_silent}.webm"}} \
${vp9:+${use_ffmpeg_vp9:+"$ffmpeg_chained \
$_ffmpeg_stdin $_ffmpeg_webm_onlyvideo_vp9 \
- ${multipass:+-pass 2 -passlogfile ${stem}_vp9} \
+ ${multipass_vp9:+-pass 2 -passlogfile ${stem}_vp9} \
${stem}_vp9${channels:+_silent}.webm"}} \
${vp9:+${use_vpxenc:+"$vpxenc_chained - $_vpxenc_vp9 \
- ${singlepass:+-p 1} \
- ${multipass:+-p 2 --pass=2 --fpf=${stem}_vp9.log} \
+ ${singlepass_vp9:+-p 1} \
+ ${multipass_vp9:+-p 2 --pass=2 --fpf=${stem}_vp9.log} \
-o ${stem}_vp9${channels:+_silent}.webm"}} \
${mp4:+${use_ffmpeg_h264:+"$ffmpeg_chained \
$_ffmpeg_stdin $_ffmpeg_mp4_onlyvideo \
- ${multipass:+-pass 2 -passlogfile ${stem}_h264} \
+ ${multipass_h264:+-pass 2 -passlogfile ${stem}_h264} \
${stem}${channels:+_silent}.mp4"}}
if [ -n "${webm:+$use_vpxenc$use_ffmpeg_vp8$use_oggenc}" ] && [ -n "$channels" ]; then
echo >&2 "Encoding Vorbis audio and muxing with VP8 video..."
@@ -820,11 +823,11 @@ else
$filters${channels:+ $_melt_postfilters_audio} \
${ogg:+-consumer avformat:$stem.ogv $_melt_ogg} \
${webm:+-consumer avformat:$stem.webm $_melt_webm \
- ${multipass:+pass=2 passlogfile=${stem}_vp8}} \
+ ${multipass_vp8:+pass=2 passlogfile=${stem}_vp8}} \
${vp9:+-consumer avformat:${stem}_vp9.webm $_melt_webm_vp9 \
- ${multipass:+pass=2 passlogfile=${stem}_vp9}} \
+ ${multipass_vp9:+pass=2 passlogfile=${stem}_vp9}} \
${mp4:+-consumer avformat:$stem.mp4 $_melt_mp4
- ${multipass:+pass=2 passlogfile=${stem}_vp8}}
+ ${multipass_vp8:+pass=2 passlogfile=${stem}_vp8}}
fi
# cleanup encoding cruft