Questions tagged [android-mediacodec]

MediaCodec is a class from the package "android.media" of Android API that can be used to access low-level, native media codec, i.e. encoder/decoder components.

MediaCodec is a class from the package android.media of Android API that can be used to access low-level, native media codec, i.e. encoder/decoder components. Along with the common IO it supports input data of the following decoder mime types:

  • "video/x-vnd.on2.vp8" - VPX video (i.e. video in .webm)
  • "video/avc" - H.264/AVC video
  • "video/mp4v-es" - MPEG4 video
  • "video/3gpp" - H.263 video
  • "audio/3gpp" - AMR narrowband audio
  • "audio/amr-wb" - AMR wideband audio
  • "audio/mpeg" - MPEG1/2 audio layer III
  • "audio/mp4a-latm" - AAC audio
  • "audio/vorbis" - vorbis audio
  • "audio/g711-alaw" - G.711 alaw audio
  • "audio/g711-mlaw" - G.711 ulaw audio

The reference to the API docs: http://developer.android.com/reference/android/media/MediaCodec.html

1173 questions
10
votes
1 answer

MediaCodec with Surface Input: Recording in background

I'm working on a video encoding application which I want to prevent from stopping when the hosting Activity enters the background, or the screen cycles off/on. The architecture of my encoder is derived from the excellent CameraToMpegTest example,…
dbro
  • 1,718
  • 1
  • 20
  • 34
10
votes
1 answer

How to access EGL Image directly from Android Surface for use in MediaCodec video decoder?

I'm currently writing an android app where I need to cache video-frames so that I can easily go back and forth with little to no delay. Right now I'm letting android decode the video frame by providing a Surface to the Configure call of the…
Nico Cornelis
  • 103
  • 1
  • 4
9
votes
1 answer

How to check whether Android MediaCodec supports Constant Quality mode

I have a screen recording app that uses a MediaCodec encoder to encode the video frames. Here's one way I retrieve the video-encoder: videoCodec = MediaCodec.createEncoderByType(MediaFormat.MIMETYPE_VIDEO_AVC); I then try to determine the best…
Piet
  • 356
  • 3
  • 10
9
votes
1 answer

Android MediaCodec slower in async-mode than in synchronous mode?

Again, I have a question as regards Android's MediaCodec class. I have successfully managed to decode raw h264 content and display the result in two TextureViews. The h264 stream comes from a server that is running an openGL scene. The scene has…
Christoph
  • 606
  • 7
  • 21
9
votes
1 answer

Truncate video with MediaCodec

I've used Android MediaCodec library to transcode video files (mainly change the resolution Sample code here) Another thing I want to achieve is to truncate the video - to only take the beginning 15 seconds. The logic is to check…
Qylin
  • 1,501
  • 1
  • 16
  • 26
9
votes
0 answers

Android App wants Access to "/Data" Folder

I want to stream AAC encoded audio Data from my Raspberry to my Android Phone. The part of receiving the data works well but there are some problems with decoding it. I use Media Extractor and Media Codec to decode the audio data. Here is the…
9
votes
0 answers

MediaCodec and 24 bit PCM

I am successfully using MediaCodec to decode audio, however when I load a file with 24-bit samples, I have no way of knowing this has occurred. Since the application was assuming 16-bit samples, it fails. When I print the MediaFormat, I…
yano
  • 4,095
  • 3
  • 35
  • 68
9
votes
0 answers

How to debug MediaCodec errors starting from OMX logcat messages?

Using MediaCodec, many times error messages come from OMX layer. How can one use them to help debug not so trivial issues? For example, I have an application which sometimes fails to create a codec for decoding an h264 stream. It seems to happen…
user1592546
  • 1,480
  • 1
  • 14
  • 30
9
votes
5 answers

I can't capture android screen using adb screen record tool

I have a nexus 4 with android KitKat. I tried screen recording using the following commands: adb shell screenrecord --verbose /sdcard/demo.mp4 adb shell screenrecord --bit-rate 8000000 --time-limit 30 /sdcard/kitkat.mp4 Both times, the commands…
jmacedo
  • 773
  • 1
  • 13
  • 24
9
votes
2 answers

Pause/Resume MediaCodec

I'm trying to implement pause/resume feature for my app that records display capture using MediaCodec. I've tried doing mEncoder.stop() and then mEncoder.start() without calling mEncoder.release() but that didn't work. I get IllegalStateException…
Alexey
  • 287
  • 1
  • 4
  • 9
9
votes
1 answer

Android Camera onPreviewFrame frame rate not consistent

I am trying to encode a 30 frames per second video using MediaCodec through the Camera's PreviewCall back(onPreviewFrame). The video that I encoded always plays very fast(this is not desired). So, I tried to check the number of frames that is…
xiaowoo
  • 2,248
  • 7
  • 34
  • 45
9
votes
1 answer

MediaCodec createInputSurface

I want to use MediaCodec to encode a Surface into H.264. With API 18, there is a way to encode content from a surface by calling createInputSurface() and then drawing on that surface. I get IllegalStateException on createInputSurface(). Here's…
Broatian
  • 860
  • 9
  • 10
8
votes
1 answer

Memory leak of AudioTrack

I encountered a severe problem of memory leak when AudioTrack and MediaSync are used together. It seems to me, the problem is that AudioTrack doesn't release some native resources. As a result, the app can be run only several times, after that,…
Anton
  • 560
  • 6
  • 21
8
votes
1 answer

RTMP adaptive bitrate algorithm

I searched online but there is very little information about this. I have a live broadcasting app where I send encoded H264 video frames and AAC audio chunks resulting from camera & mic using the Android MediaCodec SDK, over a RTMP stack. My live…
M Rajoy
  • 4,028
  • 14
  • 54
  • 111
8
votes
1 answer

Understanding Android camera SurfaceTexture and MediaCodec Surface usage

I'm trying to understand graphics memory usage/flow in Android and specifically with respect to encoding frames from the camera using MediaCodec. In order to do that I'm having to understand a bunch of graphics, OpenGL, and Android…
Mike Sweeney
  • 1,896
  • 2
  • 18
  • 20