summaryrefslogtreecommitdiff
path: root/localvideowebencode
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2014-09-21 11:16:50 +0200
committerJonas Smedegaard <dr@jones.dk>2014-09-21 12:36:21 +0200
commit2a69a771bb65230597a2b12574344ebe820c534e (patch)
tree455b5657ad27c87d23c99c360dd5c1b543c0d9c2 /localvideowebencode
parentd6426cf3b00b3066e4438d0c72dd1c4baace3301 (diff)
Generalize size resolving (avoiding dependency on jpeginfo).
Diffstat (limited to 'localvideowebencode')
-rwxr-xr-xlocalvideowebencode22
1 files 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" <<EOF
<!-- Video for Everybody, Kroc Camen of Camen Design -->
-<video width="$width" height="$height" preload controls>
+<video$__width$__height preload controls>
<source src="$stem.mp4" type="video/mp4" />
<source src="$stem.webm" type="video/webm" />
<source src="$stem.ogv" type="video/ogg" />
-${flash:+<object width="$width" height="$heightplus" type="application/x-shockwave-flash" data="$flashplayer.swf">
+${flash:+<object$__width$__heightplus type="application/x-shockwave-flash" data="$flashplayer.swf">
<param name="movie" value="$flashplayer.swf" />
<param name="flashvars" value="image=$stem.jpg&amp;file=$stem.mp4" />
-}<img src="$stem.jpg" width="$width" height="$height" alt="$title"
+}<img src="$stem.jpg"$__width$__height alt="$title"
title="No video playback capabilities, please download the video below" />
${flash:+</object>
}</video>