Ogg Theora Cook Book

Creating a Slideshow

The Ogg Video Tools provide a command line tool called oggSlideshow to create slideshows from a series of pictures in JEPG or PNG format with different effects for the changeover and presentation.

Synopsis: oggSlideshow [ Options ] picture1 picture2 picture3 

Each picture is read in from the file system and resized as neccessary to match the video frame size, which can be given by the -s option. If a picture's aspect ratio does not match the video frame, black borders are added.

The following effects for the picture changeover are supported:

plain: Pictures are presented one after another.

crossfade: The first image fades out while the next one gradually appears. The crossfade duration is 1 second.

blurring: The picture is blurred before it disappears.The next picture appears blurred, then comes into focus.

Another special effect is the Ken Burns effect, named after the famous documentary film maker. This effect slides and zooms through the picture during presentation. The changeover in this effect is set to crossfade. ⁞⁞

There exist options to set bit-rate, the length of the per-picture presentation time, output file name and more, summarized below:

Command Line Options


Set the size of the video frame. The size is given as <width>x<height>. The default size is 480x320.

Example: -s 320x240


Set the frame rate of the video, given as the number of frames per second. The default frame rate is 24 frames per second.

Example: -f 16


Set the output file name of the created video. The default name is slideshow.ogv.

Example: -o myShow.ogv


Set the presentation time (length) per picture. If your have 10 pictures and specify a length of 10 seconds, the overall video length will be 1:40 (i.e. 100 seconds).

Example: -l 10


Set the datarate measured used for the video, measured as bit per seconds. This is intended more as an upper threshold. The resulting Theora file may be smaller than expected.

Example: -d 1024000


Set the picture changeover effect type, as described above. Supported types are:

  • kb: Ken Burns effect (default)
  • cf: picture crossfade for changeover
  • p: plain picture presentation
  • b: blurring as changeover

Example: -t p


Enable reframing. In case a picture does not match the aspect ratio of the video frame, it can be "reframed" by adding black borders. This option is only useful with the Ken Burns effect (option -t kb). With the other changeover effects, pictures are automatically reframed even without option -e.

Example: -t kb -e

Adding Sound to a Slideshow

Using oggSlideshow you can create silent video files only. But adding audio afterwards is merely a matter of using a few more tools.

Let us assume you created a slideshow using all images from your directory somePics, as shown in the following example command line:

$ oggSlideshow -s 320x240 -f 24 -o slideshow.ogv -d 512000 somePics/*.jpg

Before adding audio, we first need to create an audio track that has the same length as the slide show. The slideshow duration is printed at the end of the slideshow creation process. Alternatively it can be read out using the following command:

$ oggLength slideshow.ogv

This returns the length of the video in milliseconds. Using that information we can cut an Ogg/Vorbis audio stream to the same length.  5.6 seconds in this example::

$ oggCut -l 5600 myAudioTrack.ogg myAudioTrackAdjusted.ogg
To multiplex both streams to one media file (newSlideshow.ogm), we use oggJoin:
$ oggJoin newSlideshow.ogv myAudioTrackAdjusted.ogg slideshow.ogv

Now you are done!

Adding a Fixed Starting Picture

The first picture in a slideshow often needs to be a title picture giving some details about the slideshow. Create a short and plain slideshow to use as title sequence, using only one picture:

$ oggSlideshow -s 320x240 -f 24 -tp -o startPicture.ogv -l 10 -d 512000 \ startPicture.jpg

Here the slideshow type is set to plain (-tp), making the picture just appear as it is. The duration is set to 10 seconds (in contrast to the default settingn of 8 seconds).

We prepend the title picture to our slideshow.ogv using oggCat:

$ oggCat overallSlideshow.ogv startPicture.ogv slideshow.ogv

Of course we can also add an audio track as described above:

oggJoin newSlideshow.ogv myAudioTrackAdjusted.ogg overallSlideshow.ogv

A Script for Everything

The following shell script creates combines everything described in this chapter, creating a slideshow with title sequence and audio.

# usage: ./mkSlideshow ~/mypicDir/ audiofile.oga outputFile.ogm
# Variables to be changed
# video frame size
# data rate of the outgoing slideshow stream in bit/s
# presentation time of one picture in seconds
# frame rate in pictures/s
# 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
# 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)
# 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)
# Temporal file name

# creating the slideshow
oggSlideshow -s $SIZE -d $DATARATE -l $PR_TIME -f $FRAMERATE \

# what is the length of this

# cut the audio file
LENGTHAUDIO=`oggLength `

# is the audio file to short?
  echo "warning slideshow ($LENGTHVIDEO) is longer than your audio file ($LENGTHAUDIO)"
  exit -1

# cutting the audiofile

# Join audio and video file

# remove old files