Question

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.

Was it helpful?

Solution

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!

OTHER TIPS

You can use JMF, see this nice example.

There is a nice blog entry here: http://www.randelshofer.ch/blog/2008/08/writing-avi-videos-in-pure-java/ By Werner Randelshofer

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top