Getting Started with Theora-Java

Theora-Java contains 2 approaches to using theora in Java :

  1. theora-jna : using JNA to call the native libraries or
  2. Patched version of jheora and a sample program to use jheora, jogg, and jorbis.

 

theora-jna

theora-jna is a Java wrapper around theora, using JNA. It assumes that dynamic libraries for ogg, vorbis, and theora have been compiled, and are in your library path. It does not require jheora, jogg, or jorbis to be in your classpath.

Step 1 : Get Ogg, Vorbis and Theora sources from http://www.theora.org/

This library was built/tested with :

  • libtheora-1.0alpha7
  • libogg-1.1.3
  • libvorbis-1.1.2

 

Step 2 : Build/install by running the standard build procedure in each of the 3 directories :

./configure

make

sudo make install

 

Step 3 : Run the sample program with a URL to a media file (file://, http://, etc.) as the first parameter, example :

java -cp ./theora-java.jar:./lib/jna.jar net.sf.theora_java.jna.example.PlayerExample
http://upload.wikimedia.org/wikipedia/commons/d/d0/Apollo_15_liftoff_from_inside_LM.ogg

 

This should show the video and/or play the audio. You may also need to set your library path in order to find the installed theora dynamic libraries, for example :

export LD_LIBRARY_PATH=/usr/local/lib

 

jheora (patched)

jheora is part of the Cortado streaming applet available from here. And while the Cortado applet is GPL, jheora is LGPL. Fluomotion does not distribute a jheora jar, so the sources are included in theora-java. Additionally, a few minor changes have been made to make private structure members public, to make the functionality closer to what theora-jna has.

jheora is dependent on jogg and jorbis from jcraft, available from here. The sources and jars are included here as a convenience.

The same PlayerExample used for theora-jna has been modified to work with jheora. It takes a URL as a parameter. To run it:

java -cp ./theora-java.jar:./lib/jheora-patch.jar:./lib/jogg-0.0.7.jar:./lib/jorbis-0.0.15.jar
net.sf.theora_java.jheora.example.PlayerExample
http://upload.wikimedia.org/wikipedia/commons/d/d0/Apollo_15_liftoff_from_inside_LM.ogg