Extract images from mp4 using java - java

I want to write code in java to extract the images in a mp4 file. Kindly guide me how to go about it. I am totally clueless.

Java SE has Java Media Framework (JMF) but it provides support for only a few video formats, not including MPEG-4.
Of course, you have some third-party choices to achieve your goal. One of them is Jffmpeg. It is an extension to JMF which contains support for MPEG-4.
Xuggler is another good choice with GPL/LGPL license. It works on Windows, Mac OS X and Linux.

Xuggler is an open-source third party library you can use to do this. Read through the API's. and sample code.

Related

Audio Feature Extraction in Java using musicg

I am trying to extract features of an audio signal in my project. Is there any jar in java that helps me in extracting features.
Have you done your research? It this what you are looking for?: https://docs.oracle.com/javase/tutorial/sound/capturing.html

open source OCR library that runs on windows XP

I'm looking for an open source OCR library that runs on windows XP. I need this to work for images and PDFs. Mostly I would like to interface this library from java . Any idea if there is anything available?
Regards.
Check Tesseract
Tesseract is probably the most accurate open source OCR engine available. Combined with the Leptonica Image Processing Library it can read a wide variety of image formats and convert them to text in over 60 languages. It was one of the top 3 engines in the 1995 UNLV Accuracy test. Between 1995 and 2006 it had little work done on it, but since then it has been improved extensively by Google. It is released under the Apache License 2.0.
Tesseract works on Linux, Windows (with VC++ Express or CygWin)
and Mac OSX
And here is a comparision table from wiki
http://roncemer.com/software-development/java-ocr/
"Java OCR is a suite of pure java libraries for image processing and character recognition."
I would take a look at the Apache Tika project and combine it with Tesseract OCR. Apache Tika manages opening and extracting content from a broad assortment of file types. And it has a very pluggable design so you can connect OCR for input and even wire it's output to Lucene for searching. And it's pure Java.
There is huge work done by Heat on Research about OCR, have a look at this
Check out Tess4J, a Java JNA wrapper for Tesseract OCR API.

How to stream mp3 using pure Java

Is it possible to stream mp3s using pure Java?
If so, what are the best resources to implement this.
If not, are any other music formats streamable using Java only?
As Mario says, JMF - Java Media Framework is a good starting point.
What Mario does not say is that Sun killed MP3 support since 2.1.1b as detailed in the "My Lost Streaming MP3 Article" blog entry.
So you need to add a plugin to support MP3:
the JMF Formats list does mention MP3 (under the ACM -- Window's Audio Compression Manager support -- section), but only for Windows, and not with JMF alone.
You could use MP3SPI from JavaZoom to stream MP3 files
As it says on their webpage:
"MP3SPI is a Java Service Provider Interface that adds MP3 (MPEG 1/2/2.5 Layer 1/2/3) audio format support for Java Platform. It supports streaming, ID3v2 frames, Equalizer, .... "
People have already used it to build applicatons that stream from Shoutcast
Hope this helps
I think you can use the Java Media Framework from SUN to achieve what you want. Being this the official SUN implementation this would be the way to go. I am pretty sure that the actual streaming is native though.
I looked in the FAQ and I found the following answer:
Q: Will JMF 2.1.1 support streaming?
Yes. JMF 2.1.1 provides RTP/RTSP
streaming support.
JMF 2.1.1 also provides HTTP and FTP
streaming support on the client side.

MP3 Encoding in Java

I need an OpenSource API in Java, which can encode *.wav and *.au formats to MP3 and vice-versa.
I have evaluated Java Sound API and LameOnJ, but they do not meet my requirements and are not stable, respectively. Please suggest one that is free and platform independent.
There may not be an adequate answer for you, yet, as the MP3 format requires the authors of decoder/encoders to obtain a license from the Fraunhofer Institute.
I think the the LAME library is distributed from a country that does not respect these IP issues, but it took a considerably amount of legal hackery to get this far.
For any other libraries - for example one written in Java, the authors need to get a similar license. Where cost is an issue - e.g. in an Open Source project, then this is enough of a disincentive to starting.
For more details see this wikipedia article.
If LAME4J is not stable enough for you, then I'm afraid your options are probably:
wait for Sun to license the format for the core JRE. This, I believe they have done recently, but I don't know of any release dates (perhaps to do with JavaFX)
implement your own in Java, and pay the license. I wouldn't fancy this one, either.
write your own Java wrapper to LAME, via JNA, or SWIG
contribute to Lame4J.
pick another format. OGG and FLAC are quite good, and relatively well supported.
Is has been some time, but Oracle/Sun has released MP3 support for JMF. This can be downloaded from the following url:
http://www.oracle.com/technetwork/java/javase/tech/index-jsp-140239.html
Adding it to the classpath will enable playback via the AudioSystem api.
The LAME4J uses the free but time-limited license and the unlimited license will cost you some money.
I've found the Lamejb library on the SourceForge, which requires only the lame binaries and works well without any additional licensing.
Use the Process API to invoke SoX
SoX comes with source or as precompiled binaries for Windows and Mac.
If you are searching a pure java version of lame, check out these sources:
http://jsidplay2.cvs.sourceforge.net/viewvc/jsidplay2/jump3r/
The Jave2 project is Java library that wraps FFMPEG and provides most of its functionality* through a rather useful Java API.
Pros:
Useful Java API that is powerful and rather simple.
FFMPEG binary is bundled in, so you don't have to manage an FFMPEG installation on your system.
Cons:
Does not support streaming data: you have to work through temporary files: every conversion starts by storing all the content in some files on the system, getting FFMPEG to create new files for you, then reading them. This is not a deficiency in FFMPEG, more of a problem in Java where it is very hard to stream data to external processes**.
*) specifically around format conversion - the filter functionality is mostly not represented.
**) In Java, launching a process and connecting to its standard output and input is possible but not comfortable, and using named pipes (the BKM for piping AV to/from FFMPEG) is almost impossible, and even if you do manage to do that, Jave2 doesn't play well with that. I have a set of tools to workaround these problems, based on JNA, if anyone is intersted - I can share.

