Thomas Fischer's Weblog

Life, Linux, LaTeX

Archive for December 2007

Ogg/Theora Applet instead of Flash

leave a comment »

Due to and other similar sites, videos on websites have become very popular. However, Flash has several drawbacks such as closed source and limited support of non-Windows systems (see "Why Flash sucks"). Luckily, there is an alternative available based on patent-free and GPL’ed software.

Fluendo offers a java applet called Cortado that can play (streaming) multimedia files including ogg vorbis and theora files. Advantage with this approach is that is does not require to install any codes on the target computer and should run on any java-capable system.

To put a video on your website, you have to perform some simple steps:

  1. Convert your audio or video file into an .ogg file.
  2. Upload both the .ogg file and the Cortado .jar archive on you webspace.
  3. Include some applet code into your website.

Converting existing audio and video files

To convert existing audio and video files, you may want to use ffmpeg2theora. This program is easy to use, but to fine-tune the conversion there is a set of parameters e.g for quality, resolution and sampling, contrast, brightness or gamma control.

Including the applet on your website

Depending on where you got the .jar file from, it may have different names. In my case it is called cortado-ov-debug-0.2.2.jar for audio (ogg vorbis) only and cortado-ovt-debug-0.2.2.jar for audio and video (ogg vorbis+theora).

To embed an applet on a HTML page, there is both the applet tag and the object tag. The former one was invented by Netscape, not standardized by W3C, but works with most browsers. The latter one is standardized, but is said to be more complicated to be used. Although I favour standardized procedures, I’ll stick with applet for this example.

The code for the video below looks as follows:

<applet code="com.fluendo.player.Cortado.class"
        width="320" height="240">
   <param name="url" value="rabbits.ogg"/>
   <param name="duration" value="10"/>
   <param name="local" value="false"/>
   <param name="keepAspect" value="true"/>
   <param name="video" value="true"/>
   <param name="seekable" value="true"/>
   <param name="audio" value="true"/>
   <param name="bufferSize" value="200"/>

For your own video, you may have to change the following parameters:

Location (URL) of the .jar file to use
Width of your video in pixel
Height of your video in pixel
Location (URL) of your video
Length of your video in seconds, used for the slider

For more details on the parameters, please refer to the README file.

Finally, the applet should appear on the website as shown here:

Update: Of course, as the java applet is a player only, the video is available as a stand-alone file on the web server, too.

Written by Thomas Fischer

December 30, 2007 at 0:00

Posted in Linux