FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Topics & Contributions
   Video, Camera
(Moderator: REAS)
   JMFVid - JMF based video capture/rendering
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: JMFVid - JMF based video capture/rendering  (Read 11064 times)
meiriko

WWW Email
JMFVid - JMF based video capture/rendering
« on: Feb 3rd, 2005, 11:37pm »

Hi,
 
 I developed a JMF based video capture and rendering extension for Processing. I finally found the time to pack it wrap it and make it available as a sketch with documentation. You can find it at: http://www.intelligrate.biz/e107/content.php?content.26
 
      M
 
Update: If you are using a version of java < 1.5 you might get an error message. Please see my post below for solutions.
« Last Edit: Feb 4th, 2005, 1:33am by meiriko »  
Quasimondo

WWW Email
Re: JMFVid - JMF based video capture/rendering
« Reply #1 on: Feb 4th, 2005, 1:10am »

Wow, that sounds like a great addition indeed. Thank you! Maybe you would get some more reactions if you mentioned that JMF is a Java-internal library for accessing various kind of media. Which means that you will not need any 3rd party tools to grab your Video signals. Maybe I'm not the only one who didn't know of the existance of that library before.
 
Thanks to your good documentation I managed to install all the necessary components. The JMStudio test application grabbed my webcams signal just fine.
 
Well, I also got rid of the javax.media.. error by changing run.bat as you described.
 
BUT - now I get the following error message and have no idea how to get around it:
 
java.lang.UnsupportedClassVersionError: BVideoJMF (Unsupported major.minor version 49.0)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:250)
at java.net.URLClassLoader.access$100(URLClassLoader.java:54)
 
maybe you have an idea.
 
BTW - I'm very interested in your Firewire communication prototype, too.
 

Mario Klingemann | Quasimondo | Incubator | côdeazur
meiriko

WWW Email
Re: JMFVid - JMF based video capture/rendering
« Reply #2 on: Feb 4th, 2005, 1:31am »

on Feb 4th, 2005, 1:10am, Quasimondo wrote:
Wow, that sounds like a great addition indeed. Thank you! Maybe you would get some more reactions if you mentioned that JMF is a Java-internal library for accessing various kind of media. Which means that you will not need any 3rd party tools to grab your Video signals. Maybe I'm not the only one who didn't know of the existance of that library before.
 
Thanks to your good documentation I managed to install all the necessary components. The JMStudio test application grabbed my webcams signal just fine.
 
Well, I also got rid of the javax.media.. error by changing run.bat as you described.
 
BUT - now I get the following error message and have no idea how to get around it:
 
java.lang.UnsupportedClassVersionError: BVideoJMF (Unsupported major.minor version 49.0)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:250)
at java.net.URLClassLoader.access$100(URLClassLoader.java:54)
 
maybe you have an idea.
 
BTW - I'm very interested in your Firewire communication prototype, too.

 
 
Sorry, I've been playing with this for so long that I forgot. JMF is Java's Media Framework and it does eliminate the need for external installations/products, yet, don't forget it is an extra installation in itself (and does come with a bunch of dlls etc.).
 
As for the error you got, I think I know what the reason is. I use JDK 1.5. What version of java are you using If it is less than 1.5 I would probably try 3 things:
 
1. Upgrade to V1.5 (which might be a hassle).
 
2. Assuming that you have a JDK (the Java Development Kit that includes, among other the java compiler), go into the source folder and re-compile the classes. To do so, open a dos prompt, go into the source folder and run the following:
a. <JDK_HOME>\bin\javac -cp <PROCESSING_HOME>\lib\pde.jar;<JMF_HOME>\lib\jmf.jar *.java
b. <JDK_HOME>\bin\jar cvf JMFVid.jar *.class
c. copy JMFVid.jar ..\code\
 
3. This has worked in some cases - Processing seems to include and compile even *.java files (note, not compiled *.class files) that reside in the code folder. Try simply putting the source files there and see if it works.
 
Please post the results here, since I don't have java 1.4.x anymore and would rather not install one, your comments will be very helpful.
 
 As for the firewire, I'd love to share it. It is still raw and it does require:
1. Installation of the CMU 1394 lib.
2. Knowing how to do JNI programming.
3. Knowing C++ programming.
 
I spent quite a few hours today (neglecting all those 'ugly' things such as work ) today to pack this so it would probably be a while before I have time to make the FW ready. If you feel you can deal with raw code, let me know and I'll just send you the files.
 
One note, the FW is fast, it is frustratingly fast. I've been jumping through hoops to optimize the USB based capture and once the FW was on, swwwwooooooooooossssssssshhhhhhhhh. This is the way capture should be! The funny thing is that working with the FW, you can draw (i.e. call loop()) inside the videoEvent() function, this eliminates the need in all these synch stuff.
 
Is there anybody out there who owns a USB2 webcam I am curious to know if it does make a difference.
 
cello

marcello3d WWW
Re: JMFVid - JMF based video capture/rendering
« Reply #3 on: Feb 4th, 2005, 3:54am »

With any luck I'll be getting one tomorrow.  I've been messing with a USB2 digital camera though, for the same results.  What exactly do you mean by "makes a difference?"
 
Marcello
 
Quasimondo

