I wonder if there is a lib, like Apache Commons, or something of that sort to help convert media-files (e.g. avi, mkv, mp4 etc) any-to-any? For example an InputFile is in format .avi and an OutputFile is in mp4.
See either of the following to convert between a range of formats.
Jffmpeg is a plugin that allows the playback of a number of common audio and video formats. It is based around a Java port of parts of the FFMPEG project, supporting a number of codecs in pure Java code. Where codecs have not yet been ported, a JNI wrapper allows calls directly into the full FFMPEG code.
Xuggle - A free open-source library for Java developers to uncompress, manipulate, and compress recorded or live video in real time.
The only library I know for that is ffmpeg, but you will have to run it through JNI.
Related
Actually, we need to convert a WMA audio file into FLAC. But there's a lack of ways to convert WMA into more convenient formats. Can you recommend us a library, that can help us, or something like that?
What you need is JAVE:
The JAVE (Java Audio Video Encoder) library is Java wrapper on the
ffmpeg project. Developers can take take advantage of JAVE to
transcode audio and video files from a format to another. In example
you can transcode an AVI file to a MPEG one, you can change a DivX
video stream into a (youtube like) Flash FLV one, you can convert a
WAV audio file to a MP3 or a Ogg Vorbis one, you can separate and
transcode audio and video tracks, you can resize videos, changing
their sizes and proportions and so on. Many other formats, containers
and operations are supported by JAVE.
MFSampledSP supports WMA.
It's suitable for Windows 7 or later.
In my android app ,I need to convert raw pcm data (wav file) to different music type because the pcm file is 40mb for 4-5 min.
Does anyone can recommend to what type i need to convert? mp3? amr? aac?
Also, how can I convert? From what I read, there is no library in java for conversion.
Let me answer different parts of your questions
Recommended compression format for audio
MP3 or AAC compression format is suited for music content and AMR is better suited for speech content.
Method of conversion (compression)
Android 4.0 (Ice Cream Sandwich) and below does not expose media encoders as a JAVA API. So in these Android versions, best option is to use external compression library like FFMPEG or FAAC through JNI API.
More details about using FFMPEG is at FFmpeg on Android
In Android 4.1 version (Jelly Bean version), Media encoder APIs have been exposed as a java API and can be used from Java application.
I would like to find a FREE MP4 (container) writer for Java. I do not need an encoder, only something which can write the correct atoms given their expected values. Bonus for such a library that also can write "valid" F4V.
I would prefer a pure Java solution rather than something using JNI or external executables.
Even though my answer comes very late you could have a look into my MP4 Parser/Unparser at Github. You can parse MP4 files, modify them and write the result. You can even start from scratch creating boxes programatically and write your object representation to some sink.
You can have a look at JCodec ( http://jcodec.org ). It contains an MP4 library and MP4 demuxer and muxer.
May be you are looking for something like StreamBaby.
Can't vouch for it, but red5 is an open source flash server written in Java, which claims support for streaming mp4 and has implementations of mp4 IO objects which may be able to create said format.
Also, IBM created their Toolkit For MPEG-4 a while back and though it's not free, it might help.
FFMPEG's java bindings?
http://fobs.sourceforge.net/f4jmf_first.html
Or simpler a JNA proxy over some C++ MP4 library.
I have implemented a QuickTimeWriter class which can write a QuickTime container in pure Java.
As far as I know, the QuickTime file format is structurally equivalent to MPEG-4 Part 14. There are only a few minor differences in the fields inside atoms/boxes.
So, with an MPEG-4 spec on your lap, and a few hours of work, you should be good.
The Java I've seen which modifies MP4 files would invoke Nero AAC Codec externally (a Windows native .exe which Nero does not supply the source for) to modify AAC files (which are Apple's audio-only MP4 files). It works for audio only, not to video.
I'm wondering if there's a java library out there that can manipulate 3gp files. Mostly I'm interested in splitting or merging existing video files.
I've looked at JMF (java media framework), but it doesn't support 3gp…and FFmpeg looks promising, but it's not clear that the library allows splitting/merging of existing files.
Does such a library exist?
Try Xuggler http://www.xuggle.com/ (its FREE btw)
Is there AMR to WAV , WAV to AMR converter available written Java? I need to do conversion in realtime. Looking for open source, free or paid.
Thanks.
Your best bet would be to call ffmpeg from within Java. Sadly, I don't know of a good solution which is java-only, but using ffmpeg allows you to use the wide range of codecs available to this program (which includes AMR support).