diff options
-rwxr-xr-x | localvideowebencode | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/localvideowebencode b/localvideowebencode index 2c19cc1..bbaa21b 100755 --- a/localvideowebencode +++ b/localvideowebencode @@ -483,14 +483,21 @@ _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" -[ -n "$silence" ] || [ -z "$loudness" ] || [ -n "$_melt_loudness" ] || do_loudness=yes +if [ -n "$loudness" ] && [ -z "$silence$_melt_loudness" ]; then + echo "Analyzing audio dynamics..." + $melt $_melt_infiles \ + $audioprefilters -filter loudness $filters \ + -consumer xml:$stem.xml video_off=1 all=1 + _melt_loudness="$(perl -n \ + -e 'm!<(property) name="results">([^<]+)</\1>! and print $2' \ + $stem.xml)" + echo "Loudness data: $_melt_loudness" +fi + if [ -n "$multipass" ] && [ -n "$webm$vp9" ]; then - echo "Analyzing video complexity${do_loudness:+ and audio dynamics}..." + echo "Analyzing video complexity..." if [ -n "$use_vpxenc" ]; then - $melt $_melt_infiles \ - ${do_loudness:+$audioprefilters -filter loudness} \ - $filters \ - ${do_loudness:+-consumer xml:$stem.xml video_off=1 all=1} \ + $melt $_melt_infiles $filters \ -consumer avformat:pipe:1 $_melt_yuv4mpeg2 \ | pee \ ${webm:+"$vpxenc_chained - $_vpxenc_vp8 \ @@ -498,10 +505,7 @@ if [ -n "$multipass" ] && [ -n "$webm$vp9" ]; then ${vp9:+"$vpxenc_chained - $_vpxenc_vp9 \ -p 2 --pass=1 --fpf=${stem}_vp9.log -o /dev/null"} else - $melt $_melt_infiles \ - ${do_loudness:+$audioprefilters -filter loudness} \ - $filters \ - ${do_loudness:+-consumer xml:$stem.xml video_off=1 all=1} \ + $melt $_melt_infiles $filters \ -consumer avformat:pipe:1 $_melt_yuv4mpeg2 \ | $avconv_chained $_avconv_yuv4mpeg2_in -i pipe:0 \ ${webm:+$_avconv_rawvideo $_avconv_vp8 -an \ @@ -511,12 +515,6 @@ if [ -n "$multipass" ] && [ -n "$webm$vp9" ]; then [ -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 \ - -e 'm!<(property) name="results">([^<]+)</\1>! and print $2' \ - $stem.xml)" - echo "Loudness data: $_melt_loudness" - fi fi if [ -n "$use_oggenc$use_opusenc$use_vpxenc" ] && [ -n "$webm$vp9" ]; then |