GeeCON Prague 2014*
The moose likes Other JSE/JEE APIs and the fly likes JPEG images to video in Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "JPEG images to video in Java" Watch "JPEG images to video in Java" New topic
Author

JPEG images to video in Java

lovelesh saxena
Greenhorn

Joined: Dec 19, 2011
Posts: 9
Hi guys,
I am a working professional and my task is to create a video from set of images in java.
I know that this is a very simple task and can be done using jmf and JPEGIMAGESTOMOVIE.java file as provided by sun.
I downloaded the both things from java site.
When I run the .java file, it compiles successfully with one Xlint:unchecked warning.
But when I run it, it thows the following error:
Exception in thread "JMF thread: SendEventQueue: com.sun.media.processor.unknown
.Handler" java.lang.NullPointerException
at com.sun.media.multiplexer.video.QuicktimeMux.writeVideoSampleDescript
ion(QuicktimeMux.java:936)
at com.sun.media.multiplexer.video.QuicktimeMux.writeSTSD(QuicktimeMux.j
ava:925).......

I don't know where the error is.
Please help me to solve this issue, otherwise my boss will chew me up.
Thanking you all in advance.

Regards,
Lovelesh Saxena.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19697
    
  20

Welcome to the Ranch!

Can you please post the full stack trace? These exceptions come from within an Oracle library, which means that either you've found a bug, or (more likely) you've called it incorrectly.

And please KeepItDown next time. That also applies to subject lines.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
lovelesh saxena
Greenhorn

Joined: Dec 19, 2011
Posts: 9
Hi,
Thanks for replying.
My complete error trace is:

- reading image file: file://d:/print_screen/Code/screen_shot1.jpeg
Done reading all images.
Exception in thread "JMF thread: SendEventQueue: com.sun.media.processor.unknown
.Handler" java.lang.NullPointerException
at com.sun.media.multiplexer.video.QuicktimeMux.writeVideoSampleDescript
ion(QuicktimeMux.java:936)
at com.sun.media.multiplexer.video.QuicktimeMux.writeSTSD(QuicktimeMux.j
ava:925)
at com.sun.media.multiplexer.video.QuicktimeMux.writeSTBL(QuicktimeMux.j
ava:905)
at com.sun.media.multiplexer.video.QuicktimeMux.writeMINF(QuicktimeMux.j
ava:806)
at com.sun.media.multiplexer.video.QuicktimeMux.writeMDIA(QuicktimeMux.j
ava:727)
at com.sun.media.multiplexer.video.QuicktimeMux.writeTRAK(QuicktimeMux.j
ava:644)
at com.sun.media.multiplexer.video.QuicktimeMux.writeMOOV(QuicktimeMux.j
ava:582)
at com.sun.media.multiplexer.video.QuicktimeMux.writeFooter(QuicktimeMux
.java:519)
at com.sun.media.multiplexer.BasicMux.close(BasicMux.java:142)
at com.sun.media.BasicMuxModule.doClose(BasicMuxModule.java:172)
at com.sun.media.PlaybackEngine.doClose(PlaybackEngine.java:872)
at com.sun.media.BasicController.close(BasicController.java:261)
at com.sun.media.BasicPlayer.doClose(BasicPlayer.java:229)
at com.sun.media.BasicController.close(BasicController.java:261)
at JpegImagesToMovie.controllerUpdate(JpegImagesToMovie.java:196)
at com.sun.media.BasicController.dispatchEvent(BasicController.java:1254
)
at com.sun.media.SendEventQueue.processEvent(BasicController.java:1286)
at com.sun.media.util.ThreadedEventQueue.dispatchEvents(ThreadedEventQue
ue.java:65)
at com.sun.media.util.ThreadedEventQueue.run(ThreadedEventQueue.java:92)


The command which I type to compile the code is:
javac JpegImagesToMovie.java


The command which I type to compile the code is(for Xlint):
D:\print_screen\Code>javac -Xlint:unchecked JpegImagesToMovie.java
JpegImagesToMovie.java:277: warning: [unchecked] unchecked call to addElement(E)
as a member of the raw type java.util.Vector
inputFiles.addElement(args[i]);
^
1 warning



The command which I type to run the code is:

