Java file conversion - java

I have a video recording in Android and the file generated is 3gp. I want to send mp4 file to server, how can I convert 3gp file to mp4, is there any jar for this purpose?

These kind of conversions are usually CPU intensive, therefore the battery can be consumed pretty fast. Leave the conversion to the server. You may use Youtube for this

Related

Compress MP3 files via an applet

I'm writing a recording applet. Is there a technique/API to compress the recorded MP3 on the client side using the applet before uploading it to the server?
I agree, zipping/compressing media files won't reduce its volume, apparently i should set the recorded audio file to be efficient in terms of quality by choosing a lightweight audio format and setting some specific audio attributes and that would definitely help reducing the volume before the upload to the server.

Writing Wav Files of Unknown Length (Java)

I am trying to add a feature to some audio processing software I have written.
My software already captures sound from a microphone input, processes it in real time, and sends the result to a speaker output. (This is already a threaded application.) I've been using javax.sound.sampled.* and working with wav data (transforming it to and from numerical samples to do the processing.
I would like to add a feature to save both the raw input and the transformed output of a session with this software to wav files. But the signature for creating a new wav file (e.g., WavFile.newWavFile(...) seems to want to know in advance how many frames of data it is going to receive. Since these are live sessions of indeterminate time, I have no way of knowing this information before hand.
Am I missing something? Is there some way around this, other than a hack like saving files of data or samples, and then post-processing it?
Most audio file writers need to know the full file size before writing to an output stream. There's an open source project called Tritonus which is an implementation of the Java sound API that has an AudioOutputStream plugin you could try.

Streaming video files users have uploaded

We have a java web application where users can upload all kinds of files including any kind of video files. Now we want to allow them to stream these video files they own. So I need to make sure that they are the owner and then stream video. Also possibly stream a preview.
Do I need to convert these video files before streaming and where should I look to get started?
The best video playback/encoding library I have ever seen is ffmpeg. It plays everything you throw at it. (It is used by MPlayer.) It is written in C but I found some Java wrappers.
FFMPEG-Java: A Java wrapper around ffmpeg using JNA.
jffmpeg: This one integrates to JMF.

Java library for extracting audio information from MP3 files

Is there any freely available library (other than java media framework) that I can use to extract the bit rate (eg. 128 kbps, VBR) and the audio quality (eg 44.1KHz, Stereo) from a MP3 file?
I would like a standalone library that I can incorporate into my application jar, to be deployed on older Macs too that have only Java 1.5 available and I can't get them upgraded or add any big Java library to.
Just to clarify: I will not play, transcode or do anything of the sort with the audio stream itself, I am interested in the metadata only.
I confess I do not know much about MP3 files, but you can see from the format specification that all the informations needed are in the 32 bits long header of the file.
You could open the MP3 with a FileInputStream, read the first 4 bytes of the file and, using some simple binary masks, retrieve the informations you need. IMHO using a specialized library for that is a bit of an overkill.
Take a look at JAudioTagger, plain simple and easy to use, the data you are looking for is into MP3AudioHeader class, with methods like getBitRate()
You can use the LAMEOnJ library:
http://openinnowhere.sourceforge.net/lameonj/
This java library is light but you must have the LAMELib installed on target computer.
I'm not a java programmer, but i'm pretty sure you could read the mp3 file into a byte array then see http://www.mp3-tech.org/programmer/frame_header.html for frame info.
This format specification shows you what's contained the MPEG (mp3) header. You can write code to retrieve this header.

Use Xuggle in Java to trancode and streaming video/audio

I create an HTTP streaming server, but the clients can not play all video formats, so my question is, if there is a way, using xuggle in the server to transcode the video in a specific format and streaming it directly, on the fly.
I mean, not have to wait to finish the transcoding and then start the http streaming. I mean that I have a loop for example and get everytime a number of transcoded bytes and writes them to the socket.
Yes, but...
I'd not recommend taking this approach. Encoding videos is generally very CPU intensive. The generally accepted aproach to solving this problem is to transcode the video file off-line and store on the streaming server. Yes, that means a couple of different media files with the same video, but it scales muuuuuuuuch better. Most (all?) successful streaming servers do it this way.

Categories