Video Thumbnails in Java

I want to generate a thumbnail preview of videos in Java. I'm mostly JMF and video manipulation alienated.
Is there an easy way to do it?
What about codecs? Will I have to deal with it?
Any video type is suported? (including Quicktime)
Well, since you're not stuck with JMF, have you considered Xuggler? Xuggler is a Java API that uses FFmpeg under the covers to do all video decoding and encoding. It's free and LGPL licensed.
In fact, we have a tutorial that shows How to Make Thumbnails of an Existing File
There seems to be a few examples out there that are far better than what I was going to send you.
See http://krishnabhargav.blogspot.com/2008/02/processing-videos-in-java.html.
I'd agree with Stu, however. If you can find a way to get what you want using some command-line tools (and run them using Commons-Exec), you might have a better overall solution than depending on what is essentially the Sanskrit of Java extensions.
Are you sure that JMF is right for you? Unfortunately, it is not in particularly good shape. Unless you are already committed to JMF, you very well may want to investigate alternatives. Wikipedia has a decent overview at en.wikipedia.org/wiki/Java_Media_Framework
Many JMF developers have complained that it supports few codecs and formats in modern use. Its all-Java version, for example, cannot play MPEG-2, MPEG-4, Windows Media, RealMedia, most QuickTime movies, Flash content newer than Flash 2, and needs a plug-in to play the ubiquitous MP3 format. While the performance packs offer the ability to use the native platform's media library, they're only offered for Linux, Solaris and Windows. Furthermore, Windows-based JMF developers can unwittingly think JMF provides support for more formats than it does, and be surprised when their application is unable to play those formats on other platforms.
Another knock against JMF is Sun's seeming abandonment of it. The API has not been touched since 1999, and the last news item on JMF's home page was posted in November 2004.
While JMF is built for extensibility, there are few such third-party extensions.
Furthermore, editing functionality in JMF is effectively non-existent, which makes a wide range of potential applications impractical.
My own server-side app shells out to FFmpeg to do the encoding. I'm 98.42% sure FFmpeg does snapshots, too. (It is an all singing, all dancing beast of a program. The command line options alone could fill a book.)
Check it out: ffmpeg.mplayerhq.hu
There is a relatively newer option called JThumbnailer that you find here: https://github.com/makbn/JThumbnail
JThumbnail is a Java library for creating Thumbnails of common types
of file including .doc, .docx, .pdf , .mp4 and etc. full list

Categories