summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2014-09-29 10:02:53 +0200
committerJonas Smedegaard <dr@jones.dk>2014-09-29 10:02:53 +0200
commit8fc1c7babbe4554c027df73e1cea39f95ae5220a (patch)
treef8aec0ddebfe6b97fe5c63d7e682825f615c8fb7
parent5741b6aea1f58642df32caf16f96f82dc06255ad (diff)
Tidy TODOs and other comments.
-rwxr-xr-xlocalvideowebencode26
1 files changed, 14 insertions, 12 deletions
diff --git a/localvideowebencode b/localvideowebencode
index 31844b7..76a349e 100755
--- a/localvideowebencode
+++ b/localvideowebencode
@@ -17,8 +17,17 @@
#
# Depends: libav-tools melt mediainfo
#
-# TODO: offer to skip rendering again if an output file exist already
-# TODO: support --width and --height (resolving the other part from input/forced aspect ratio)
+# TODO:
+# * Offer to skip rendering again if an output file exist already.
+# * Support --width and --height, resolving the other part from input
+# or forced aspect ratio.
+# * Drop $melt_recent flag when melt 0.9.2 is stable.
+# * Check and fail if all needed tools are not available.
+# * Test if beneficial to apply real_time=-2.
+# * Normalize each infile separately when xml fed as infile keeps sync.
+# Maybe as workaround re-feed audio separately from xml, as done at
+# <http://bernaerts.dyndns.org/linux/74-ubuntu/214-ubuntu-stabilize-video-melt>.
+# * Resolve flash player to use.
set -e
@@ -147,7 +156,6 @@ while true ; do
done
# Resolve if melt is version 0.9.2 or newer
-# TODO: drop when melt 0.9.2 is stable
melt_recent=$(melt -query filter=loudness | grep -qi R128 && echo yes)
# sanitize infiles
@@ -159,6 +167,7 @@ infile_first=$(perl -e 'print pop @ARGV' $infiles)
stem=${stem:-$(basename "$infile_first" | perl -pe 's/\.[^.]*//')}
title=${title:-$stem}
+# parse/resolve size and framerate
case "$profile" in
'') :;;
*@*)
@@ -182,7 +191,6 @@ EOF
;;
esac
size=${size:-$profilesize}
-
case "$size" in
qvga) size=320x240;;
hvga) size=480x360;;
@@ -195,7 +203,6 @@ case "$size" in
576p|wsvga) size=1024x576;;
720p|wxga|hd) size=1280x720;;
esac
-
if [ -n "$size" ]; then
while read w h foo; do
width="${width:-$w}"
@@ -207,7 +214,6 @@ EOF
exit1 "Failed to parse size \"$size\"."
fi
fi
-
case "$framerate" in
*/*)
while read d n foo; do
@@ -223,6 +229,7 @@ EOF
;;
esac
+# resolve input size and framerate (needed for computing bitrate)
while read w h r foo; do
width_in="${width_in:-$w}"
height_in="${height_in:-$h}"
@@ -320,9 +327,6 @@ esac
[ $channels -le $maxchannels ] || channels=$maxchannels
[ $channels -gt 0 ] || channels=
-# TODO: Check and fail if all needed tools are not available
-
-# TODO: When verified beneficial, add option real_time=-2
melt="melt -progress"
_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}"
@@ -344,7 +348,6 @@ _avconv_vp8="-c:v libvpx -pre:v libvpx-$webmpreset${bitrate:+ -b:v $bitrate}${bi
_avconv_vp9="-c:v libvpx-vp9 -pre:v libvpx-$webmpreset${bitrate_vp9:+ -b:v $bitrate_vp9}${bitrate_fixed:+ -minrate $bitrate_vp9 -maxrate $bitrate_vp9}${bitrate_variable:+ -crf 10} -cpu-used 5"
# resolve EBU R128 audio normalizing
-# TODO: normalize each infile separately when xml fed as infile keeps sync
if [ -n "$loudness" ] && [ -z "$_melt_loudness" ]; then
echo "Analyzing loudness data..."
$melt ${_melt_sample:-$infiles} $audioprefilters -filter loudness -consumer xml:$stem.xml $_melt_audio video_off=1 all=1
@@ -387,7 +390,7 @@ fi
# cleanup audio normalize hinting
rm -f $stem.xml
-## JPEG preview
+# JPEG preview
$melt $infile_first in=0 out=0 \
-group $filters \
-consumer avformat:$stem.jpg $_melt_img
@@ -400,7 +403,6 @@ _source_ogg="<source src=\"$stem.ogv\" type=\"video/ogg\" />"
_source_webm="<source src=\"$stem.webm\" type=\"video/webm\" />"
_source_vp9="<source src=\"${stem}_vp9.webm\" type='video/ogg; codecs=\"vp9, opus\"' />"
_source_mp4="<source src=\"$stem.mp4\" type=\"video/mp4\" />"
-# TODO: resolve flash player to use
[ -z "$flashplayer" ] || flash=yes
[ -n "$mp4" ] || [ -z "$flash" ] || error1 "Cannot enable flash when mp4 format is disabled."
_object_flash="<object$__width$__heightplus type=\"application/x-shockwave-flash\" data=\"$flashplayer.swf\">"