D:\print_screen\Code>java JpegImagesToMovie -w 1366 -h 768 -f 2 -o file://d:/pri
nt_screen/Code/a.mov file://d:/print_screen/Code/screen_shot1.jpeg file://d:/pri
nt_screen/Code/screen_shot10.jpeg file://d:/print_screen/Code/screen_shot19.jpeg
file://d:/print_screen/Code/screen_shot1.jpeg
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19697
    
  20

lovelesh saxena wrote: at JpegImagesToMovie.controllerUpdate(JpegImagesToMovie.java:196)

There's the cause of the problem. Can you show us line 196 of JpegImagesToMovie and the method that it's in? Make sure it's clear what line 196 is.

The command which I type to compile the code is(for Xlint):
D:\print_screen\Code>javac -Xlint:unchecked JpegImagesToMovie.java
JpegImagesToMovie.java:277: warning: [unchecked] unchecked call to addElement(E)
as a member of the raw type java.util.Vector
inputFiles.addElement(args[i]);
^
1 warning

You should check out generics to prevent this warning (not error). It's not absolutely necessary but it will make your code cleaner, as you can get rid of a lot of explicit casts.
lovelesh saxena
Greenhorn

Joined: Dec 19, 2011
Posts: 9
Hi,
According to my counting the following is line no. 196
public void controllerUpdate(ControllerEvent evt) {

if (evt instanceof ConfigureCompleteEvent ||
evt instanceof RealizeCompleteEvent ||
evt instanceof PrefetchCompleteEvent) {
synchronized (waitSync) {
stateTransitionOK = true;
waitSync.notifyAll();
}
} else if (evt instanceof ResourceUnavailableEvent) {
synchronized (waitSync) {
stateTransitionOK = false;
waitSync.notifyAll();
}
} else if (evt instanceof EndOfMediaEvent) {
evt.getSourceController().stop();
evt.getSourceController().close();
}
}

The one in bold.
Thanking You.


Regards,
Lovelesh
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19697
    
  20

All I can say is that you are not passing any incorrect arguments, which I first thought.
lovelesh saxena
Greenhorn

Joined: Dec 19, 2011
Posts: 9
Hi,
Then what can be the problem.
Please try to solve this issue, because I need it to work.
Please, please, please help me.


Regards,
Lovelesh Saxena.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19697
    
  20

I don't know what the cause of the problem is. If I did I would have already told you. Perhaps someone else can help out instead.
lovelesh saxena
Greenhorn

Joined: Dec 19, 2011
Posts: 9
Hi Rob,
Thanking for replying.
I think that the code which I have, having some problem.
If you can please share the code which according to you may run successfully.
That would be great help.


Regards,
Lovelesh Saxena.
lovelesh saxena
Greenhorn

Joined: Dec 19, 2011
Posts: 9
Hi guys,
I have done it.
My problem is solved now.
I take another code example MovieEncoder.java.
That is a great example code with everything explained clearly.
Thanks God!!!
Thanking you all too.
Regards,
Lovelesh Saxena.
Sandip Mangale
Greenhorn

Joined: Aug 13, 2012
Posts: 2
Hi lovelesh,

I am also in search how to convert the set of images into video will you please tell me how can i do this.
lovelesh saxena
Greenhorn

Joined: Dec 19, 2011
Posts: 9
Hi,
Thanks you contacting me. Below is the url from where you got this MovieEncoder.java file:

http://code.google.com/p/mason/source/browse/trunk/mason/sim/util/media/MovieEncoder.java?r=537.
If you find any difficulty with this code, please tell that to me.
I will be happy to help more.

Regards,
Lovelesh Saxena.
Thamim Mohamed
Greenhorn

Joined: Aug 30, 2014
Posts: 1

Hai lovelesh saxena,

I got this program using which link you mentioned. but when i run it shows the error that there is no main method. what i have to do with this.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42047
    
  64
Thamin- right, that is not a standalone app, you need to write that using the JMF library. Did you notice that at the beginning of the file is a lengthy description of what you need to do to use it? It's not trivial.

Also note that rev. 537 is no longer the latest version. It's probably a good idea to use the latest revision.


Ping & DNS - my free Android networking tools app
 
GeeCON Prague 2014
 
subject: JPEG images to video in Java