• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JPEG images to video in Java

 
lovelesh saxena
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20545
56
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
lovelesh saxena
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20545
56
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20545
56
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All I can say is that you are not passing any incorrect arguments, which I first thought.
 
lovelesh saxena
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20545
56
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1
Android Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic