Pogg is a pure Java library for Theora ogg movie playback. It allows you to play ogg videos in any Java application, applet or Processing.org sketch.

Pogg is licensed under the GNU LGPL (Lesser General Public License) which means that you can use it in proprietary software as long as you release the source code of the library (not the rest of the application) as well. You are encouraged to contribute to Pogg.

Being a pure Java library it works in Windows, Linux and Mac OS X, and you can use it in Java applets without special security permissions.

Screenshots and Examples

See the Examples section to see Pogg in action.

Features

  • Theora Ogg player: the open format for video
  • Pure Java: no native libraries needed, no need to sign the applets, works on Windows, Mac OS and Linux
  • LGPL license: it is open source and you can use it in your proprietary applications
  • Small: the library is 156KB
  • Relatively fast: plays video smoothly even in old computers (for example 400×300 at 30fps in a 7 year old P4 2GHz consumes 60% of the CPU)
  • Easy: the same interface as other Processing video libraries

Download

Download Pogg version 0.1.1 2010-01-24 Change log

It contains all the Examples and source code.

Using Pogg with Processing.org

Pogg is specially designed to be used with Processing.org. Processing allows you to easily create 3D graphics and it has many libraries available to use sound, image processing, I/O, particle dynamics and many other things. Pogg is just another Processing library.

  • Download and install Processing
  • Download Pogg and uncompress it in the Processing/libraries folder (in your sketchbook)
  • Create a new Processing sketch or copy one example
  • You can place the videos in a folder called data (in the same folder of the sketch) or write the absolute file path. You can download the video of the examples BugsShort.ogg

Using Pogg with Java

If you want to use it in a Java application, the Processing examples will help you as well. Processing in fact is a simplification of Java and all the Processing sketches are translated to Java when you compile and run them.

In Processing, the setup() method is called once to initialize all the variables and the draw() method is called every time a new frame has to be displayed.

If you want to program directly in Java, you should initialize somewhere the TheoraMovie object (the setup() in the examples). You can use the constructor without the PApplet and with the absolute path of the file:

TheoraMovie myMovie;
myMovie = new TheoraMovie("c:/path/BugsShort.ogg");

Then your program should have an infinite loop that does something similar to the draw() method of the examples.

You will need to convert the “pixels” attribute to images that Java can use. The best example for that is ExtractMovieFrames.

To compile and execute your application, you have to add to the classpath the pogg.jar (which is in the download above) and the Processing core.jar (which is in the to Processing/lib folder when you install Processing). See the Processing in Eclipse tutorial for details.

Methods

For examples on how to use these methods see the Examples

  • Constructors (in the setup())
    • TheoraMovie(String filename): for Java programming
    • TheoraMovie(PApplet applet, String filename): for Processing programming
  • Attributes:
    • int width: number of columns of pixels in a frame
    • int height: number of rows of pixels in a frame
    • float fps: frames per second of the video. If you want to play it at the right speed, you should set the Processing frameRate to the same value: frameRate(myMovie.fps);
    • int[] pixels: the pixels of the image. See Invert example and ExtractMovieFrames example
  • Methods:
    • for setup()
      • noLoop(): plays the video once
      • loop(): when the video finishes, it starts again
    • for draw()
      • read(): reads a new frame (fills the pixels). If you want to show the pixels you can call the Processing method image(myMovie, x, y)
      • float time(): returns the seconds elapsed from the beginning of the video. See the PrintMovieTime example

There are no play(), pause() and frameRate() methods that you can find in the Processing Video library. In Pogg the video does not play by itself, you have to explicitly call read() to move forward one frame. If you want to “pause”, just stop reading. If you want a faster frame rate, you can call read() more often or change the Processing frameRate() (which will call draw() more often and it will call read()). See the AdvancedPlayer example to see how to implement all these features.

Limitations

  • No camera capture
  • No video encoding (recording) only playing
  • No sound (we hope that future versions will extract Vorbis audio)

Other Processing video libraries

These libraries are more mature, they have native bindings (should be faster) and some of them support video capture and recording (Pogg doesn't). The main advantage of Pogg is its ability to be used in applets.

All these libraries have a Movie class with similar methods and it should be easy to interchange them.

Creating Theora OGG files

See How to convert a video to ogg with VLC

Tags: processing.org, processing, proce55ing, Java, library, ogg, theora, jheora, video, movie, applet, vj, 3D, player

 
Back to top
pogg.txt · Last modified: 2021/08/05 14:38 (external edit)
 
 
CC Attribution-Noncommercial-Share Alike 3.0 Unported
chimeric.de = chi`s home Valid CSS Driven by DokuWiki Recent changes RSS feed Valid XHTML 1.0