1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
|
#!/bin/sh
#
# usage: ./mkSlideshow ~/mypicDir/ audiofile.oga outputFile.ogm
#
# Variables to be changed
#
# video frame size
SIZE="800x450"
#
# data rate of the outgoing slideshow stream in bit/s
DATARATE="2048000"
#
# presentation time of one picture in seconds
PR_TIME="10"
#
# frame rate in pictures/s
FRAMERATE="24"
#
# reframe picture
# This adds black borders to picture to meet the aspect ratio
# of the video frame size specified earlier.
# With the Ken Burns effect, this is not strictly necessary,
# but the sliding may be smoother
#REFRAME="-e" or ""
REFRAME="-e"
#
# resample
# This option says, how the picture should be loaded (by gdlib)
# As the resize mechanism of gdlib is really good, it is used to
# bring it do a value "near" the video frame size (usually a bit
# bigger). You usually do not see a big difference, if you change
# this value :-), so keep it as it is (default = 1.2)
RESAMPLE="1.2"
#
# slideshow type
# kb - Ken Burns Effect (sliding and zooming)
# p - plain (picture display only, no crossfade between pictures)
# cf - crossfade (picture display, crossfading between pictures)
TYPE="kb"
#
#
# Temporal file name
TMP_VIDEOFILE="slideshow_tmp.ogv"
TMP_AUDIOFILE="audio_tmp.oga"
if [ $# -ne 3 ]
then
echo "usage $0 <picture directory> <audiofile>.oga <outputfile>.ogv"
exit
fi
echo
echo "Creating a slideshow with the following data"
echo
echo "Audio file : $2"
echo "Created file: $3"
echo "Pictures to be presented are:"
ls "$1"/*.jpg
echo
echo "Command line for oggSlideshow is:"
echo "oggSlideshow -s $SIZE -d $DATARATE -l $PR_TIME -f $FRAMERATE \ "
echo " $REFRAME -r $RESAMPLE -t $TYPE -o $TMP_VIDEOFILE $1/*.jpg "
# creating the slideshow
oggSlideshow -s $SIZE -d $DATARATE -l $PR_TIME -f $FRAMERATE \
$REFRAME -r $RESAMPLE -t $TYPE -o $TMP_VIDEOFILE "$1"/*.jpg
# what is the length of this
LENGTHVIDEO=`oggLength $TMP_VIDEOFILE`
#
# cut the audio file
LENGTHAUDIO=`oggLength $2`
#
# is the audio file to short?
last="newfile"
if [ $LENGTHVIDEO -gt $LENGTHAUDIO ]
then
echo "warning slideshow ($LENGTHVIDEO) is longer than your audio file ($LENGTHAUDIO)"
exit -1
fi
# cutting the audiofile
oggCut -l$LENGTHVIDEO -i$2 -o$TMP_AUDIOFILE
#
# Join audio and video file
oggJoin $3 $TMP_VIDEOFILE $TMP_AUDIOFILE
#
# remove
rm -f $TMP_VIDEOFILE $TMP_AUDIOFILE
|