summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2014-09-22 03:04:39 +0200
committerJonas Smedegaard <dr@jones.dk>2014-09-22 03:55:00 +0200
commitf658e7820f55882ebf3fae349bda04ec538cc288 (patch)
tree81a6275079ca58ff844a1227c38e62e404f654b3
parent693aa11e667b7b6d861c56fede7c31634aeef85d (diff)
Add option --audioprefilter, and don't expand or compress speech.
-rwxr-xr-xlocalvideowebencode18
1 files changed, 9 insertions, 9 deletions
diff --git a/localvideowebencode b/localvideowebencode
index b7b9ac1..cba1c78 100755
--- a/localvideowebencode
+++ b/localvideowebencode
@@ -73,12 +73,13 @@ html favoring open formats with optional non-JavaScript Flash fallback.
--webmpreset WebM target preset: 360p 720p 720p50_60 etc.
(default: profile-related or 360p)
--audio Audio style:
- channels compress limit
+ channels limit
music max 2
hqspeech 1
- speech 1 X X
+ speech 1 X
silence 0
(default: none - use input channel count)
+ --audioprefilter Add melt audio filter before loudness.
--loudness [data] Apply EBU R128 loudness filter, optionally with
precomputed results.
--filter Add melt filter (applied to all input files)
@@ -125,7 +126,7 @@ h264profile=baseline
samplelength=150
# parse cmdline options
-TEMP="`getopt -s sh -o hp:s:a:r:b:t: -l help,profile:,size:,aspect:,rate:,video:,refbpp:,bitrate:,formats:,h264profile:,h264preset:,webmpreset:,audio:,loudness::,filter:,stem:,title:,sample:: -n "$PRG" -- "$@"`" || exit1 "Internal getopt error."
+TEMP="`getopt -s sh -o hp:s:a:r:b:t: -l help,profile:,size:,aspect:,rate:,video:,refbpp:,bitrate:,formats:,h264profile:,h264preset:,webmpreset:,audio:,audioprefilter:,loudness::,filter:,stem:,title:,sample:: -n "$PRG" -- "$@"`" || exit1 "Internal getopt error."
eval set -- "$TEMP"
while true ; do
case "$1" in
@@ -142,6 +143,7 @@ while true ; do
--h264preset) h264preset="$2"; shift 2;;
--webmpreset) webmpreset="$2"; shift 2;;
--audio) audio="$2"; shift 2;;
+ --audioprefilter) audioprefilters="${audioprefilters:+$audioprefilters }-filter $2"; shift 2;;
--loudness) loudness=yes; loudness_results="$2"; shift 2;;
--filter) filters="${filters:+$filters }-filter $2"; shift 2;;
--stem) stem="$2"; shift 2;;
@@ -348,8 +350,6 @@ _melt_ogg="$_melt_video f=ogg vcodec=libtheora${bitrate_fixed:- qscale=5}"
_melt_h264="$_melt_video $_melt_h264${bitrate_fixed:- qscale=5}"
_melt_webm="$_melt_video vpre=libvpx-${webmpreset:-360p}"
_melt_audio="${channels:+ac=$channels}"
-# expand and compress (i.e. lower volume on silent and loud passages)
-_melt_audio_filters_early="${compress:+-filter ladspa.1075 -filter ladspa.1073}"
# limit (i.e. avoid peaks "clipping")
_melt_audio_filters="${limit:+-filter ladspa.1077}"
_melt_vorbis="$_melt_audio acodec=libvorbis ab=$(($channels*$bitrate_vorbis))k"
@@ -358,17 +358,17 @@ _melt_aac="$_melt_audio acodec=aac ab=$(($channels*$bitrate_aac))k"
# resolve EBU R128 audio normalizing
# TODO: normalize each infile separately when xml fed as infile keeps sync
if [ -n "$loudness" ] && [ -z "$_melt_loudness" ]; then
- $melt -group $_melt_in $infiles -group $_melt_audio_filters_early -filter loudness -consumer xml:$stem.xml $_melt_audio video_off=1 all=1
+ $melt -group $_melt_in $infiles -group $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)"
fi
if [ -n "$ogg" ]; then
- $melt -group $_melt_in $infiles -group ${channels:+$_melt_audio_filters_early${_melt_loudness:+ -filter loudness results="$_melt_loudness"} $_melt_audio_filters }$filters -consumer avformat:"$stem.ogv" $_melt_ogg $_melt_vorbis $_melt_out
+ $melt -group $_melt_in $infiles -group ${channels:+$audioprefilters${_melt_loudness:+ -filter loudness results="$_melt_loudness"} $_melt_audio_filters }$filters -consumer avformat:"$stem.ogv" $_melt_ogg $_melt_vorbis $_melt_out
fi
if [ -n "$mp4" ]; then
[ -z "$bitrate_fixed" ] || $melt -group $_melt_in $infiles -group $filters -consumer avformat:/dev/null properties=x264-medium-pass1 $_melt_h264 $_melt_out
- $melt -group $_melt_in $infiles -group ${channels:+$_melt_audio_filters_early${_melt_loudness:+ -filter loudness results="$_melt_loudness"} $_melt_audio_filters }$filters -consumer avformat:"$stem.mp4" ${bitrate_fixed:+pass=2} $_melt_h264 $_melt_aac $_melt_out
+ $melt -group $_melt_in $infiles -group ${channels:+$audioprefilters${_melt_loudness:+ -filter loudness results="$_melt_loudness"} $_melt_audio_filters }$filters -consumer avformat:"$stem.mp4" ${bitrate_fixed:+pass=2} $_melt_h264 $_melt_aac $_melt_out
if [ -z "$melt_recent" ]; then
mv "$stem.mp4" "$stem.mp4"~
qt-faststart "$stem.mp4"~ "$stem.mp4"
@@ -378,7 +378,7 @@ fi
if [ -n "$webm" ]; then
# TODO: use two-pass when supported by melt
- $melt -group $_melt_in $infiles -group ${channels:+$_melt_audio_filters_early${_melt_loudness:+ -filter loudness results="$_melt_loudness"} $_melt_audio_filters }$filters -consumer avformat:"$stem.webm" properties=webm $_melt_webm $_melt_vorbis $_melt_out
+ $melt -group $_melt_in $infiles -group ${channels:+$audioprefilters${_melt_loudness:+ -filter loudness results="$_melt_loudness"} $_melt_audio_filters }$filters -consumer avformat:"$stem.webm" properties=webm $_melt_webm $_melt_vorbis $_melt_out
fi
# cleanup audio normalize hinting