summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xlocalvideowebencode19
1 files changed, 16 insertions, 3 deletions
diff --git a/localvideowebencode b/localvideowebencode
index 26e8860..18a278b 100755
--- a/localvideowebencode
+++ b/localvideowebencode
@@ -357,6 +357,10 @@ _melt_vorbis="$_melt_audio acodec=libvorbis ab=$(($channels*$bitrate_vorbis))k"
_melt_opus="$_melt_audio acodec=libopus ab=$(($channels*$bitrate_opus))k"
_melt_aac="$_melt_audio acodec=aac ab=$(($channels*$bitrate_aac))k"
+avconv="avconv -threads auto -y"
+_avconv_vp8="-c:v libvpx${bitrate:+ -b:v $bitrate} -pre:v libvpx-$webmpreset${bitrate_fixed:- -crf 10} -cpu-used 3"
+_avconv_vp9="-c:v libvpx-vp9${bitrate_vp9:+ -b:v $bitrate_vp9} -pre:v libvpx-$webmpreset${bitrate_fixed:- -crf 10} -cpu-used 5"
+
# resolve EBU R128 audio normalizing
# TODO: normalize each infile separately when xml fed as infile keeps sync
if [ -n "$loudness" ] && [ -z "$_melt_loudness" ]; then
@@ -369,14 +373,23 @@ if [ -n "$mp4" ] && [ -n "$bitrate_fixed" ]; then
-consumer avformat:/dev/null pass=1 fastfirstpass=1 an=1 audio_off=1 $_melt_h264 $_melt_out
fi
-# TODO: always use two-pass for webm when supported by melt
+if [ -n "$webm$vp9" ]; then
+ $melt -group $_melt_in $infiles -group $filters \
+ -consumer avformat:pipe:1 $_melt_video f=yuv4mpegpipe pix_fmt=yuv420p \
+ | $avconv -i pipe:0 \
+ ${webm:+-f rawvideo $_avconv_vp8 -an -pass 1 -passlogfile ${stem}_vp8 /dev/null} \
+ ${vp9:+-f 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
+
$melt -group $_melt_in $infiles \
-group ${channels:+$audioprefilters${_melt_loudness:+ -filter loudness results="$_melt_loudness"}} \
$filters${channels:+ $_melt_postfilters_audio} \
${ogg:+-consumer avformat:$stem.ogv $_melt_ogg $_melt_vorbis $_melt_out} \
${mp4:+-consumer avformat:$stem.mp4${bitrate_fixed:+ pass=2} $_melt_h264 $_melt_aac $_melt_out} \
- ${webm:+-consumer avformat:$stem.webm $_melt_webm $_melt_vorbis $_melt_out} \
- ${vp9:+-consumer avformat:${stem}_vp9.webm $_melt_vp9 $_melt_opus $_melt_out}
+ ${webm:+-consumer avformat:$stem.webm $_melt_webm$ pass=2 passlogfile=${stem}_vp8 $_melt_vorbis $_melt_out} \
+ ${vp9:+-consumer avformat:${stem}_vp9.webm pass=2 passlogfile=${stem}_vp9 $_melt_vp9 $_melt_opus $_melt_out}
if [ -n "$mp4" ] && [ -z "$melt_recent" ]; then
mv "$stem.mp4" "$stem.mp4"~