summaryrefslogtreecommitdiff
path: root/localvideowebencode
diff options
context:
space:
mode:
Diffstat (limited to 'localvideowebencode')
-rwxr-xr-xlocalvideowebencode13
1 files changed, 7 insertions, 6 deletions
diff --git a/localvideowebencode b/localvideowebencode
index 1d1564c..1ed0703 100755
--- a/localvideowebencode
+++ b/localvideowebencode
@@ -106,25 +106,26 @@ title=${title:-$filebase}
# TODO: Check and fail if all needed tools are not available
# TODO: When verified beneficial, add option real_time=-2
-opts_common="${bitrate:+b=${bitrate}} ${size:+s=$size} ${aspect:+aspect=$aspect}"
-opts_audio="ac=2 ar=44100 ab=96k"
+opts="${profile:+-profile $profile}"
+args=" ${bitrate:+b=${bitrate}} ${size:+s=$size} ${aspect:+aspect=$aspect}"
+args_audio="ac=2 ar=44100 ab=96k"
# bail out (before any expensive tasks) if logfiles exists
[ ! -f x264-*.log* ] || exit1 "logfiles already exist. Remove them (or wait for that other process using them to complete) and try again."
## Theora/Vorbis/Ogg
-melt -consumer avformat:"$filebase.ogg" f=ogg vcodec=libtheora $opts_common acodec=libvorbis aq=25 $opts_audio "$@"
+melt $opts -consumer avformat:"$filebase.ogg" f=ogg vcodec=libtheora $args acodec=libvorbis aq=25 $args_audio "$@"
## H.264/AAC/MP4
-melt -consumer avformat:/dev/null f=mp4 properties=x264-medium-$h264profile $opts_common pass=1 an=1 fastfirstpass=1 "$@"
-melt -consumer avformat:"$filebase.mp4" properties=x264-medium-$h264profile $opts_common pass=2 acodec=libvo_aacenc $opts_audio "$@"
+melt $opts -consumer avformat:/dev/null f=mp4 properties=x264-medium-$h264profile $args pass=1 an=1 fastfirstpass=1 "$@"
+melt $opts -consumer avformat:"$filebase.mp4" properties=x264-medium-$h264profile $args pass=2 acodec=libvo_aacenc $args_audio "$@"
mv "$filebase.mp4" "$filebase.mp4"~
qt-faststart "$filebase.mp4"~ "$filebase.mp4"
[ -f "$filebase.mp4" ] && rm "$filebase.mp4"~ || exit1 "failed to optimize with qt-faststart."
## VP8/Vorbis/WebM
# TODO: use two-pass when supported by melt
-melt -consumer avformat:"$filebase.webm" properties=webm $opts_common $opts_audio "$@"
+melt $opts -consumer avformat:"$filebase.webm" properties=webm $args $args_audio "$@"
## JPEG preview
ffmpegthumbnailer -s0 -i "$filebase.mp4" -o "$filebase.jpg"