Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Create movies in Java

Reply
Thread Tools

Create movies in Java

 
 
Ross Clement (Email address invalid - do not use)
Guest
Posts: n/a
 
      01-01-2006
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

 
Reply With Quote
 
 
 
 
Bruce Lee
Guest
Posts: n/a
 
      01-01-2006

"Ross Clement (Email address invalid - do not use)" <(E-Mail Removed)>
wrote in message
news:(E-Mail Removed) 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"


 
Reply With Quote
 
 
 
 
Andrew Thompson
Guest
Posts: n/a
 
      01-04-2006
Bruce Lee wrote:

> "Ross Clement (Email address invalid - do not use)" <(E-Mail Removed)>
> wrote in message
> news:(E-Mail Removed) 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
 
Reply With Quote
 
Ross Clement (Email address invalid - do not use)
Guest
Posts: n/a
 
      01-04-2006
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

 
Reply With Quote
 
Andrew Thompson
Guest
Posts: n/a
 
      01-04-2006
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
 
Reply With Quote
 
opalpa@gmail.com
Guest
Posts: n/a
 
      01-04-2006
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.

http://www.velocityreviews.com/forums/(E-Mail Removed)
http://www.geocities.com/opalpaweb/

 
Reply With Quote
 
opalpa@gmail.com
Guest
Posts: n/a
 
      01-04-2006
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.

(E-Mail Removed)
http://www.geocities.com/opalpaweb/

 
Reply With Quote
 
Roedy Green
Guest
Posts: n/a
 
      01-04-2006
On 4 Jan 2006 07:22:08 -0800, "(E-Mail Removed)" <(E-Mail Removed)>
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.
 
Reply With Quote
 
Ross Clement (Email address invalid - do not use)
Guest
Posts: n/a
 
      01-04-2006
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

 
Reply With Quote
 
Ross Clement (Email address invalid - do not use)
Guest
Posts: n/a
 
      01-04-2006
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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Best format to create DVD Movies? Artreid Computer Support 13 12-19-2009 10:50 PM
How to create python script which can create csv we file with relationship Sonu Python 1 08-03-2007 01:08 PM
Beyond the Office [Making Movies: Copying Old Home Movies to DVD - 09/13/2005] Ablang DVD Video 0 09-14-2005 06:24 AM
JMF online demo movies won't play (Java Media) Will Java 0 06-21-2004 12:55 PM
DVD Movies Saturation High, Colours weird, other movies fine Steve Computer Information 0 04-25-2004 06:36 AM



Advertisments