WWW Email
Re: JMFVid - JMF based video capture/rendering
« Reply #4 on: Feb 4th, 2005, 1:07pm »

on Feb 4th, 2005, 1:31am, meiriko wrote:

As for the error you got, I think I know what the reason is. I use JDK 1.5. What version of java are you using If it is less than 1.5 I would probably try 3 things:

 
Well I've got 1.4.2
 
on Feb 4th, 2005, 1:31am, meiriko wrote:

...go into the source folder...

 
Maybe that's a stupid question, but which source folder are you referring to
 
 
on Feb 4th, 2005, 1:31am, meiriko wrote:

...and run the following:
a. <JDK_HOME>\bin\javac -cp <PROCESSING_HOME>\lib\pde.jar;<JMF_HOME>\lib\jmf.jar *.java

 
Hmmm.. MY javac didn't like the "-cp" - it only accepts -classpath, but that's probably the same. Still without the right source folder it doesn't work.  
 
 
on Feb 4th, 2005, 1:31am, meiriko wrote:
If you feel you can deal with raw code, let me know and I'll just send you the files.

 
Well, I think there's no hurry. I'm currently too much involved with other stuff, so unfortunatly I think I don't have enough time right now to test it. But you should definitely share your progress with us.
 

Mario Klingemann | Quasimondo | Incubator | côdeazur
meiriko

WWW Email
Re: JMFVid - JMF based video capture/rendering
« Reply #5 on: Feb 4th, 2005, 1:19pm »

Thta's the part I forgot, list the files.
 
The zip file cotains a few sub folders, among which:
 
1. code - the standard processing folder where you put extensions, dlls, etc.
2. source - a folder whihc I've created, to store the source code in case you would like to modify it.
 
Before trying any of my suggestions, empty the code folder of the *.jar & *.class files, it might help Processing in using the right files. Btw, you were right, -cp is same as -classpath.
 
The jar includes another class just for testing - JMFVFWEnumarator (the spelling mistake in the name is mine ). Try this: java -classpath BVideoJMF.jar JMFVFWEnumarator , it should list all the existing vfw (video for windows) devices that your JMF installation is aware of. I this doesn't work, the problem isn't with Processin but somewhere else. If it does, try uncommenting the code line in the sketch and see if the same (enumaration) can be done inside processing.
 
Once you get the JMFVid to run, you'll notice that 640x480 goes slow, I suspect it to be due to USB 1.1' limited bandwidth. I wonder if you get the same delay with USB 2 (or if there is a different).
 
Good luck,
 
    M
 
Quasimondo

WWW Email
Re: JMFVid - JMF based video capture/rendering
« Reply #6 on: Feb 4th, 2005, 5:17pm »

Tadaaaa! Recompiling worked fine this time, I only had to change this part:
 
Quote:
b. <JDK_HOME>\bin\jar cvf JMFVid.jar *.class  
c. copy JMFVid.jar ..\code\

 
to this:
 
b. <JDK_HOME>\bin\jar cvf BVideoJMF.jar *.class  
c. copy BVideoJMF.jar ..\code\
 
Did you change the name of your jar in the meantime?
 
Now your sketch runs just fine. Cool! Do you want me to mail you the recompiled jar? So you can include it with your package?  
« Last Edit: Feb 4th, 2005, 5:17pm by Quasimondo »  

Mario Klingemann | Quasimondo | Incubator | côdeazur
Quasimondo

WWW Email
Re: JMFVid - JMF based video capture/rendering
« Reply #7 on: Feb 4th, 2005, 5:27pm »

Quote:
Once you get the JMFVid to run, you'll notice that 640x480 goes slow, I suspect it to be due to USB 1.1' limited bandwidth. I wonder if you get the same delay with USB 2 (or if there is a different).

 
Looks like I cannot run it in 640x480 - it seems like  JMF uses some wrong parameters for my camera in this resolution: I just see some psychedelic colors and lot's of garble. But that also happens in the JMStudio so it's not a problem of processing.
 
Is it possible to tweak these camera settings somewhere manually - this is what the output window says: Using user format: RGB, 320x240, Length=230400, 24-bit, Masks=3:2:1, PixelStride=3, LineStride=960, Flipped.
 

Mario Klingemann | Quasimondo | Incubator | côdeazur
meiriko

WWW Email
Re: JMFVid - JMF based video capture/rendering
« Reply #8 on: Feb 4th, 2005, 6:01pm »

That's great news. Glad you got it to run.
 
I didn't change the name, I just forgot what name I used. In general, whatever jar file (with regard to name) you put in the code subfolder will be available to Processing (so, you can use SayNoToQT.jar as well).
 
Please send me your jar, I will make it available to java 1.4.x users.
 
As for the format, didn't play with it much, went to the quickest solution. If you feel like a little adventure you can read JMF's docs and see if you can select othre formats, it should be too much of a problem.
 
One more thing I forgot to mention (thanx, again, for bringing this up) is that the image might come up flipped. If it does, open your camera's control program (this is not a JMF thing) and mark 'mirror horizontaly', this should do the work.
 
RE 640x480, can you get it right in other apps (say AmCap)? If you do, JMF (and hence BVideoJMF) should.
 
How was the frame rate? Did you get much of a delay?
 
   M
 
Pages: 1 

« Previous topic | Next topic »