diff options
-rwxr-xr-x | localvideowebencode | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/localvideowebencode b/localvideowebencode index 313298d..676c324 100755 --- a/localvideowebencode +++ b/localvideowebencode @@ -327,7 +327,7 @@ esac # TODO: When verified beneficial, add option real_time=-2 melt="melt -progress" -_melt_in="${sample:+in=${samplestart:-0} out=$((${samplestart:-0} + samplelength))}" +_melt_sample="$infile_first ${sample:+in=${samplestart:-0} out=$((${samplestart:-0} + samplelength))}" _melt_video="progressive=1${framerate:+ frame_rate_den="$framerate_den" frame_rate_num="$framerate_num"}${size:+ s=${width:+$width}x${height:+$height}}${aspect:+ aspect=$aspect}" _melt_ogg="$_melt_video f=ogg vcodec=libtheora${bitrate:+ vb=$bitrate}${bitrate_fixed:- qscale=5}" _melt_h264="$_melt_video f=mp4 vcodec=libx264 vpre=medium vprofile=baseline${x264tune:+ tune=$x264tune}${bitrate_fixed:+ vb=$bitrate} threads=0 movflags=+faststart${bitrate_fixed:- crf=23}" @@ -350,20 +350,20 @@ _avconv_vp9="-c:v libvpx-vp9 -pre:v libvpx-$webmpreset${bitrate_vp9:+ -b:v $bitr # TODO: normalize each infile separately when xml fed as infile keeps sync if [ -n "$loudness" ] && [ -z "$_melt_loudness" ]; then echo "Analyzing loudness data..." - $melt -group $_melt_in $infiles -group $audioprefilters -filter loudness -consumer xml:$stem.xml $_melt_audio video_off=1 all=1 + $melt ${_melt_sample:-$infiles} $audioprefilters -filter loudness -consumer xml:$stem.xml $_melt_audio video_off=1 all=1 _melt_loudness="$(perl -ne 'm!<property name="results">([^<]+)</property>! and print $1' $stem.xml)" echo "Loudness data: $_melt_loudness" fi if [ -n "$mp4" ] && [ -n "$bitrate_fixed" ]; then echo "Analyzing complexity for MPEG-4..." - $melt -group $_melt_in $infiles -group $filters \ + $melt ${_melt_sample:-$infiles} $filters \ -consumer avformat:/dev/null pass=1 fastfirstpass=1 an=1 audio_off=1 $_melt_h264 fi if [ -n "$webm$vp9" ]; then echo "Analyzing complexity for WebM..." - $melt -group $_melt_in $infiles -group $filters \ + $melt ${_melt_sample:-$infiles} $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} \ @@ -373,8 +373,8 @@ if [ -n "$webm$vp9" ]; then fi echo "Encoding video..." -$melt -group $_melt_in $infiles \ - -group ${channels:+$audioprefilters${_melt_loudness:+ -filter loudness results="$_melt_loudness"}} \ +$melt ${_melt_sample:-$infiles} \ + ${channels:+$audioprefilters${_melt_loudness:+ -filter loudness results="$_melt_loudness"}} \ $filters${channels:+ $_melt_postfilters_audio} \ ${ogg:+-consumer avformat:$stem.ogv $_melt_ogg $_melt_vorbis} \ ${mp4:+-consumer avformat:$stem.mp4${bitrate_fixed:+ pass=2} $_melt_h264 $_melt_aac} \ @@ -391,7 +391,7 @@ fi rm -f $stem.xml ## JPEG preview -$melt -group in=0 out=0 $infiles \ +$melt $infile_first in=0 out=0 \ -group $filters \ -consumer avformat:$stem.jpg $_melt_img |