Ogg Theora Cook Book

Creating a Video Preview

Hosting online video, it is often preferable to embed a short preview clip of a film into the main webpage, which is linked it to the original video. Use the command line tool oggResize from the Ogg Video Tools (http://sourceforge.net/projects/oggvideotools) to create such a preview.

A typical command line calling oggResize looks as follows:

$ oggResize -s256x144 -d64000 -f1 -p24 bigBuckBunny.ogv bigbuckbunnyPreview.ogv

Here we create the Theora video file bigbuckbunnyPreview.ogv from the original file bigBuckBunny.ogv scaled to a small frame size of 256x144 pixels.

The -p option makes oggResize include only every 24th picture from the original, reducing duration to 1/24 of the original length, usually creating a fast-forward version of the video. Since it does not make much sense to fast-forward the audio stream of the video, audio is removed.

But here we also added option -f1 thereby adjusting the frame rate of the created video to one frame per second. This prevents the video from being fast-forwarded, and is much easier to watch, looking similar to an animated GIF image.

Adding a Play Button

First we need a PNG picture of the button, with a transparency mask that allows us to overlay it over our video content.  The transparency mask is called an alpha channel, nowadays most image editing programs allow you to create one. Try for example the free software image editor GIMP.

With the -A and -a options you overlay a picture over the output video before and after the video is rescaled respectively, to the size given by -s.

$ oggResize -s256x144 -d64000 -f1 -p24 -A Play-256x144.png bigBuckBunny.ogv \ bigbuckbunnyPreview.ogv

So that's it! Now you got a nice preview of the bigBuckBunny.ogv video, with a play button on top inviting users to click on.