summaryrefslogtreecommitdiff
path: root/localvideowebencode
diff options
context:
space:
mode:
Diffstat (limited to 'localvideowebencode')
-rwxr-xr-xlocalvideowebencode48
1 files changed, 42 insertions, 6 deletions
diff --git a/localvideowebencode b/localvideowebencode
index c359f5a..acbcca5 100755
--- a/localvideowebencode
+++ b/localvideowebencode
@@ -183,6 +183,8 @@ stem=${stem:-$(basename "$infile_first" | perl -pe 's/\.[^.]*//')}
title=${title:-$stem}
# Use vpxenc for VP8 and VP9: CRF is apparently broken with libav
+#use_avconv_vp8=yes
+#use_avconv_vp9=yes
use_vpxenc=yes
#use_oggenc=yes
#use_opusenc=yes
@@ -470,10 +472,12 @@ _avconv_ogg_opus="-f ogg -vn $_avconv_opus"
_melt_webm="f=webm $_melt_video $_melt_vp8 ${silence:+an=1 audio_off=1}${channels:+$_melt_vorbis}"
_avconv_webm="-f webm $_avconv_video $_avconv_vp8 ${silence:+-an}${channels:+ $_avconv_vorbis}"
_avconv_webm_in="-f webm"
+_avconv_webm_onlyvideo="-f webm $_avconv_video $_avconv_vp8 -an}"
_avconv_webm_keepvideo="-f webm $_avconv_video -c:v copy ${silence:+-an}${channels:+$_avconv_vorbis}"
_avconv_webm_keepvideo_opus="-f webm $_avconv_video -c:v copy ${silence:+-an}${channels:+$_avconv_opus}"
_melt_webm_vp9="f=webm $_melt_video $_melt_vp9 ${silence:+an=1 audio_off=1}${channels:+$_melt_opus}"
_avconv_webm_vp9="-f webm $_avconv_video $_avconv_vp9 ${silence:+-an}${channels:+$_avconv_opus}"
+_avconv_webm_onlyvideo_vp9="-f webm $_avconv_video $_avconv_vp9 -an}"
_melt_mp4="f=mp4 $_melt_video $_melt_h264 ${silence:+an=1 audio_off=1}${channels:+$_melt_aac}"
_melt_img="f=image2 $_melt_video"
@@ -502,8 +506,8 @@ if [ -n "$multipass" ] && [ -n "$webm$vp9" ]; then
-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
+ [ -z "$webm" ] || [ -n "$use_avconv_vp8" ] || mv -f ${stem}_vp8-*.log ${stem}_vp8_2pass.log
+ [ -z "$vp9" ] || [ -n "$use_avconv_vp9" ] || mv -f ${stem}_vp9-*.log ${stem}_vp9_2pass.log
fi
if [ -n "$do_loudness" ]; then
_melt_loudness="$(perl -n \
@@ -525,14 +529,24 @@ if [ -n "$use_oggenc$use_opusenc$use_vpxenc" ] && [ -n "$webm$vp9" ]; then
${channels:+-consumer avformat:$stem.wav $_melt_wav} \
-consumer avformat:pipe:1 $_melt_yuv4mpeg2 \
| pee \
- ${webm:+"$vpxenc_chained - $_vpxenc_vp8 \
+ ${webm:+${use_avconv_vp8:+"$avconv_chained \
+ $_avconv_yuv4mpeg2_in -i pipe:0 \
+ $_avconv_webm_onlyvideo \
+ ${multipass:+-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} \
- -o ${stem}${channels:+_silent}.webm"} \
- ${vp9:+"$vpxenc_chained - $_vpxenc_vp9 \
+ -o ${stem}${channels:+_silent}.webm"}} \
+ ${vp9:+${use_avconv_vp9:+"$avconv_chained \
+ $_avconv_yuv4mpeg2_in -i pipe:0 \
+ $_avconv_webm_onlyvideo_vp9 \
+ ${multipass:+-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} \
- -o ${stem}_vp9${channels:+_silent}.webm"}
+ -o ${stem}_vp9${channels:+_silent}.webm"}}
if [ -n "$webm" ] && [ -n "$channels" ]; then
echo "Encoding Vorbis audio and muxing with VP8 video..."
if [ -n "$use_oggenc" ]; then
@@ -561,6 +575,28 @@ if [ -n "$use_oggenc$use_opusenc$use_vpxenc" ] && [ -n "$webm$vp9" ]; then
$_avconv_webm_keepvideo_opus ${stem}_vp9.webm
fi
fi
+elif [ -n "$use_avconv_vp8$use_avconv_vp9" ] && [ -n "$webm$vp9" ]; then
+ echo "Encoding video..."
+ $melt ${_melt_sample:-$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:+-consumer avformat:$stem.mp4 $_melt_mp4} \
+ ${channels:+-consumer avformat:$stem.wav $_melt_wav} \
+ -consumer avformat:pipe:1 $_melt_yuv4mpeg2 \
+ | pee \
+ ${webm:+${use_avconv_vp8:+"$avconv_chained \
+ $_avconv_yuv4mpeg2_in -i pipe:0 \
+ $_avconv_webm \
+ ${multipass:+-pass 2 -passlogfile ${stem}_vp8} \
+ ${stem}.webm"}} \
+ ${vp9:+${use_avconv_vp9:+"$avconv_chained \
+ $_avconv_yuv4mpeg2_in -i pipe:0 \
+ $_avconv_webm_vp9 \
+ ${multipass:+-pass 2 -passlogfile ${stem}_vp9} \
+ ${stem}_vp9.webm"}}
else
echo "Encoding video..."
$melt ${_melt_sample:-$infiles} \