write/convert JOGL animation to .mov or .wmv or ogg

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

write/convert JOGL animation to .mov or .wmv or ogg

ayco
I am an experienced Java programmer but 100% clueless as to graphics programming, so this may sound dumb, but anyway ...

All tutorials I''ve encountered talk about displaying OpenGL/JOGL apps in an applet or native window, but how do I output the result of my programming to some video format? So I can upload it to YouTUBE or Vimeo, for example. You _DO_ see a lot of JOGL examples on YouTUBE, so it must  be possible, but I haven't been able to figure out how.

Is there, for example, something like an OggStream class somewhere, that you can somehow write your frame buffer to, or something?
Reply | Threaded
Open this post in threaded view
|

Re: write/convert JOGL animation to .mov or .wmv or ogg

Demoscene Passivist
Administrator
U can use the utility class com.jogamp.opengl.util.awt.Screenshot. With the method Screenshot.readToBufferedImage() u can read the rendered image back from the GPU and convert it to a BufferedImage.

Stg like this:
BufferedImage tScreenshot = Screenshot.readToBufferedImage(0,0, getScreenWidth(), getScreenHeight(),false);

The BufferedImage can then be easily writte to a PNG:
ImageIO.write(inBufferedImage, "png", tScreenCaptureImageFile);

Do that for every frame and u get an image-sequence. Name them "image_0000.png"-"image_1000.png". The images can then be easily converted with ffmpeg or mencoder.

U may take a look at my repository for a couple of batch scripts that do the conversion.
Reply | Threaded
Open this post in threaded view
|

Re: write/convert JOGL animation to .mov or .wmv or ogg

Sven Gothel
Administrator
On 03/04/2012 08:00 PM, Demoscene Passivist [via jogamp] wrote:

>
>
> U can use the utility class com.jogamp.opengl.util.awt.Screenshot. With the
> method Screenshot.readToBufferedImage() u can read the rendered image back
> from the GPU and convert it to a BufferedImage.
>
> Stg like this:
>
>
> The BufferedImage can then be easily writte to a PNG:
>
If I may advertise the AWT free utility GLReadBufferUtil here :
  <http://jogamp.org/git/?p=jogl.git;a=blob;f=src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java;hb=HEAD#l55>
Test Case:
  <http://jogamp.org/git/?p=jogl.git;a=blob;f=src/test/com/jogamp/opengl/test/junit/jogl/util/TestGLReadBufferUtilTextureIOWrite02NEWT.java;hb=HEAD#l65>

It's tested on ES2 w/o AWT (tga snapshots).

~Sven

>
> Do that for every frame and u get an image-sequence. Name them
> "image_0000.png"-"image_1000.png". The images can then be easily converted
> with ffmpeg or mencoder.
>
> U may take a look at  https://github.com/demoscenepassivist/SocialCoding my
> repository  for
> https://github.com/demoscenepassivist/SocialCoding/tree/master/build_demos_jogamp
> a couple of batch scripts  that do the conversion.


signature.asc (910 bytes) Download Attachment