From 2a69a771bb65230597a2b12574344ebe820c534e Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Sun, 21 Sep 2014 11:16:50 +0200 Subject: Generalize size resolving (avoiding dependency on jpeginfo). --- localvideowebencode | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/localvideowebencode b/localvideowebencode index b99fdd7..cd9c5e8 100755 --- a/localvideowebencode +++ b/localvideowebencode @@ -273,8 +273,11 @@ case "$h264profile" in *) exit1 "Unknown MPEG-4 AVC profile \"$h264profile\".";; esac -if [ -n "${width:-$width_in}" ] && [ -n "${height:-$height_in}" ]; then - _pixels="$((${width:-$width_in}*${height:-$height_in}))" +_width="${width:-$width_in}" +_height="${height:-$height_in}" + +if [ -n "$_width" ] && [ -n "$_height" ]; then + _pixels="$(($_width*$_height))" fi _frames="${framerate:-$framerate_in}" @@ -370,25 +373,24 @@ rm -f $stem.xml ## JPEG preview ffmpegthumbnailer -s0 -i "$stem.mp4" -o "$stem.jpg" -# resolve width and height from preview image -size=$(jpeginfo "$stem.jpg" | perl -ane 'print "$F[1]x$F[3]"') -width=$(echo "$size" | perl -Fx -ane 'print $F[0]') -height=$(echo "$size" | perl -Fx -ane 'print $F[1]') -heightplus=${height:+$(($height+4))} +__width="${_width:+ width=\"$_width\"}" +__height="${_height:+ height=\"$_height\"}" +# Flash object needs extra space for controllers +__heightplus=${_height:+ height=\"$(($_height+4))\"} # TODO: resolve flash player to use [ -z "$flashplayer" ] || flash=yes cat >"$stem.html" < - -- cgit v1.2.3