| Author |
JPEG images to video in Java
|
lovelesh saxena
Greenhorn
Joined: Dec 19, 2011
Posts: 8
|
|
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
Saloon Keeper
Joined: Oct 27, 2005
Posts: 18369
|
|
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
How To Ask Questions How To Answer Questions
|
 |
lovelesh saxena
Greenhorn
Joined: Dec 19, 2011
Posts: 8
|
|
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
Saloon Keeper
Joined: Oct 27, 2005
Posts: 18369
|
|
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: 8
|
|
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
Saloon Keeper
Joined: Oct 27, 2005
Posts: 18369
|
|
|
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: 8
|
|
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
Saloon Keeper
Joined: Oct 27, 2005
Posts: 18369
|
|
|
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: 8
|
|
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: 8
|
|
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.
|
 |
 |
|
|
subject: JPEG images to video in Java
|
|
|