I need to extract the audio stream from a movie and eventually convert it to a certain format, let's say MP3 at 192 kbps, for later processing, more exactly to detect the voices.
Are there any libraries for extracting the audio stream from a movie?
you could use mplayer to extract audio to a seperate file:
mplayer yourmovie.mov -vo null -vc null -ao pcm:fast
http://www.mplayerhq.hu/DOCS/man/en/mplayer.1.html
Assuming you have a DVD it can be as simple as stripping the audio track, which you can do with various bits of DVD ripping software.
It it has a standard Dolby Digital audio track (up to 48kHz 16bit) or possibly TrueHD in the case of Blu-Ray (up to 96kHz, 24bit) you should be able to decode either using either mplayer or ffmpeg.
If it's Java you're interested in check out FMJ:
http://fmj-sf.net/index.php
This provides a Java wrapper to ffmpeg.
Related
I'm trying to record from the microphone to a wav file as per this example. At the same time, I need to be able to test for input level/volume and send an alert if it's too low. I've tried what's described in this link and seems to work ok.
The issue comes when trying to record and read bytes at the same time using one TargetDataLine (bytes read for monitoring are being skipped for recording and vice-versa.
Another thing is that these are long processes (hours probably) so memory usage should be considered.
How should I proceed here? Any way to clone TargetDataLine? Can I buffer a number of bytes while writing them with AudioSystem.write()? Is there any other way to write to a .wav file without filling the system memory?
Thanks!
If you are using a TargetDataLine for capturing audio similar to the example given in the Java Tutorials, then you have access to a byte array called "data". You can loop through this array to test the volume level before outputting it.
To do the volume testing, you will have to convert the bytes to some sort of sensible PCM data. For example, if the format is 16-bit stereo little-endian, you might take two bytes and assemble to either a signed short or a signed, normalized float, and then test.
I apologize for not looking more closely at your examples before posting my "solution".
I'm going to suggest that you extend InputStream, making a customized version that also performs the volume test. Override the 'read' method so that it obtains the byte that it returns from the code you have that tests the volume. You'll have to modify the volume-testing code to work on a per-byte basis and to pass through the required byte.
You should then be able to use this extended InputStream as an argument when you create the AudioInputStream for the output-to-wav stage.
I've used this approach to save audio successfully via two data sources: once from an array that is populated beforehand, once from a streaming audio mix passing through a "mixer" I wrote to combine audio data sources. The latter would be more like what you need to do. I haven't done it from a microphone source, though. But the same approach should work, as far as I can tell.
I am writing a software in Java, to record small presentations on your PC.
The software has three components as of now :
a Webcam Recorder -> uses openCV
a Microphone Recorder -> uses JAVA Sound API
and a PPT displayer -> uses Apache POI API
I am planning to add writing pad component later .
Approach is to record visual and audio components separately and finally merge the video and audio files using ffmpeg system call.
In the GUI, I have given a button to mute the microphone while recording but video is still getting recorded (may be to avoid some noise while recording).
In the code implementation however, when the audio input is paused I am planning to add byte value 0 in the audio stream, byte array, so as to make sure both audio and video length are same before merging.
Is this approach good ?
If yes, how to know how many bytes to insert in the byte array so as to make it of same length as of video.
If no, please suggest some solution approaches for this problem.
I was looking into the Java sound API and noticed that it allows us to play audio files. I have two questions. Given an audio file, how can we use javax.sound to play the audio file at any random location. Moreover, does javax.sound convert audio files to text files containing their lyrics?
"to play the audio file at any random location":
When you are creating an AudioInputStream object you can just give it the bytestream starting at the position at which you want to start like so:
audioInputStream = new AudioInputStream( byteArrayInputStream, audioFormat,
audioData.length/audioFormat.getFrameSize());
This is from the complete example-code at:
http://www.developer.com/java/other/article.php/1565671/Java-Sound-An-Introduction.htm
To your second question: There exist several speech-recognition packages but as far as i know they do a poor job at parsing music because there is too much "noise".
Given an audio file, how can we use javax.sound to play the audio file ..
If you'd read the JavaSound info page you'd have seen source that can play a sound.
..at any random location?
Clip also provides setMicrosecondPosition(long) & setFramePosition(int). Feed a random number to either, and you're set to go.
Compare voice wav in android or voice tag ( voice commands ) API in answer number 2 I don't know how to convert the time-domain data of the original WAV file into frequency-domain data.
there's an api which may helps you to achieve your goal http://code.google.com/p/musicg/
I'm developing applications for Android. I need to have some kind of audio mixing effect.
How can I combine 2 or more audio tracks into 1 audio track?
Or adding an audio track into a certain stream of an audio?
Can anyone give me samples where I can head start?
Maybe you could try to port this code to Android?
Mixing of multiple AudioInputStreams to one AudioInputStream.
This class takes a collection of AudioInputStreams and mixes
them together. Being a subclass of AudioInputStream itself,
reading from instances of this class behaves as if the mixdown
result of the input streams is read
.