JMF is old, and doesn't support a lot of codecs properly. I get by these days by using FFMPEG in the background, but I would like to switch to a native java solution if one exists, does anyone know of a current open source Java project that has media manipulation functionality?
While not 100% native, you could also use Xuggler. It's an open-source (LGPL) wrapper that runs FFmpeg inside Java so you don't have to shell out, and is used by over 250 developers already today.
It depends what you want to do.
Since you are using ffmpeg, then I assume you are encoding videos. I am pessimistic that Java will do such work 'native' in the short or medium term--it very much goes against many Java philosophies/baggage.
That said, with Java 7, codecs in general should become easier to access, be more available and start showing up in real applications. Unfortunately, from what I've read, the emphasis seems to be on playback and GUIs.
I do allot of shelling out from Java to ffmpeg to encode videos and other media. Fact is, ffmpeg is one of the best tools out there for programmatically encoding videos, proprietary or open source. I predict that it will stay that way for the foreseeable future.
If ffmpeg is just not working for you, then you may want to investigate Quicktime for Java. I personally have not looked to deeply at it, but it seems to be 'big'. Note that it seems to have been deprecated as of the release of QuickTime X (Fall 2009).
QuickTime for Java provides a set of
cross-platform APIs which allows Java
developers to build multimedia,
including streaming audio and video,
into applications and applets.
Related
For a side-project to learn web development and database management I decided I to make a radio-like website using the vast amount of TTA audio files that I have (along with the Cue files that complement them).
However, the biggest hurdle over this project has been, well, handling the audio itself. I'm not really sure how to go about decoding the TTA files and using that information to utilize the Cues properly.
I've been all over the Tau Projects website and just really at a loss on how to proceed. Some options I have considered, but not sure how they'd work/go about them.
1. Audio Library that Supports TTA
The easiest solution if one exists. From the very few audio libraries that exist for Java (at least that I know exist) none of them support the TTA format. If I am mistaken, please correct me.
2. Using JNI/JNA to Hook into Decoders
The Tau Projects has a list of downloads for various plugins and I assume implementations for encoders/decoders (like ttaenc-win). Now I do not know much about anything for C/C++ so this may come as a challenge for me to use. From what I can understand about the libtta++ download is it's just a bunch of interfaces. I can only assume that the ttaenc-win is just an implementation of this (it's only a .exe file so not too sure). If one of the downloads is an implementation of these interfaces then I can use JNI/JNA to hook into them and process the audio that way. If this is the case then it can work, but I just need some guidance.
3. Using vlcj
VLC supports the TTA format so it may be possible to use vlcj to process the audio that way. However, from my understanding on how vlcj works, it would create an instance of VLC every single time I want to use it (and would also require VLC to be installed). If this is true then this solution would be grossly inefficient and wouldn't scale at all even for a small amount of requests (as I assume I would need a new VLC instance for each user).
4. Writing a Pure Java Implementation
Being open source means the algorithm can very well just be natively made. But as I said earlier, I do not understand C/C++ code to make a Java-equivalent implementation and I'm not smart enough to decipher the information about the algorithm on the Tau Projects site (information can be found here and here).
This solution would be by far the most lightweight, versatile, and portable option. If it can be achieved, this would probably be the route I'd like to pursue, but I would need guidance on it.
I am looking forward to build a media player with java, and basically what I found was JMF. But, then again, this API is not upto date and doesn't support latest formats such as MKV. On more research, I stumbled upon
Any simple (and up to date) Java frameworks for embedding movies within a Swing Application?
Got all excited, but then digging some more, left me with this
Adding other video codecs / DVD support to JavaFX 2.2
Now, I am disappointed and in a fix that how all the good media players (VLC, KMPlayer etc) been able to support all video and audio formats. They must be build using a programming language, IMHO !
So, my question would be, in-order to build a complete media player which supports all kind of media files:
Is JAVA incompetent ?
Has one ever build a good media player using JAVA ?
Is it just Java or no modern language can do it ?
Do I have rely and choose C, C++ to do this ?
Well, Java is a programming language that was created to support multiple platforms (like Windows, Macintosh and Linux). It works with a virtual machine: a sandbox. So there are a few constrictions, that are based on this sandbox system: Everything, that you want to use in Java must be compatible with ALL platforms, java is created for. And because playing media is very near to the system and of course the hardware (soundcard, graphics board etc), Java may get problems on getting this compatible to all platforms. Another big problem is: Many codecs, you have to read and play (e.g. OGG-Vorbis) are not open sourced, so you will get problems on finding a good API to work with them. Of course there ARE APIs, but I have no experience with them.
Is JAVA incompetent ?
No, but Java was not created, to do system work. Of course, media playing is not a system work, but is near to the system. And Java does not implement codecs for playing music or videos, so you need custom APIs, as I said before.
Is it just Java or no modern language can do it ?
Well the problem is Java: Try a language, that supports more system- and hardware functionality.
Do I have rely and choose C, C++ to do this ?
In my opinion, this is your best opportunity. You may even use VB or VB.Net or whatever, but I think, you will get bigger problems with Java. Of course, this is just my experience, and other people may say you something different, but I think: Yes, C++ is a better language for a media player.
Hope, that answer helped you, greetings
Cydhra
P.S. Sorry, if my English is not that good, it is not my mother language...
The main problem with including more formats in Java by default is licensing restrictions - many of the popular formats are absolutely encumbered with patents and licenses, and for a company like Oracle to support lots of them as part of the JRE just isn't cost effective (in all likelihood.)
However, as mentioned before JFX8 is now open source, and you can thus compile in extra GStreamer plugins if you so choose. I did this recently with MKV, the process is described here if you want to do it with another format.
Since MKV is an open format, I also see no reason in theory why it can't be included in the default classes, so I created a ticket along with the patch - hopefully it may be included as standard in the not too distant future (absolute earliest 8u40.)
If you just want good media support in Java now however, and don't mind having VLC as a dependency, I'd use VLCJ - I use it in my application and it works a treat.
I'm looking to get started with mobile development (specifically iOS), and while I'm usually pretty good at learning languages, Objective-C confounds me at almost every turn. So, looking at j2objc (because I already know Java), I think it might fit the bill in terms of what I'm looking for.
My question, though, is pretty simple: can the converter properly handle a situation where my source code references, say, Apache Commons code in a binary-only (bytecode) JAR file?
No, j2objc requires source code (it uses the front-end of Eclipse's compiler). The RoboVM project works from class files, though.
J2objc is good for writing business logic only once. If you plan to write an app for Android, iOS and GWT, use it. But you will always need to write native code for UI, network and other specific platform stuff (Camera, Geoloc., etc.). If you plan to become a mobile development expert, my advice is to start learning Objective-c right now (I was just like you 2 years ago. I invested time to learn Objective-c and it's the only way to become a cross-platform mobile geek :-). I started with this book : Programming in Objective-C 2.0 (Stephen G. Kochan). Good luck !
No: j2objc requires source code. However j2objc allows transpiling source code that references .jar files. However the jar files with .class files wont be transpiled
I am coming from Java background as well and learned Objective-C by myself (and taught it as well).
If you really want to develop mobile apps for iOS the best thing is to invest in learning Objective-C. J2ObjC is not sufficient to create iOS apps since it does not provide UI support and it is not stable yet (between alpha and beta quality)
J2ObjC does not provide any sort of platform-independent UI toolkit, nor are there any plans to do so in the future.
Objective-C looks strange in the beginning, especially for people with Java or C/C++ background, but once learn it; you will start to appreciate the language.
This is an excellent course to get you started and apple provides excellent resources to learn iOS development and Objective-C.
I strongly doubt that any language translation tool ,e.g. J2ObjC, will be sufficient to build good iOS apps.
I am planning an application that will display video in a swing frame. It has to run on both Mac and Windows. I believe I should be able to bundle libvlc with the application and use vlcj to display the video.
However, is libvlc platform independant and is it a good solution for this type of application?
In short, yes. If you're just displaying a single video then it's really quite simple to use, and should work on both Mac and Linux without a problem.
From the pretty extensive research I did (and my needs were more complex than yours) I outlined it as the best available solution at present.
A side note, it may be that in the future (with Java 8 and JavaFX 3) we see much more extensive video support in JavaFX directly, which IMO would probably make that the best option if your requirements are simple. Something to look out for.
What's the easiest way to run a program written in sphinx4 on pocketshpinx?
I need something that can be used on various mobile platforms, like the iphone and android phones.
I have already written demos in sphinx4 in Java, but now I need them to be in C.
Thanks:)
From official documentation
Flexibility of sphinx4 allows you to build such a system quickly. It's
easy to embed sphinx4 into flash server like red5 to provide web-based
recognition, it's easy to manage many sphinx4 instances doing
large-scale decoding on a cluster.
On the other side, if your system needs to be efficient and reasonably
accurate, if you are running on embedded device or you are interested
in using recognizer with some exotic language like Erlang,
pocketsphinx is your choice. It's very hard to integrate Java with
other languages not supported by JVM pocketsphinx is way better here.
in conclusion
need speed or portability -> use pockesphinx
need flexibility and managibility -> use sphinx4
TL;DR - use pocketshpinx
Use a C library if you plan to develop application on multiple platforms. Both Android (via NDK) and iOS(natively) support loading and calling C library. There is no JVM on iOS, thus, you won't be able to use sphinx on iOS.
To save time, pocketphinx-android-demo github repo has precompiled pocketsphinx libraries for all the relevant platforms -
https://github.com/cmusphinx/pocketsphinx-android-demo/tree/master/app/src/main/jniLibs
You get both performance and potability(you have to compile for arm and x86) with C/C++ libraries. Here is a Dropbox, Inc. talk on how they use C++ for writing multi platform applications.
https://www.youtube.com/watch?v=ZcBtF-JWJhM
If you wrote a JNI wrapper around pocketsphinx, then you could use that from your java code.
There are also python language bindings for pocketsphinx.
Essentially pocketsphinx is the speech recognizer you should use if you want a C language speech recognizer (and is also the one designed to be fast enough to work on a mobile phone).
Sphinx4 and PocketShpinx are completely different regarding implementation, you have to rewrite the demos or worse they might be not supported in PocketSphinx. That happens if you use some Sphinx4 advanced features.