Ogg Theora Cook Book

Create Thumbnails

The Ogg Video Tools (http://sourceforge.net/projects/oggvideotools) come with a tool called oggThumb that extracts thumbnails from Theora video files.

Example command:

$ oggThumb -t1,2,3,4 -s320x240 my_theora_video.ogv

Here we create four thumbnails from a video file called "my_theora_video.ogv", taken at 1, 2, 3 and 4 seconds into the video. In this example the thumbnail images are stored with the following file names:


Creating a Series of Thumbnails

If you need to extract thumbnails at fixed intervals throughout the full video, without knowing the length of the video in advance, use the following shell script to do the job:

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

The script is then called as:

 $ ./mkThumb my_theora_video.ogv 15

This script invocation extracts 15 pictures from start to end of the video file, at equidistant intervals. The pictures are output as files, using the same naming convention as previously described. Replace my_theora_video.ogv with the name of the video you want to work on. The number of thumbnails to generate is given by the last argument.  Change it to suit your needs.

Creating Thumbnails with Fixed Height or Fixed Width

You can request thumbnails of a certain size by adding option -s to the command line:

$ oggThumb -t1,2,3,4 -s320x240 my_theora_video.ogv 

Here we generate thumbnails sized 320x240. You can omit one either width or height, by setting it to 0:

$ oggThumb -t1,2,3,4 -s120x0 my_theora_video.ogv

Here the height of the video is set to match a width of 120. oggThumb computes the height so as to preserve the aspect ratio of the video frames.

Advanced Functionality

Use option -f instead of -t to select the thumbnail time positions by frame number instead of a number of seconds. Another option worth mentioning is -o png which generates thumbnails as PNG images, which have a higher quality than the JPG files generated by default.

The full documentation of the oggThumb command line utility can be accessed by typing:

$ man oggThumb

on the command line. Note that the windows version comes with a set of HTML files instead, containing a manual that can be read in your web browser.