views:

560

answers:

2

I am looking for a 100% Java solution for encoding software generated images into an AVI stream together with an uncompressed audio track.

At the moment I am using JMF, but its size and installation problems make it a bad solution for my purpose.

+1  A: 

You can use JMF, see this nice example.

Zed
Hi Zed. I am already using JMF, but its size, the hassle of installing it (and keeping it installed upon JVM updates) is just not acceptable for my purpose.
Timo
+5  A: 

While it does not support audio, I created an MJPEG AVI Java class some years ago. You basically just tell it the resolution of your output video, along with the frame rate, then you just keep adding images to it. When you are done, you tell it to finish and it'll close out the AVI. It is based off of the Microsoft documentation on AVI, RIFF, and BITMAP file formats.

Other than not supporting audio, the only real problem is it implements the version of the AVI format limited to 2GB per file. While the class will write out a much larger file, I am uncertain that any players or video editors would be able to read it.

The way I've used this code in the past, is to generate an MJPEG AVI for processing in a video editor (adding audio, etc. in the editor). It helped me with automating some tedious slide show generation. Not sure if this code will help you, as is, but it might help if you are trying to roll your own solution. MJPEGGenerator.java is available if you are interested!

monceaux
I like the small size and see how to add the audio part myself. Thanks!
Timo