as title.. how to read bit of file mpeg video using java..
I use it for encryption file video.
Regards
Check the PS container format if you are interested how the different (audio and video) streams are multiplexed to a single file.
Related
I want to output elementary video streams with media recorder in android for the purpose of streaming with live555. In essence, I want to get media recorder to output an MPEG-4 Video Elementary Stream file (an .m4e file) or an H.264 Video Elementary Stream file (an .264 file). Is it possible to do that with media recorder on android? Or is there any other way to get it work?
From the MediaRecorder APIs I see that you have to call the setOutputFormat() before calling prepare(), this limits you to select one of the available options - 3GP/MP4. Hence you can use your own parser to operate on the dump from the mediarecorder, which can give you elementary streams.
The answer is, as I understand, that it is not easy to do that with MediaRecorder while recording. You may do that without much difficulty, using ffmpeg once the video is recorded. The reason is that, MediaPlayer cannot record as elementary streams. Even if we record video only, it will be put in a container format such as 3GPP or MP4. Now, for tools like ffmpeg to work on these files, they need the 3GPP or MP4 header information must be present on the recorded file. But, MediaPlayer will write those headers to the file only after it finished recording.
I am using Java to write a media application.
Given a file, how can I know is it a audio file or video file?
By the way, I use vlcj library.
In Java 7 you will be able to use java.nio.file.probeContentType to do this.
In the meantime, there are a number of other options for doing this kind of thing.
Some video files contain multiple audio tracks. Multiple languages for example. Is there a library which gets information about these audio tracks? Names of the audio tracks would be sufficient.
It should support common formats (mkv, avi,...)
I believe the best monolithic media file library available is that for VLC player. I seem to remember there was a Java wrapper, but it's probably not maintained (like all Java wrappers more than a few weeks old heheh).
I have found a solution to my problem. From Java I call the following command:
ffmpeg -i myvideo.mkv
Then I read the commands output and filter the lines which start with Stream #.
This works on all my files with multiple audio tracks.
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.
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