summaryrefslogtreecommitdiff
path: root/localvideowebencode
diff options
context:
space:
mode:
Diffstat (limited to 'localvideowebencode')
-rwxr-xr-xlocalvideowebencode87
1 files changed, 58 insertions, 29 deletions
diff --git a/localvideowebencode b/localvideowebencode
index 22805c7..52452e1 100755
--- a/localvideowebencode
+++ b/localvideowebencode
@@ -284,7 +284,8 @@ while read w h r s foo; do
framerate_in="${framerate_in:-$r}"
scantype_in="${scantype_in:-$s}"
done << EOF
-$(mediainfo --Inform="Video;%Width% %Height% %FrameRate% %ScanType%" "$infile_first")
+$(mediainfo --Inform="Video;%Width% %Height% %FrameRate% %ScanType%" \
+ "$infile_first")
EOF
[ Progressive = "$scantype_in" ] || do_deinterlace=yes
@@ -489,8 +490,10 @@ if [ -n "$multipass" ] && [ -n "$webm$vp9" ]; then
${do_loudness:+-consumer xml:$stem.xml video_off=1 all=1} \
-consumer avformat:pipe:1 $_melt_yuv4mpeg2 \
| pee \
- ${webm:+"$vpxenc_chained - $_vpxenc_vp8 -p 2 --pass=1 --fpf=${stem}_vp8.log -o /dev/null"} \
- ${vp9:+"$vpxenc_chained - $_vpxenc_vp9 -p 2 --pass=1 --fpf=${stem}_vp9.log -o /dev/null"}
+ ${webm:+"$vpxenc_chained - $_vpxenc_vp8 \
+ -p 2 --pass=1 --fpf=${stem}_vp8.log -o /dev/null"} \
+ ${vp9:+"$vpxenc_chained - $_vpxenc_vp9 \
+ -p 2 --pass=1 --fpf=${stem}_vp9.log -o /dev/null"}
else
$melt ${_melt_sample:-$infiles} \
${do_loudness:+$audioprefilters -filter loudness} \
@@ -498,13 +501,17 @@ if [ -n "$multipass" ] && [ -n "$webm$vp9" ]; then
${do_loudness:+-consumer xml:$stem.xml video_off=1 all=1} \
-consumer avformat:pipe:1 $_melt_yuv4mpeg2 \
| $avconv_chained $_avconv_yuv4mpeg2_in -i pipe:0 \
- ${webm:+$_avconv_rawvideo $_avconv_vp8 -an -pass 1 -passlogfile ${stem}_vp8 /dev/null} \
- ${vp9:+$_avconv_rawvideo $_avconv_vp9 -an -pass 1 -passlogfile ${stem}_vp9 /dev/null}
+ ${webm:+$_avconv_rawvideo $_avconv_vp8 -an \
+ -pass 1 -passlogfile ${stem}_vp8 /dev/null} \
+ ${vp9:+$_avconv_rawvideo $_avconv_vp9 -an \
+ -pass 1 -passlogfile ${stem}_vp9 /dev/null}
[ -z "$webm" ] || mv -f ${stem}_vp8-*.log ${stem}_vp8_2pass.log
[ -z "$vp9" ] || mv -f ${stem}_vp9-*.log ${stem}_vp9_2pass.log
fi
if [ -n "$do_loudness" ]; then
- _melt_loudness="$(perl -ne 'm!<property name="results">([^<]+)</property>! and print $1' $stem.xml)"
+ _melt_loudness="$(perl -n \
+ -e 'm!<(property) name="results">([^<]+)</\1>! and print $2' \
+ $stem.xml)"
echo "Loudness data: $_melt_loudness"
fi
fi
@@ -512,41 +519,63 @@ fi
if [ -n "$use_oggenc$use_opusenc$use_vpxenc" ] && [ -n "$webm$vp9" ]; then
echo "Encoding raw video and extracting audio..."
$melt ${_melt_sample:-$infiles} \
- ${channels:+$audioprefilters${_melt_loudness:+ -filter loudness program=$lufs results="$_melt_loudness"}} \
+ ${channels:+$audioprefilters \
+ ${_melt_loudness:+-filter loudness program=$lufs \
+ results="$_melt_loudness"}} \
$filters${channels:+ $_melt_postfilters_audio} \
${ogg:+-consumer avformat:$stem.ogv $_melt_ogg} \
${mp4:+-consumer avformat:$stem.mp4 $_melt_mp4} \
${channels:+-consumer avformat:$stem.wav $_melt_wav} \
-consumer avformat:pipe:1 $_melt_yuv4mpeg2 \
| pee \
- ${webm:+"$vpxenc_chained - $_vpxenc_vp8${singlepass:+ -p 1}${multipass:+ -p 2 --pass=2 --fpf=${stem}_vp8.log} -o ${stem}_silent.webm"} \
- ${vp9:+"$vpxenc_chained - $_vpxenc_vp9${singlepass:+ -p 1}${multipass:+ -p 2 --pass=2 --fpf=${stem}_vp9.log} -o ${stem}_vp9_silent.webm"}
- if [ -n "$webm" ]; then
- echo "Encoding Vorbis audio and muxing with VP8 video..."
- if [ -n "$use_oggenc" ]; then
- $oggenc $_oggenc_wav_in $_oggenc_vorbis -o - $stem.wav \
- | $avconv_chained $_avconv_webm_in -i ${stem}_silent.webm $_avconv_ogg_in -i pipe:0 $_avconv_webm_keepvideo $stem.webm
- else
- $avconv $_avconv_webm_in -i ${stem}_silent.webm $_avconv_wav_in -i $stem.wav $_avconv_webm_keepvideo ${stem}.webm
- fi
+ ${webm:+"$vpxenc_chained - $_vpxenc_vp8 \
+ ${singlepass:+-p 1} \
+ ${multipass:+-p 2 --pass=2 --fpf=${stem}_vp8.log} \
+ -o ${stem}_silent.webm"} \
+ ${vp9:+"$vpxenc_chained - $_vpxenc_vp9 \
+ ${singlepass:+-p 1} \
+ ${multipass:+-p 2 --pass=2 --fpf=${stem}_vp9.log} \
+ -o ${stem}_vp9_silent.webm"}
+ if [ -n "$webm" ]; then
+ echo "Encoding Vorbis audio and muxing with VP8 video..."
+ if [ -n "$use_oggenc" ]; then
+ $oggenc $_oggenc_wav_in $_oggenc_vorbis -o - $stem.wav \
+ | $avconv_chained \
+ $_avconv_webm_in -i ${stem}_silent.webm \
+ $_avconv_ogg_in -i pipe:0 \
+ $_avconv_webm_keepvideo $stem.webm
+ else
+ $avconv $_avconv_webm_in -i ${stem}_silent.webm \
+ $_avconv_wav_in -i $stem.wav \
+ $_avconv_webm_keepvideo ${stem}.webm
fi
- if [ -n "$vp9" ]; then
- echo "Encoding Opus audio and muxing with WebM/VP9 video..."
- if [ -n "$use_opusenc" ]; then
- $opusenc $_opusenc_wav_in $_opusenc_opus -o - $stem.wav \
- | $avconv_chained $_avconv_webm_in -i ${stem}_vp9_silent.webm $_avconv_ogg_in -i pipe:0 $_avconv_webm_keepvideo_opus ${stem}_vp9.webm
- else
- $avconv $_avconv_webm_in -i ${stem}_vp9_silent.webm $_avconv_wav_in -i $stem.wav $_avconv_webm_keepvideo_opus ${stem}_vp9.webm
- fi
+ fi
+ if [ -n "$vp9" ]; then
+ echo "Encoding Opus audio and muxing with WebM/VP9 video..."
+ if [ -n "$use_opusenc" ]; then
+ $opusenc $_opusenc_wav_in $_opusenc_opus -o - $stem.wav \
+ | $avconv_chained \
+ $_avconv_webm_in -i ${stem}_vp9_silent.webm \
+ $_avconv_ogg_in -i pipe:0 \
+ $_avconv_webm_keepvideo_opus ${stem}_vp9.webm
+ else
+ $avconv $_avconv_webm_in -i ${stem}_vp9_silent.webm \
+ $_avconv_wav_in -i $stem.wav \
+ $_avconv_webm_keepvideo_opus ${stem}_vp9.webm
fi
+ fi
else
echo "Encoding video..."
$melt ${_melt_sample:-$infiles} \
- ${channels:+$audioprefilters${_melt_loudness:+ -filter loudness program=$lufs results="$_melt_loudness"}} \
+ ${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:+ pass=2 passlogfile=${stem}_vp8}} \
- ${vp9:+-consumer avformat:${stem}_vp9.webm $_melt_webm_vp9${multipass:+ pass=2 passlogfile=${stem}_vp9}} \
+ ${webm:+-consumer avformat:$stem.webm $_melt_webm \
+ ${multipass:+pass=2 passlogfile=${stem}_vp8}} \
+ ${vp9:+-consumer avformat:${stem}_vp9.webm $_melt_webm_vp9 \
+ ${multipass:+pass=2 passlogfile=${stem}_vp9}} \
${mp4:+-consumer avformat:$stem.mp4 $_melt_mp4}
fi
@@ -557,7 +586,7 @@ if [ -n "$mp4" ] && [ -z "$melt_recent" ]; then
fi
# cleanup encoding cruft
-rm -f $stem.xml $stem.wav ${stem}_vp8.log ${stem}_vp9.log ${stem}_silent.webm ${stem}_vp9_silent.webm
+rm -f $stem.xml $stem.wav ${stem}_*.log ${stem}_*silent.webm
# JPEG preview
$melt $infile_first in=0 out=0 \