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
Related
I need to be able trim wav audio files for an application I'm building.. but I have several problems.
I tried using FFmpeg-android, but if you target the latest SDK, and in the future, android no longer allows using "FFmpeg.execute". I also tried with the newer mobile-FFmpeg, but the developer stopped maintaining it a few months ago... I also would like to avoid heavy frameworks to also work with video, since I only need to work with audio. I can't find answers anywhere, what am I supposed to do?
You can use AudioTrack to write PCM.
I don't know how one translates input files into PCM data. But once it is in that form, you can edit it to suit your needs and then use AudioTrack to play back the result.
Maybe the MediaExtractor.readSampleData method can be used to read the audio data into an array where you can get to it and do your trimming. I've not done enough with Android to know if this is a viable plan or not.
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.
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.
Does anyone know of a library for either python, c(++), or java , or even an external app, that I can use to check for a specific audio distortion in an mp3? My problem is this:
I have a very robust Django app that automatically does podcasting for a radio station for all the different shows, but about once a week the computer that does the actual recording records corrupted audio, that has a specific interence pattern, it's a chopping sound almost like a helicopter where the audio drops several times a second. I'm not hoping to fix those audio files(as I've tried manually with good editing software and it's just a lost cause) but rather detect weither or not that type of corruption is present so I can switch to the back-up version of the recording automatically. external tools should ideally run on linux, but windows is acceptable as long as it is headless(no forced gui).
Thanks.
I think all you will need to do is do an fft on the mp3 and you should see a really low frequency spike which corresponds to the big drops. I'm no dsp guru though so not sure that this will work, but its easy to try.
You can use the numpy library for python for this. Link
just read in the mp3 file into an array and then do an fft, for a test I would recommend just plotting it first (using maptlotlib for example), with both versions, corrupt and good and see if you can easily detect the corrupt version. Then hopefully you can write a simple algorithm to detect corrupted files from there fft's.
For reading in the mp3 into a data buffer you can use PyMedia http://pymedia.org/
I haven't used PyMedia so i'm not sure on reading the mp3 into a buffer (it shouldn't be too complicated I imagine), but after that plotting the fft is as simple as:
from numpy import *
from numpy.fft import *
import pylab
# place code to read the mp3 file into buf[] here.
buf_fft = fft(buf, 1024)
pylab.plot(fftfreq(1024, 0.1), abs(buf_fft))
pylab.show()
Try BASS Library and see if it has what you are looking for.