#!/bin/sh
# This script creates a series of thumbnails from an Ogg/Theora file
# usage:
# ./mkThumbs file.ogm <numberOfThumbs> <optional infos for oggThumb (e.g. resizing)>
#
# typical:
# ./mkThumbs myfile.ogv 10 -s0x200
# This call creates a thumbnail series of 10 pictures with the a height of 200 pixels
#

if [ $# -ne 3 ] 
then
  echo "usage $0 <video file> <number of pictures> <size (e.g. -s0x200)>"
  exit
fi

length=`oggLength $1`
timestring="0"
div=$(($2*1000))
for((i=1; i<$2; i++)) do
  value=$(echo "scale=3; $i*$length/$div" | bc -q 2>/dev/null)
  timestring="$timestring,$value"
done
oggThumb $3 -t$timestring $1
