summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2014-09-22 02:52:01 +0200
committerJonas Smedegaard <dr@jones.dk>2014-09-22 03:54:59 +0200
commit693aa11e667b7b6d861c56fede7c31634aeef85d (patch)
treef50ddffce0fdd04a5e126147685469aea410150c
parent71a1047188418f6b407d70c115249b97bf6db0e1 (diff)
Add option --loudness, and don't apply that (only limiter) to speech.
-rwxr-xr-xlocalvideowebencode16
1 files changed, 10 insertions, 6 deletions
diff --git a/localvideowebencode b/localvideowebencode
index b910f9e..b7b9ac1 100755
--- a/localvideowebencode
+++ b/localvideowebencode
@@ -73,12 +73,14 @@ 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 normalize
+ channels compress limit
music max 2
hqspeech 1
- speech 1 X X
+ speech 1 X X
silence 0
(default: none - use input channel count)
+ --loudness [data] Apply EBU R128 loudness filter, optionally with
+ precomputed results.
--filter Add melt filter (applied to all input files)
--stem Stem of output filenames, optionally with path
(default: basename of last input file)
@@ -123,7 +125,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:,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:,loudness::,filter:,stem:,title:,sample:: -n "$PRG" -- "$@"`" || exit1 "Internal getopt error."
eval set -- "$TEMP"
while true ; do
case "$1" in
@@ -140,6 +142,7 @@ while true ; do
--h264preset) h264preset="$2"; shift 2;;
--webmpreset) webmpreset="$2"; shift 2;;
--audio) audio="$2"; shift 2;;
+ --loudness) loudness=yes; loudness_results="$2"; shift 2;;
--filter) filters="${filters:+$filters }-filter $2"; shift 2;;
--stem) stem="$2"; shift 2;;
-t|--title) title="$2"; shift 2;;
@@ -321,7 +324,8 @@ case "$audio" in
bitrate_vorbis=48
bitrate_aac=64
compress=yes
- normalize=yes
+ [ -z "$melt_recent" ] || _melt_loudness="$loudness_results"
+ limit=yes
;;
silence)
channels=0
@@ -347,13 +351,13 @@ _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="${normalize:+-filter ladspa.1077}"
+_melt_audio_filters="${limit:+-filter ladspa.1077}"
_melt_vorbis="$_melt_audio acodec=libvorbis ab=$(($channels*$bitrate_vorbis))k"
_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 "$normalize" ] && [ -n "$melt_recent" ] && [ -n "$channels" ]; then
+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_loudness="$(perl -ne 'm!<property name="results">([^<]+)</property>! and print $1' $stem.xml)"
fi