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.
Related
i wonder how progressive videostreambuffering works. Currently i try to create a media player for Android that is able to play progressive streamed video files. For that i use vitamio library. Its a very powerfull Android medialibrary. It also supports progressive straming and several videoformats. The only Problem with vitamio is that it dos not continue buffering when you Pause the playback. So you are not able to watch videos on slow networks.
So my current workaround to solve this is open a httpinputstream to the videofile i want to stream. Then i read the size of the videofile. Let's say it is 80MB. Then i create an empty dummyfile on my hdd with exactly this size (80MB). This file is currently filled up with zeros. Then i start to read the data from the httpinputstream and overwrite the dummyfile from . If i have 10MB downloaded i put this file into the videoplayer and start playback. In this moment the videofile on my hdd is still 80MB big but the readable and valid videodata are 10MB. During playback i continue downloading and filling up the dummy file until it is done.
Sometimes this works very good and sometimes not. The playback stops with several errors (frame not found and so on) although the play position is at 5% and the download has been 15%yet. It does not work very reliable and i cannot imagine that this is the common way of progressive streaming. So my question is: how does this technically work? What differs my method of progressive streaming from the common way?
thank you
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.
I am building a web page where i need to do something when a particular sound is caught by the microphone. I searched a lot and found this link :
Write a Program Which Recognizes a Sound and Performs Action
I am stuck at two things:
how to use java based sound recognizers though a webpage or
javascript
how to match two sounds (one from the mic. and other from saved file) using any recognizer
For sound recognizer, I am using Sphinx-4 .
To use java sound recognizers, you will need to: either submit/stream the content recorded in the browser, or use a local processing (applet/javafx).
An applet/javafx might not be a bad idea at all; since recording might yield a large data blob, you can do the processing in the local machine. My bet is that the applet will need to be signed to access the mic. You could also stream the audio data to the server, websockets might be a cool shot.
For Javascript, i think you need to use HTML5 for microphone recording or Flash.
For audio comparison, i think you want audio fingerprinting. That is a summary of the audio file. You need to search your own database for the "best match" from what you got among what you have.
I'm not sure Sphinx is the man here. Both Musicg and MusicUri have audio fingerprinting.
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.
Which Audio format should I use to get the best accurate seek to? (play the song from an offset)
I whant this to be accurate on the millisecond.
is that Possible?
I can say that the format of the audio file matters. I had this problem with long mp3 file. As the mp3 files aren't designed for such accurate seeking you can check this answer for more details
In my case the bitrate of the mp3 file was low, It was 96Kps. and the VBR data wasn't correct which caused the mp3 file to seek wrongly on android.
My intent was to make android and IOS app that seeks accurately through this file but I failed to find the correct format that is suitable for both.
For the IOS, I used MP3 Diags and applied custom transformations to remove and rebuild the VBR
For Android, I converted the file to m4a format and it worked perfectly. I used Audacity and installed the FFmpeg package to be able to export to m4a format.
This is the file sample that contains the problem I mentioned
The format doesn't matter, as long as it's compatible with Android's MediaPlayer class. It has a seekTo() method that is accrate to the millisecond.