🔒 Locked
[java] Java Video Encoding/Decoding
Advertisement
Original Post
I have a big problem. I'm working on a project at work with three other programmers. Our program needs to encode video from some data, and be able to play those movies back. These movies need to be saved in a common format, so that they can be sent anywhere and don't need our player functionality. Our program is written in Java, for various reasons, and uses the Quicktime for Java API for encoding/decoding. Our program is written and run using Java 1.5. Quicktime for Java only supports 1.3.1 and 1.4.1, and yet somehow, it's running fine on our development machines. Yet on most other machine configurations, running the program crashes the JVM due to an exception access handler in QTJava's native code. Since this is propriety code, we have no chance in fixing it; since this is free code, we can't just call up Apple and ask them to do this. This is our mistake, really, but for some reason, it hasn't been caught until now. We have two options: 1. Convert our program down to 1.4.1. Our code is about 40,000 lines, and we use generics and enhanced for loops in several cases. This is doable but will likely take a while. 2. Convert to another movie library. This is harder but, in my opinion, the better choice. Our architecture isn't perfect, but it's good enough that Quicktime is fairly isolated, so while there are extensive changes needed, they are only in a few different sections of the code; most of it can remain as it is. I have had little luck searching for a good video encoding/decoding API for Java. It needs to be for a common format, but we don't really care which one; .mpg, .avi, even .wma would be good. I've even looked at possibly using Flash. (The movies aren't very high-detail and are mostly text, it isn't an action movie or anything.) If any of you have *any* suggestions, please let me know in this thread. We need options soon! I'm researching over this weekend but will check back on this thread regularly. Thanks in advance for all of your help.
You can compile your code to target a distribution of the JDK... In this case, 1.4
Also, what is the QTJava error? Perhaps there might be some workaround...
At last, there's JMF... but it's horrible, to say the very least. It's not updated in ages, from what I've heard. Did you look at sourceforge? They might have many options turned up on a single search for this subject.
Try to post the QTJava's error... we might be able to help you and save you precious time.
Rodrigo
Also, what is the QTJava error? Perhaps there might be some workaround...
At last, there's JMF... but it's horrible, to say the very least. It's not updated in ages, from what I've heard. Did you look at sourceforge? They might have many options turned up on a single search for this subject.
Try to post the QTJava's error... we might be able to help you and save you precious time.
Rodrigo
Quote:
Original post by Son of Cain
You can compile your code to target a distribution of the JDK... In this case, 1.4
Not directly if you're using 1.5 features, but RetroWeaver may save the day.
The QTJava error is an EXCEPTION_ACCESS_VIOLATION that occurs in the native code of Apple's library. It crashes the JVM... doesn't throw an exception or anything, it literally just makes the JVM itself go boom. It occurs in the QTSession.open() call, which is necessary at the beginning of every run of the program. There is almost certainly no workaround. Apple states specifically on their site that QTJava 6.0 is the latest version, and that version supports 1.3.1 and 1.4.1.
I'll take a look at RetroWeaver... thanks!
I'll take a look at RetroWeaver... thanks!
Another option would be using FFMPEG:
http://ffmpeg.mplayerhq.hu/
FFMPEG supports encoding and decoding of quicktime videos. To access it from java, you need to create a simple wrapper. This can be done using SWIG:
http://www.swig.org/
http://ffmpeg.mplayerhq.hu/
FFMPEG supports encoding and decoding of quicktime videos. To access it from java, you need to create a simple wrapper. This can be done using SWIG:
http://www.swig.org/
Quote:
Original post by Malderi
The QTJava error is an EXCEPTION_ACCESS_VIOLATION that occurs in the native code of Apple's library. It crashes the JVM... doesn't throw an exception or anything, it literally just makes the JVM itself go boom. It occurs in the QTSession.open() call, which is necessary at the beginning of every run of the program. There is almost certainly no workaround. Apple states specifically on their site that QTJava 6.0 is the latest version, and that version supports 1.3.1 and 1.4.1.
I'll take a look at RetroWeaver... thanks!
Bug in the native library. Is last version of quicktime installed at target platforms? Java 5 supports libraries written for Java 4, or majority of earlier versions.
Does that access violation occurs only in your program, or would it occur if you'd write also very simple test application? What said Apple about that problem?
It is quite weird.
On our development machines, we use a 1.5 compiler and a 1.5 JVM. Both our regular program, and our short test program (just a QTSession.open() call) work on our developer machines, as well as some others. On some other machines, including those in our conference rooms which are a little older, only the test program will run if compiled with a 1.4 compiler and run with a 1.4 JVM. If compiled with a 1.4 compiler and run with a 1.5 JVM, it will not work. That's why we haven't discovered the problem until recently... we knew it happened on some machines other than our own dev boxes, but we didn't know how widespread it actually was.
The latest version of Quicktime for Java is installed on our target platforms. As I stated just above, the EXCEPTION_ACCESS_VIOLATION occurs in a simple test program. Do you have a source for yoru statement that Java 5 supports libraries for Java 4? Including native code?
On our development machines, we use a 1.5 compiler and a 1.5 JVM. Both our regular program, and our short test program (just a QTSession.open() call) work on our developer machines, as well as some others. On some other machines, including those in our conference rooms which are a little older, only the test program will run if compiled with a 1.4 compiler and run with a 1.4 JVM. If compiled with a 1.4 compiler and run with a 1.5 JVM, it will not work. That's why we haven't discovered the problem until recently... we knew it happened on some machines other than our own dev boxes, but we didn't know how widespread it actually was.
The latest version of Quicktime for Java is installed on our target platforms. As I stated just above, the EXCEPTION_ACCESS_VIOLATION occurs in a simple test program. Do you have a source for yoru statement that Java 5 supports libraries for Java 4? Including native code?
Quote:
Original post by Malderi
Do you have a source for yoru statement that Java 5 supports libraries for Java 4? Including native code?
The fundamental design of java and the release strategy is such that if it supports java 1.3.1 then it automatically supports:
1.4.0, 1.4.1, 1.4.2, 1.5.0, ... etc
There are three reasons that jump to mind why Apple would say otherwise:
1. They don't have the time/energy/personnel to install every copy of java (this is pretty easy to do, but NOT doing it is a way of reducing the amount of testing by a small amount) and so they want to be able to tell you to go away if you're not using one of the two versions they tried. They chose to list versions that *a couple of years ago* were the two most-stable most bug-free versions of java - I suspect they listed 1.4.1 and not 1.4.0 just because they know there are lots of bugs in the latter such that no-one should actually choose to use it :).
2. There is a very very very small chance there is a regression bug in 1.4.2 and above that breaks their code. Really, the chances of this still not being fixed by now when it shows up in such a widely-used library from a company such as apple who has a good relationship with sun are very small.
3. There is some technically illegal code in their library that only worked because of a bug in old versions of java that has now been fixed, and Apple hasn't yet had the time to fix their code.
Although 2 is the least likely, the behaviour you describe makes it sound a distinct possibility.
IMHO, however, for a library this widely used, it's actually a bug somewhere else that just happens to be masked by the 1.4/1.5 issue. I would go looking at what *other* applications and DLLs and OS updates are installed on the machines in question - I would say it is much more likely that all your dev machines have, say, Windows XP SP2, whereas all the machines with 1.4 also only have SP1 or no SP at all.
Quote:Have you finished university? Your question is quite strange, because UPWARD compatibility is an exceptional case.
Original post by Malderi
The latest version of Quicktime for Java is installed on our target platforms. As I stated just above, the EXCEPTION_ACCESS_VIOLATION occurs in a simple test program. Do you have a source for yoru statement that Java 5 supports libraries for Java 4? Including native code?
Do you know what "stdcall" means?
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement