summaryrefslogtreecommitdiff
path: root/localvideowebencode
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2021-02-08 14:24:34 +0100
committerJonas Smedegaard <dr@jones.dk>2021-02-08 21:46:47 +0100
commit51dd477d9a839e86f5363e57f7d1e8e2231885ce (patch)
tree47af20022d2913bd580e5f7995fd5d81694a78c3 /localvideowebencode
parentd2c0fb8c3392b57a172653aac079bce1ac7a9a59 (diff)
fix use of both vpxenc and ffmpeg, and merge multiple ffmpeg uses
Diffstat (limited to 'localvideowebencode')
-rwxr-xr-xlocalvideowebencode85
1 files changed, 28 insertions, 57 deletions
diff --git a/localvideowebencode b/localvideowebencode
index b0dc7b6..5060645 100755
--- a/localvideowebencode
+++ b/localvideowebencode
@@ -717,18 +717,7 @@ if [ -n "$loudness" ] && [ -z "$silence$_melt_loudness" ]; then
fi
if [ -n "${webm:+$multipass_vp8}${webm_vp9:+$multipass_vp9}${mp4:+$multipass_avc}" ]; then
- if [ -n "$use_vpxenc_any" ]; then
- echo >&2 "Analyzing video complexity, as discrete processes..."
- $melt $_melt_infiles $filters $_melt_stdout \
- | pee \
- ${webm:+"$vpxenc_chained - $_vpxenc_vp8 \
- --pass=1 --fpf=${stem}_vp8.log -o /dev/null"} \
- ${webm_vp9:+"$vpxenc_chained - $_vpxenc_vp9 \
- --pass=1 --fpf=${stem}_vp9.log -o /dev/null"} \
- ${mp4:+${use_ffmpeg_avc:+$_ffmpeg_rawvideo $_ffmpeg_avc -an \
- -pass 1 -passlogfile ${stem}_avc /dev/null}}
- elif [ -n "$use_ffmpeg_any" ]; then
- echo >&2 "Analyzing video complexity, integrated with ffmpeg"
+ echo >&2 "Analyzing video complexity..."
$melt $_melt_infiles $filters $_melt_stdout \
${webm:+${use_melt_vp8:+-consumer avformat:$stem.webm $_melt_webm \
pass=1 passlogfile=${stem}_vp8}} \
@@ -736,59 +725,56 @@ if [ -n "${webm:+$multipass_vp8}${webm_vp9:+$multipass_vp9}${mp4:+$multipass_avc
pass=1 passlogfile=${stem}_vp9}} \
${mp4:+${use_melt_avc:+-consumer avformat:$stem.mp4 $_melt_mp4 \
pass=1 passlogfile=${stem}_vp8}} \
- | $ffmpeg_chained $_ffmpeg_stdin \
+ | pee \
+ ${any_ffmpeg:+"$ffmpeg_chained $_ffmpeg_stdin \
${webm:+${use_ffmpeg_vp8:+$_ffmpeg_rawvideo $_ffmpeg_vp8 -an \
-pass 1 -passlogfile ${stem}_vp8 /dev/null}} \
${webm_vp9:+${use_ffmpeg_vp9:+$_ffmpeg_rawvideo $_ffmpeg_vp9 -an \
-pass 1 -passlogfile ${stem}_vp9 /dev/null}} \
${mp4:+${use_ffmpeg_avc:+$_ffmpeg_rawvideo $_ffmpeg_avc -an \
- -pass 1 -passlogfile ${stem}_avc /dev/null}}
- else
- echo >&2 "Analyzing video complexity, at once..."
- $melt $_melt_infiles $filters \
- ${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 \
- pass=1 passlogfile=${stem}_vp9}} \
- ${mp4:+${use_melt_avc:+-consumer avformat:$stem.mp4 $_melt_mp4 \
- pass=1 passlogfile=${stem}_vp8}}
- fi
+ -pass 1 -passlogfile ${stem}_avc /dev/null}}"} \
+ ${webm:+${use_vpxenc:+"$vpxenc_chained - $_vpxenc_vp8 \
+ --pass=1 --fpf=${stem}_vp8.log -o /dev/null"}} \
+ ${webm_vp9:+${use_vpxenc:+"$vpxenc_chained - $_vpxenc_vp9 \
+ --pass=1 --fpf=${stem}_vp9.log -o /dev/null"}}
fi
-if [ -n "$use_ffmpeg_any$use_vpxenc_any$use_opusenc_any$use_oggenc_any" ]; then
- echo >&2 "Encoding video${channels:+ and extracting audio}, as discrete files..."
+ echo >&2 "Encoding video${channels:+ and audio}..."
$melt $_melt_infiles \
${channels:+$audioprefilters \
${_melt_loudness:+-filter loudness program=$lufs \
results="$_melt_loudness"}} \
$filters${channels:+ $_melt_postfilters_audio} \
- ${ogg:+-consumer avformat:$stem.ogv $_melt_ogg} \
- ${mp4:+${use_melt_avc:+-consumer avformat:$stem.mp4 $_melt_mp4}} \
+ ${ogg:+${use_melt_theora:+-consumer avformat:$stem.ogv $_melt_ogg}} \
+ ${webm:+${use_melt_vp8:+-consumer avformat:$stem.webm $_melt_webm \
+ ${multipass_vp8:+pass=2 passlogfile=${stem}_vp8}}} \
+ ${webm_vp9:+${use_melt_vp9:+-consumer avformat:${stem}_vp9.webm $_melt_webm_vp9 \
+ ${multipass_vp9:+pass=2 passlogfile=${stem}_vp9}}} \
+ ${mp4:+${use_melt_avc:+-consumer avformat:$stem.mp4 $_melt_mp4
+ ${multipass_avc:+pass=2 passlogfile=${stem}_vp8}}} \
${channels:+${use_wav:+-consumer avformat:$stem.wav \
$_melt_wav}} \
${channels:+${use_matroska:+-consumer avformat:$stem.mkv \
$_melt_matroska_pcm}} \
$_melt_stdout \
| pee \
- ${webm:+${use_ffmpeg_vp8:+"$ffmpeg_chained \
- $_ffmpeg_stdin $_ffmpeg_webm_onlyvideo \
+ ${any_ffmpeg:+"$ffmpeg_chained $_ffmpeg_stdin \
+ ${webm:+${use_ffmpeg_vp8:+$_ffmpeg_webm_onlyvideo \
${multipass_vp8:+-pass 2 -passlogfile ${stem}_vp8} \
- ${stem}${channels:+_silent}.webm"}} \
+ ${stem}${channels:+_silent}.webm}} \
+ ${webm_vp9:+${use_ffmpeg_vp9:+$_ffmpeg_webm_vp9_onlyvideo \
+ ${multipass_vp9:+-pass 2 -passlogfile ${stem}_vp9} \
+ ${stem}_vp9${channels:+_silent}.webm}} \
+ ${mp4:+${use_ffmpeg_avc:+$_ffmpeg_mp4_onlyvideo \
+ ${multipass_avc:+-pass 2 -passlogfile ${stem}_avc} \
+ ${stem}${channels:+_silent}.mp4}}"} \
${webm:+${use_vpxenc:+"$vpxenc_chained - $_vpxenc_vp8 \
${multipass_vp8:+--pass=2 --fpf=${stem}_vp8.log} \
-o ${stem}${channels:+_silent}.webm"}} \
- ${webm_vp9:+${use_ffmpeg_vp9:+"$ffmpeg_chained \
- $_ffmpeg_stdin $_ffmpeg_webm_vp9_onlyvideo \
- ${multipass_vp9:+-pass 2 -passlogfile ${stem}_vp9} \
- ${stem}_vp9${channels:+_silent}.webm"}} \
${webm_vp9:+${use_vpxenc:+"$vpxenc_chained - $_vpxenc_vp9 \
${multipass_vp9:+--pass=2 --fpf=${stem}_vp9.log} \
- -o ${stem}_vp9${channels:+_silent}.webm"}} \
- ${mp4:+${use_ffmpeg_avc:+"$ffmpeg_chained \
- $_ffmpeg_stdin $_ffmpeg_mp4_onlyvideo \
- ${multipass_avc:+-pass 2 -passlogfile ${stem}_avc} \
- ${stem}${channels:+_silent}.mp4"}}
- if [ -n "${webm:+$use_vpxenc$use_ffmpeg_vp8$use_oggenc}" ] && [ -n "$channels" ]; then
+ -o ${stem}_vp9${channels:+_silent}.webm"}}
+ if [ -n "${webm:+$use_vpxenc$use_oggenc}" ] && [ -n "$channels" ]; then
echo >&2 "Encoding Vorbis audio and muxing with VP8 video..."
if [ -n "$use_oggenc" ]; then
$oggenc $_oggenc_wav_in $_oggenc_vorbis -o - $stem.wav \
@@ -802,7 +788,7 @@ if [ -n "$use_ffmpeg_any$use_vpxenc_any$use_opusenc_any$use_oggenc_any" ]; then
$_ffmpeg_webm_keepvideo ${stem}.webm
fi
fi
- if [ -n "${webm_vp9:+$use_vpxenc$use_ffmpeg_vp9$use_opusenc}" ] && [ -n "$channels" ]; then
+ if [ -n "${webm_vp9:+$use_vpxenc$use_opusenc}" ] && [ -n "$channels" ]; then
echo >&2 "Encoding Opus audio and muxing with VP9 video..."
if [ -n "$use_opusenc" ]; then
$opusenc $_opusenc_wav_in $_opusenc_opus -o - $stem.wav \
@@ -829,21 +815,6 @@ if [ -n "$use_ffmpeg_any$use_vpxenc_any$use_opusenc_any$use_oggenc_any" ]; then
$_ffmpeg_mp4_keepvideo_aac ${stem}.mp4
fi
fi
-else
- echo >&2 "Encoding video${channels:+ and audio}, at once..."
- $melt $_melt_infiles \
- ${channels:+$audioprefilters \
- ${_melt_loudness:+-filter loudness program=$lufs \
- results="$_melt_loudness"}} \
- $filters${channels:+ $_melt_postfilters_audio} \
- ${ogg:+-consumer avformat:$stem.ogv $_melt_ogg} \
- ${webm:+-consumer avformat:$stem.webm $_melt_webm \
- ${multipass_vp8:+pass=2 passlogfile=${stem}_vp8}} \
- ${webm_vp9:+-consumer avformat:${stem}_vp9.webm $_melt_webm_vp9 \
- ${multipass_vp9:+pass=2 passlogfile=${stem}_vp9}} \
- ${mp4:+-consumer avformat:$stem.mp4 $_melt_mp4
- ${multipass_vp8:+pass=2 passlogfile=${stem}_vp8}}
-fi
# cleanup encoding cruft
rm -f $stem.xml $stem.wav $stem.mkv ${stem}_*.log ${stem}_*silent.webm