FFmpeg vs OpenSL-ES - android

I am working on an music player for android,i want to know which would be better for me?
FFMpeg or OpenSL-ES ? which one is easy to deal with?
Thanks

(old question but since i'm passing by...)
You can't compare both, they don't do the same job :
FFMpeg will decode your stream (example : MP3 file) to output PCM for instance
OpenSL will transmit PCM samples to your audio hardware to output the sound (and apply filters and effects)
Actually, OpenSL with API 14 (Android 4.0) is also able to decode some audio codecs such as MP3.

Related

Can we change or pass bitrate to opus codec during compilation or after compilation for android

I am working on a audio application, for development of this I am using pjsip . I compiled pjsip with opus but now I want encode audio with different bitrate . Is that possible ? please anyone help me .
I'm not familiar with pjsip or opus, but I can say from experience that it is possible to change audio bitrate using Android's MediaCodec. It should just be a matter of decoding the audio stream with one MediaCodec and re-encoding it with another MediaCodec with the newly specified bitrate. If, however, you want to resample the audio, you would have to do a lot of extra work by hand between the decode and encode steps provided by MediaCodec. Again, I can tell you from experience that it is possible though.

MP4 filewriter in android 4.1+

Starting from Android 4.1 (API level 16) MediaCodec APIs have been introduced. These APIs support Elementary stream Decoding & Encoding. Also MediaExtractor API will give elementary track details by analyzing Media streams.
My Question is, I setup a video encoder using MediaCodec API, which gives me encoded file in .h264 format. I want to write .h264 file into a .mp4 file for playing/storing/sharing purposes. I don't find any .MP4 file-writer API for android. Is there any way to achieve it?
Thanks,
Satish.
As of Android 4.3 (API 18) you can use the MediaMuxer class to convert the raw H.264 stream to a .mp4 file (and even merge an audio stream in).
See the EncodeAndMuxTest and CameraToMpegTest sources on this page for sample code.
This response may be of use. It suggests using the isoparser library. It works pretty well if you have elementary streams saved to disk, but it doesn't work if you want to live stream from the MediaCodec output.
Another way is to use FFmpeg (http://sourceforge.net/projects/ffmpeg4android/) for muxing h264-file to mp4 container.

Can an Android phone decode and play back a *.caf file w/ iLBC codec?

How I can get an audio file recorded via iPhone to play back in Android.
I don't see iLBC codec listed in the decoder section of Android supported media formats
Looking at the iPhone list of supported audio formats: iPhone audio formats, it looks like if you're just going iPhone => Android, then AAC or PCM are your best bets for encoding on iPhone, decoding on Android.
You should record your audio on iPhone with AVAudioRecorder .wav format.
See this thread how to configure AVAudioRecorder to get wav format on iOS.
Good luck
In terms of a built-in capability you can check the documentation as easily as I can.
Assuming no built-in capability, if you have working java, C, or (with caveats) C++ code capable of decoding the file to linear pcm samples and no legal obstacles to using it, then you can write an application to do so.

Android convert pcm file from AudioRecord to smaller file

I tried to record audio in Android. The quality of the sound using the MediaRecorder really sucks.
So I tried writing the sound to a stream using the AudioRecord function. Great quality but pcm-files are too large in size as I want to upload them to a remote server.
Does anybody know how to compress the pcm (like mp3 or else)?
Any help is mostly appreciated.
Tom
As far as I know, there are no built-in audio converters in Android. Your best bet is to use third party library, maybe even a c/c++ one.
Look at this question for more info: How to encode a WAV to a mp3 on a Android device

Mp3 encoder for android, record audio in mp3 format [duplicate]

I have simplified my question and offered a bounty:
What options are there for compressing raw PCM audio data to a mp3 on a Android device.
My original post:
I'm creating a synthesiser on my Android phone, and I've been generating PCM data to send to the speakers. Now I'm wondering if I can encode this PCM data as a mp3 to save to the sdcard. The MediaRecorder object can encode audio coming from the microphone into various formats, but doesn't allow the encoding from programmatically generated audio data.
So my question is, is there a standard Android API for encoding audio? If not, what pure Java or NDK based solutions are there? And can you recommend any of them?
Failing this I'll just have to save my generated audio as a WAV file, which I can easily do.
Pure Java
Look into Tritonus's clean room implementation of javasound which offers an MP3 encoder plugin here: http://www.tritonus.org/plugins.html
Secondly, I would suggest looking into jzoom's libraries JLayer or JLayerME: http://www.javazoom.net/javalayer/javalayer.html (this may only be decode, not sure)
If those doesn't suit your need you can look at this article from 2000 about adding MP3 capabilities to J2SE (with source): http://www.javaworld.com/javaworld/jw-11-2000/jw-1103-mp3.html
Native route
If you want "native" performance I would look at an FFmpeg or Lame port for Android.
Lame: http://lame.sourceforge.net/
As far as i know you can't do this using only the tools in the SDK. According to the official developer guide there isn't an MP3 encoder in the platform (Android Supported Media Formats), so you have to port an encoder on your own using the NDK, then write some wrapper code to receive the audio samples through JNI.
I'm currently working on porting some audio decoders from the Rockbox project for my own music player, and it can record audio into MP3, so maybe you should try to look into it's source and find the encoder library. Most of the decoders have ARM optimalizations which speeds up things noticable, so i guess some of the encoders have also this addition.
Mp3 encoder is not available in android.you have to compile libav with mp3 lame lib you can find code from
http://libavandroid.wordpress.com

Categories

Resources