Google I/O 2012 - New Low-Level Media APIs in Android

Google for Developers · 11K views · 2012 · 1:05:49

Open on YouTube

Software (other)Consumer devices & gadgetsAudio & video engineeringtalkdated

Why Stack Overflow recommends it

Stack Overflow users link it when answering Android audio and video questions about decoding, streaming or editing media with MediaCodec, since official examples were scarce at the time.

Recommended by 1 people across 1 different months, 2013 to 2016.

What it is

A Google I/O 2012 session by Dave Burke introducing the low-level media APIs added in Android Jelly Bean, notably MediaCodec, which gives Java code direct access to hardware codecs. It walks through the new APIs with code examples.

What people said

Recommends Eugene · 2013-05 · Stack Overflow · on “Best practices for audio streaming”

In my case I use FFMPEG with OpenSL ES. The disadvantage is complexity. You must be familiar with a lot of things: JNI, OpenSL, FFMPEG. It's also hard to debug(comparing with pure java android app). In your case I suggest you to try low level Media API [this video] . The only thing is lack of examples. But there is a unit test [LINK] which shows how you can handle audio(you need to change InputStream reference - line 82).

Cites Shamim Ahmmed · 2013-01 · Stack Overflow · on “How to read raw values of 3gp / AMR-NB audio format?”

You can use the Android MediaCodec [LINK] class to decode 3gp or other media files. The decoder output is standard PCM byte array. You can directly send this output to the Android AudioTrack class to play or continue with this output byte array for further processing such as DSP. To apply DSP algorithm the byte array must be transform into float/double array. There are several steps to get the byte array output. In summary it looks like as follows: Instantiate MediaCodec String mMime = "audio/3gpp" MediaCodec mMediaCodec = MediaCodec.createDecoderByType(mMime); Create Media format and configure media codec MediaFormat mMediaFormat = new MediaFormat(); mMediaFormat = MediaFormat.createAudioFo

Cites Bram · 2013-03 · Stack Overflow · on “Access violation in native code with hardware accelerated Android MediaCodec decoder”

I aim to use the Android MediaCodec for decoding a video stream, then use the output images for further image processing in native code. Platform: ASUS tf700t android 4.1.1. Test stream: H.264 full HD @ 24 frm/s With the Tegra-3 SoC inside, I am counting on hardware support for the video decoding. Functionally, my application behaves as expected: I indeed can access the decoder images and process them properly. However, I experience a very high decoder cpu load. In following experiments, process/thread load is measured by "top -m 32 -t" in adb shell. To get reliable output from "top", all 4 cpu cores are forced active by running a few threads looping forever at lowest priority. This is confi

Cites Eugene · 2013-05 · Stack Overflow · on “Edit video frames”

The question is very common and depends on details. So, if you need to do that programmatically, you can: Use FFMPEG filter [LINK] . Use FFMPEG for decoding video frames and OpenGL ES for presentation. Blend images on presentation layer [LINK] . Use FFMPEG for decoding and SurfaceView [LINK] for presentation. The same as prev. one, the only differense you will use java API to blend images. Use Media API [this video] 1 and 2 are flexible, but you will have a deal with native code. You must be familiar with JNI, NDK. 3 is not good enough and you can get some performance issues. 4 would be the best choice, but I'm not sure that you will find any tutorial or example how to do that.

Cites android developer · 2016-04 · Stack Overflow · on “How to play InputStream of an audio file that's not within a url or storage?”

Background I've succeeded uploading an audio file (3gp) into Google-Drive. Now I want to be able to play the file within the app. The Google Drive API only allows to get the input stream of the file that's stored there. The problem All MediaPlayer capabilities of inputs aren't available in my case, which is only InputSteam: [LINK] I know I can save the file from the Google-Drive to the cache and play it, but I want to avoid the storage handling, and play the file on the fly. What I've tried I tried to search for this issue, and only found that it might be possible using AudioTrack ( here [LINK] ). It might also be possible using new Jelly-Bean features (shown here [this video] , found from here [