summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2012-07-12 12:36:24 +0200
committerJonas Smedegaard <dr@jones.dk>2012-07-12 12:36:24 +0200
commit7cc19430c7c8fc1f6b7e941d9677fb95de79bb67 (patch)
treec6dd2b374b4b24a0c85ce5fe3013e2f02f78c658
parentbd744f1b8e84994c735d33bdec16b8d88754ad9a (diff)
Support adding a global melt --filter.
-rwxr-xr-xlocalvideowebencode19
1 files changed, 14 insertions, 5 deletions
diff --git a/localvideowebencode b/localvideowebencode
index 630b58c..0e64f70 100755
--- a/localvideowebencode
+++ b/localvideowebencode
@@ -37,6 +37,7 @@ html favoring open formats with optional non-JavaScript Flash fallback.
(default: basename of last input file)
-t, --title Title used in html fallback graphics
(default: stem)
+ --filter Add melt filter (applied to all input files)
-h, --help This help text
Examples:
@@ -69,7 +70,7 @@ bitrate=768k
h264profile=baseline
# parse cmdline options
-TEMP="`getopt -s sh -o hs:a:b:p:t: -l help,size:,aspect:,bitrate:,profile:,h264profile:,stem:,title: -n "$PRG" -- "$@"`" || exit1 "Internal getopt error."
+TEMP="`getopt -s sh -o hs:a:b:p:t: -l help,size:,aspect:,bitrate:,profile:,h264profile:,stem:,title:,filter: -n "$PRG" -- "$@"`" || exit1 "Internal getopt error."
eval set -- "$TEMP"
while true ; do
case "$1" in
@@ -81,6 +82,14 @@ while true ; do
--h264profile) h264profile="$2"; shift 2;;
--stem) stem="$2"; shift 2;;
-t|--title) title="$2"; shift 2;;
+ --filter) filters="${filters:+$filters }-filter $2"; shift 2
+ while [ $# -gt 0 ] ; do
+ case "$1" in
+ *=*) filters="${filters:+$filters }$1"; shift;;
+ *) break;;
+ esac
+ done
+ ;;
--) shift; break;;
*) exit1 "Internal error resolving options.";;
esac
@@ -121,18 +130,18 @@ args=" ${bitrate:+b=${bitrate}} ${size:+s=$size} ${aspect:+aspect=$aspect}"
args_audio="ac=2 ar=44100 ab=96k"
## Theora/Vorbis/Ogg
-melt -group $args_in $infiles -group -consumer avformat:"$stem.ogg" f=ogg vcodec=libtheora $args acodec=libvorbis aq=25 $args_audio $args_out
+melt -group $args_in $infiles -group $filters -consumer avformat:"$stem.ogg" f=ogg vcodec=libtheora $args acodec=libvorbis aq=25 $args_audio $args_out
## H.264/AAC/MP4
-melt -group $args_in $infiles -group -consumer avformat:/dev/null f=mp4 properties=x264-medium-$h264profile $args pass=1 an=1 fastfirstpass=1 $args_out
-melt -group $args_in $infiles -group -consumer avformat:"$stem.mp4" properties=x264-medium-$h264profile $args pass=2 acodec=libvo_aacenc $args_audio $args_out
+melt -group $args_in $infiles -group $filters -consumer avformat:/dev/null f=mp4 properties=x264-medium-$h264profile $args pass=1 an=1 fastfirstpass=1 $args_out
+melt -group $args_in $infiles -group $filters -consumer avformat:"$stem.mp4" properties=x264-medium-$h264profile $args pass=2 acodec=libvo_aacenc $args_audio $args_out
mv "$stem.mp4" "$stem.mp4"~
qt-faststart "$stem.mp4"~ "$stem.mp4"
[ -f "$stem.mp4" ] && rm "$stem.mp4"~ || exit1 "failed to optimize with qt-faststart."
## VP8/Vorbis/WebM
# TODO: use two-pass when supported by melt
-melt -group $args_in $infiles -group -consumer avformat:"$stem.webm" properties=webm $args $args_audio $args_out
+melt -group $args_in $infiles -group $filters -consumer avformat:"$stem.webm" properties=webm $args $args_audio $args_out
## JPEG preview
ffmpegthumbnailer -s0 -i "$stem.mp4" -o "$stem.jpg"