From e931053c03bca16f286e95c2dc4815d2e5268948 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Sun, 5 Oct 2014 00:19:41 +0200 Subject: Fix handle silent/silencing movies. --- localvideowebencode | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/localvideowebencode b/localvideowebencode index efdc405..c359f5a 100755 --- a/localvideowebencode +++ b/localvideowebencode @@ -403,7 +403,7 @@ elif [ -n "$silence" ]; then fi fi [ -z "$silence" ] || channels= -if [ -n "$stereo$mono$silence" ]; then +if [ -n "$stereo$mono" ]; then # melt cannot downmix with (stereo?) filters applied (bug#763911) if [ -n "$audioprefilters$compress$loudness$limit$filters" ]; then if [ -z "${webm:+$use_oggenc}${webm_vp9:+$use_opusenc}" ]; then @@ -463,21 +463,21 @@ _melt_wav="f=wav $_melt_downmix vn=1 video_off=1" _avconv_wav_in="-f wav" _oggenc_wav_in= _opusenc_wav_in= -_melt_ogg="f=ogg $_melt_video $_melt_theora $_melt_vorbis" +_melt_ogg="f=ogg $_melt_video $_melt_theora ${silence:+an=1 audio_off=1}${channels:+$_melt_vorbis}" _avconv_ogg_in="-f ogg" _avconv_ogg_vorbis="-f ogg -vn $_avconv_vorbis" _avconv_ogg_opus="-f ogg -vn $_avconv_opus" -_melt_webm="f=webm $_melt_video $_melt_vp8 $_melt_vorbis" -_avconv_webm="-f webm $_avconv_video $_avconv_vp8 $_avconv_vorbis" +_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_keepvideo="-f webm $_avconv_video -c:v copy $_avconv_vorbis" -_avconv_webm_keepvideo_opus="-f webm $_avconv_video -c:v copy $_avconv_opus" -_melt_webm_vp9="f=webm $_melt_video $_melt_vp9 $_melt_opus" -_avconv_webm_vp9="-f webm $_avconv_video $_avconv_vp9 $_avconv_opus" -_melt_mp4="f=mp4 $_melt_video $_melt_h264 $_melt_aac" +_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}" +_melt_mp4="f=mp4 $_melt_video $_melt_h264 ${silence:+an=1 audio_off=1}${channels:+$_melt_aac}" _melt_img="f=image2 $_melt_video" -[ -z "$loudness" ] || [ -n "$_melt_loudness" ] || do_loudness=yes +[ -n "$silence" ] || [ -z "$loudness" ] || [ -n "$_melt_loudness" ] || do_loudness=yes if [ -n "$multipass" ] && [ -n "$webm$vp9" ]; then echo "Analyzing video complexity${do_loudness:+ and audio dynamics}..." if [ -n "$use_vpxenc" ]; then @@ -514,7 +514,7 @@ if [ -n "$multipass" ] && [ -n "$webm$vp9" ]; then fi if [ -n "$use_oggenc$use_opusenc$use_vpxenc" ] && [ -n "$webm$vp9" ]; then - echo "Encoding raw video and extracting audio..." + echo "Encoding video${channels:+ and extracting audio...}" $melt ${_melt_sample:-$infiles} \ ${channels:+$audioprefilters \ ${_melt_loudness:+-filter loudness program=$lufs \ @@ -528,12 +528,12 @@ if [ -n "$use_oggenc$use_opusenc$use_vpxenc" ] && [ -n "$webm$vp9" ]; then ${webm:+"$vpxenc_chained - $_vpxenc_vp8 \ ${singlepass:+-p 1} \ ${multipass:+-p 2 --pass=2 --fpf=${stem}_vp8.log} \ - -o ${stem}_silent.webm"} \ + -o ${stem}${channels:+_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 + -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 $oggenc $_oggenc_wav_in $_oggenc_vorbis -o - $stem.wav \ @@ -547,7 +547,7 @@ if [ -n "$use_oggenc$use_opusenc$use_vpxenc" ] && [ -n "$webm$vp9" ]; then $_avconv_webm_keepvideo ${stem}.webm fi fi - if [ -n "$vp9" ]; then + if [ -n "$vp9" ] && [ -n "$channels" ]; 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 \ -- cgit v1.2.3