vlcj - audio callback - java

I need audio data callback while vlcj is playing the video file.
And then I want to add some effect (pitch shifting, etc..) on that audio and direct sound out.
I found vedio buffer call back in vlcj documentation, but not audio callback.
if i can get the audio callback, i can use other library such as soundtouch, etc...
or please let me know other alternative like as vlcj.
i just success with nVLC + NAudio on Windows.
It is possible with vlcj? Should I use gstreamer (gstreamer-java) or MPlayer?
regards,
-pph

vlcj 2.4.0 adds a new DirectAudioPlayer and associated DirectAudioPlayerComponent.
and sound touch wrapper
http://www.aplu.ch/home/apluhomex.jsp?site=44
make me complete.

Related

How to Create a Video from a BufferedImage List?

I'm trying to create a Simple Recording Software, so i Created a List<BufferedImage> for Storing the Frames, so how do i convert this in a Video? Most of the Stuff that i found is About Xuggler(That is very dead) and i also want a method that allows me to add Audio to the Video
i didn't get any responses so after a pretty long time searching i solved it with ffmpeg

MediaPlayer.snoop on android

I found the function MediaPlayer.snoop(short[], int) in Accessing the Android media stream for audio visualization but I couldn't use it.
I am wondering there is a method snoop in MediaPlayer.class.
Looks it is not public method but private one of MediaPlayer.
If there is how can i get audio stream from that method.
Thank you.
Look at the GrabAudio class of this open source wallpaper app,
https://bitbucket.org/Metastable/deadmau5-audio-visualizer/src/249150da7cfa2c20e8d1456a31aaabd46df6d26d/src/com/metastable/deadmau5?at=default
This is a magic class that will get tons of audio data. Very useful source.
This is the other open source app that you can look at but it doesn't seem to get audio data from the output, it just loads a media player and analyzes that one.
https://github.com/felixpalmer/android-visualizer

forwarding and rewinding audio in xuggler

I have used xuggler to play audio files other than wav,au,aiff. Since xuggler performs audio decoding at low level it is very hard to write a method that both forwards and rewinds the audio being played . ( while decoding xuggler analyzes each data packet and then sends it to play)
One way could be read bunch of packets at a time and then send the next packet to play.This way the effect of forwarding audio can be felt . But i don't know how to implement this method Moreover this is not the best way i can forward the data.
Are there any direct methods to forward and rewind audio ? If not direct what is the algorithm , steps to do this ?
Have you looked at the seekKeyFrame() method in IContainer? See here. On seek, you could just flush the dataline and then on execution of the method the container should jump to the given location.
If you want to do it by a percentage call, then getDuration() gets the entire length of the stream (if available.) You can then work out accurate timestamps from there.

Recording audio in android

I want to record own voice or any through mic(In any way) into a file in my project and want to read later and listen to it.How can i do this? Anyone reply me please.
http://developer.android.com/guide/topics/media/index.html
About 3/4 the way down the page you'll see
Performing Audio Capture
Audio capture from the device is a bit more complicated than audio and video playback, but still fairly simple:
Create a new instance of android.media.MediaRecorder.
Set the audio source using MediaRecorder.setAudioSource(). You will probably want to use MediaRecorder.AudioSource.MIC.
Set output file format using MediaRecorder.setOutputFormat().
Set output file name using MediaRecorder.setOutputFile().
Set the audio encoder using MediaRecorder.setAudioEncoder().
Call MediaRecorder.prepare() on the MediaRecorder instance.
To start audio capture, call MediaRecorder.start().
To stop audio capture, call MediaRecorder.stop().
When you are done with the MediaRecorder instance, call MediaRecorder.release() on it. Calling MediaRecorder.release() is always recommended to free the resource immediately.
Followed by code showing exactly how to store audio input and play it back, hope this helps. (I tried to paste the code here but pasting from android's guides is difficult)

Android: mpeg4/H.264 packetization example

I need to split mpeg4 video stream (actually from android video camera) to send it through RTP.
The specification is little large for quick reference.
I wonder if there any example/open source code for mpeg4 packetization?
Thanks for any help !
Mpeg4 file format is also called ISO/IEC 14496-14. Google it any you will find specifications.
However, what you are trying to do (RTP publisher) will be hard for the following reasons:
Mpeg4 has header at the end of the file. Which means header will be written out only when video stream is finished. Since you want to do real time video streaming you will need to guess where audio and video packets start/end. This will not be the same on all Android devices as they might use different video sizes and codec parameters. So your code will be device-dependent and you'll need to support and test many different devices.
Some devices do not flush video data to file in regular intervals. Some only flush once a minute or so. This will break your real-time stream.
There is no example code. I know because I looked. There are a few companies that do something similar, but mainly they skip RTP. Instead they progressively upload the file to their own server and then implement video/audio stream "chopping" and then insert it into their video/transcoder backend. I used to work for one of those companies and that's how we did it. AFAIK competition took similar approaches. The upside is that all complexity is on server an you do not need to update clients when something breaks or new devices arrive on the market.

Categories