![]() |
Create movies in Java
Hi. I would like to be able to create movie files from inside Java. I
would like to draw the movie frame by frame using standard Java graphics and image classes, then write it out to an external file. I would then use external tools such as ffmpeg to compress/reformat/add audio to the movie, so the format by which it would be written from Java is not that important. I presume this is possible, but can't find any sample code or tutorials. I can find huge numbers of tutorials about how to play back movie files in Java, some on transcoding etc., but nothing on authoring. Any hints/pointers? Thanks in anticipation, Ross-c |
Re: Create movies in Java
"Ross Clement (Email address invalid - do not use)" <clemenr@wmin.ac.uk> wrote in message news:1136142409.612570.192050@z14g2000cwz.googlegr oups.com... > Hi. I would like to be able to create movie files from inside Java. I > would like to draw the movie frame by frame using standard Java > graphics and image classes, then write it out to an external file. I > would then use external tools such as ffmpeg to compress/reformat/add > audio to the movie, so the format by which it would be written from > Java is not that important. > > I presume this is possible, but can't find any sample code or > tutorials. I can find huge numbers of tutorials about how to play back > movie files in Java, some on transcoding etc., but nothing on > authoring. > > Any hints/pointers? > > Thanks in anticipation, > > Ross-c > google "java jmf" |
Re: Create movies in Java
Bruce Lee wrote:
> "Ross Clement (Email address invalid - do not use)" <clemenr@wmin.ac.uk> > wrote in message > news:1136142409.612570.192050@z14g2000cwz.googlegr oups.com... > >>Hi. I would like to be able to create movie files from inside Java. .... > google "java jmf" There is a sample app. that comes with the JMF called.. 'JpegImagesToMovie' to convert a series of .jpg files to Quicktime .mov format. It has come in quite handy here, allowing me to create time-lapse animations from any series of pictures. [ I then (am currently) use ImTOO Avi/Mpeg Converter to change the .mov to .mpg format, though it sounds as if you have that side covered. ] For simple examples of dealing with images, check the code samples available on Marco Shmidt's site, here.. <http://schmidt.devlib.org/java/image-file-code-examples.html> HTH -- Andrew Thompson physci, javasaver, 1point1c, lensescapes - athompson.info/andrew |
Re: Create movies in Java
Thanks for the feedback. I've downloaded the source to
JpegImagesToMovie.java and it *should* be easy for me to adapt it for my needs. As the movies I will be creating are very large (1/4 hour to 1 hour) I think that it won't be feasible to dump an image sequence and convert, so I'll be hacking the code to store directly as quicktime. Cheers, Ross-c |
Re: Create movies in Java
Ross Clement (Email address invalid - do not use) wrote:
> Thanks for the feedback. I've downloaded the source to > JpegImagesToMovie.java and it *should* be easy for me to adapt it for > my needs. As the movies I will be creating are very large (1/4 hour to > 1 hour) I think that it won't be feasible to dump an image sequence and > convert, so I'll be hacking the code to store directly as quicktime. You might be right, that is much longer than the 61-62 second anims. I've done, but OTOH they are at 2304x1728 px and end up around a 1/4 Gig in size!. I'd recommend testing it first. [ There are also command line args. you can use to increase the memory available to a Java process. ] ...ohh, but I did hack the JITM source myself to accept a directory, and simply add all .jpg files in name order - I was not about to specify 300-600 image names on the command line! ;-) -- Andrew Thompson physci, javasaver, 1point1c, lensescapes - athompson.info/andrew |
Re: Create movies in Java
Here are a couple of things I learned doing this deed -- making
BufferedImage instances and then sequencing them into a Quicktime movie: # It's not all that easy. One thing that will be frustrating is that the Processor is asychronous. That is you cannot loop through your images and pass each image to the processor. You'll have to use the asynch calls and call backs. From the perspective of making movies from BufferedImage instances this seems like an idiocy. The explanation is that JMF is intended for playback. With that in mind things like asynchronicity are standard in video packages. If you're not comfortable with wait() and notify() methods that are part of Object you'll feel some frustration, I anticipate. # I have had all kinds of exceptions when trying to simulatenously read multiple movies with JMF. I guess they use some file statics. Anyway the JMF is a little away from a robust system. # The movies are big! Cool stuff is possible. Here is a program I made: given a google query go out to web and query google. For all links on first page of results get the content of each of the webpages. After getting the content of each of the pages find all image links. For image links that appear to be content (instead of spacers, buttons, etc) combine them ihnto the movie. It's kind of fun to pick something "juggling midgets", "warner brothers cartoons", "big tits" and get a Quicktime movie. I also made some stuff where I render images, like a countdown, and generate a Quicktime mov that I can put into video productions. opalpa@gmail.com http://www.geocities.com/opalpaweb/ |
Re: Create movies in Java
Here are a couple of things I learned doing this deed -- making
BufferedImage instances and then sequencing them into a Quicktime movie: # It's not all that easy. One thing that will be frustrating is that the Processor is asychronous. That is you cannot loop through your images and pass each image to the processor. You'll have to use the asynch calls and call backs. From the perspective of making movies from BufferedImage instances this seems like an idiocy. The explanation is that JMF is intended for playback. With that in mind things like asynchronicity are standard in video packages. If you're not comfortable with wait() and notify() methods that are part of Object you'll feel some frustration, I anticipate. # I have had all kinds of exceptions when trying to simulatenously read multiple movies with JMF. I guess they use some file statics. Anyway the JMF is a little away from a robust system. # The movies are big! Cool stuff is possible. Here is a program I made: given a google query go out to web and query google. For all links on first page of results get the content of each of the webpages. After getting the content of each of the pages find all image links. For image links that appear to be content (instead of spacers, buttons, etc) combine them ihnto the movie. It's kind of fun to pick something "juggling midgets", "warner brothers cartoons", "big tits" and get a Quicktime movie. I also made some stuff where I render images, like a countdown, and generate a Quicktime mov that I can put into video productions. opalpa@gmail.com http://www.geocities.com/opalpaweb/ |
Re: Create movies in Java
On 4 Jan 2006 07:22:08 -0800, "opalpa@gmail.com" <opalpa@gmail.com>
wrote, quoted or indirectly quoted someone who said : >Here are a couple of things I learned doing this deed -- making >BufferedImage instances and then sequencing them into a Quicktime >movie: Here is one problem you may run into that I had with a streaming protocol for JPG images. When the compressor does each image, it compresses it in isolation from the other images. It is happy to get the colours just a tad off. However, it gets them a tad off on each frame in a slightly different way. If you look at a series, you don't gave consistent colours. This is acceptable for a security camera, but may not be for advertising. To solve that you would have to start from something with accurate colours, maybe giant TIFFs. and somehow compress them in a consistent way frame to frame. MP3 encoders likely know how to handle this. -- Canadian Mind Products, Roedy Green. http://mindprod.com Java custom programming, consulting and coaching. |
Re: Create movies in Java
Thanks to everyone who replied on this thread.
I have hacked a modified version of the JpegImagesToMovie code into my program. Provided that I encode (using Sun's JPEGImageEncoder class) by images (BufferedImage) as JPEGs before returning them as output from my PullBufferStream.read( ) method, then I get a good QuickTime movie as output that I can play using mplayer and reformat using ffmpeg. However, I tried to avoid converting my images to JPEGs first by using RGBFormat. After some trial and error hacking, I made the code write a quicktime file. However when I tried to play it back, the programs didn't like the movie and refused to do anything with it. My application is a very primitive "electronic whiteboard" type program. I basically record a stream of mouse movements (actually pens on a touch-screen enabled plasma screen) and can play them back. I wanted to be able to dump the result as a movie for mixing with the sound I record of me talking while writing. So visual quality isn't a massive problem provided that people can read what I am writing. However, I can see the "jpegginess" of the image even in the original not very compressed movie. I'm going to try setting the JPEG quality higher than the default (whatever that was) and see if that helps. But, if possible, I would like to remove the conversion to JPEG intermediate step. Can anyone recommend an alternative format I could use, or point me to any references on how I can get the RGB format to work? Cheers, Ross-c |
Re: Create movies in Java
PS: Setting the quality of the JPEGEncoder object to 1.0 improved
things considerably. But I would still like to know how to avoid encoding to a JPEG. Cheers, Ross-c |
| All times are GMT. The time now is 08:22 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.