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
6
votes
2 answers

How to prevent java.lang.IllegalStateException generated by MediaCodec.dequeueInputBuffer

The following code generates java.lang.IllegalStateException once in a while: int iInputBufIndex = _mcDecoder.dequeueInputBuffer(TIMEOUT_USEC); where _mcDecoder is an instance of MediaCodec. The decoded stream is H.264 video. The code works well…
Hong
  • 17,643
  • 21
  • 81
  • 142
6
votes
1 answer

Non-streamable video file created with MediaMuxer

I am using MediaCodec to encode video. Frames are coming through the camera preview callback to the MediaCodec instance (no Surface used). I am using JCodec library for muxing and I am able to stream produced video (video player is showing correct…
Andrey Chernih
  • 3,513
  • 2
  • 27
  • 27
6
votes
1 answer

Compress Videos using android MediaCodec api

I want to compress locally saved video file to a smaller size in order to upload to a server. Since i used MediaCodec , i have found some tips to compress video . Here are the steps that i followed 1) . Extracted the media file using…
Mr.G
  • 1,275
  • 1
  • 18
  • 48
6
votes
2 answers

How to embed text while recording video in Android?

My goal is to record the video in Android with stopwatch embedded in it while recording. I followed the samples of Grafika Project, CameraCaptureActivity.java where they use OpenGL 2.0 to record a small block along with recording video. They are…
Navjot
  • 1,202
  • 1
  • 11
  • 24
6
votes
5 answers

MediaExtractor.setDataSource throws IOException "failed to instantiate extractor"

I'm on Android 4.2 and calling MediaExtractor.setDataSource, and it sometimes throws an IOException of "failed to instantiate extractor". I've found where this is thrown from the C++ implementation, but it hasn't helped. Other people with the same…
Andy Newman
  • 1,178
  • 2
  • 8
  • 23
6
votes
2 answers

Does MediaCodec always give 16-bit audio output?

I'm using Android's MediaCodec class to read raw data from audio files. That works just fine. The problem is that I don't know if it's safe to assume that the output data will always be 16-bit? I can tell, experimentally, that the output is 16-bit,…
ams
  • 24,923
  • 4
  • 54
  • 75
6
votes
1 answer

Inconsistent sample time / presentation time during video decoding

I'm writing an APP that can encode video by camera input and process video by decode-edit-encode steps. For the camera, I use the Camera class rather than Intent to configure the details settings of the camera. Then I feed the camera frames to the…
Mark
  • 305
  • 5
  • 17
6
votes
0 answers

Can we rewrite the MediaCodec API in C?

I am thinking about using hardware encoding on my Nexus Tablet, since I need to use some video algorithm, I want to make it C. There is a native-media sample in Google NDK which support native use of OMX to do the decode job. But it seems that it…
Brendon Tsai
  • 1,267
  • 1
  • 17
  • 31
6
votes
2 answers

Use MediaCodec and MediaExtractor to decode and code video

I need to decode a video into a sequence of bitmaps, such that I am able to modify them, and then compress them back to a video file in android. I plan to manage this by using getFrameAtTime and saving it to an image sequence. Then I can modify…
G.T.
  • 562
  • 8
  • 18
6
votes
2 answers

Screen Recorder Android Plugin in Unity

I'm developing an Unity-Android Plugin to record game screen and create a mp4 video file.I follow to Android Breakout game recorder patch sample in this site : http://bigflake.com/mediacodec/. First, I create my CustomUnityPlayer class that extends…
6
votes
1 answer

Fastest way to draw a MediaCodec-decoded video frame to screen?

I'm looking for the fastest way to take an image frame received from the MediaCodec decoder and draw it to the Android device screen. The important constraints and explanations are: Cannot use MediaPlayer. No intermediate app allowed. Must draw…
Andrew Cottrell
  • 3,312
  • 3
  • 26
  • 41
6
votes
2 answers

Multiple MediaCodec instances

i made a Video Player using the MediaCodec library, and i wanted to add a playlist feature. I tried to have two instances of MediaCodec in order to make a smoother transition between two consecutive videos, however this seems to be dangerous, in…
roimatola
  • 115
  • 2
  • 8
6
votes
1 answer

How to use MediaMuxer / MediaCodec InputSurface with GLSurfaceView?

Following the BigFlake example there is a comment that states : // Acquire a new frame of input, and render it to the Surface. If we had a // GLSurfaceView we could switch EGL contexts and call drawImage() a second // time to render it on screen. …
HPP
  • 1,074
  • 1
  • 13
  • 28
6
votes
2 answers

How to save SurfaceTexture as bitmap

When I decode a video to a surface I want to save the frames i want as bitmap/jpeg files. I don't want to draw on the screen and just want to save the content of the SurfaceTexture as an image file.
feisal
  • 585
  • 1
  • 8
  • 20
6
votes
2 answers

Muxing camera preview h264 encoded elementary stream with MediaMuxer

I am working on an implementation of one of the Android Test Cases regarding previewTexture recording with the new MediaCodec and MediaMuxer API's of Android 4.3. I've managed to record the preview stream with a framerate of about 30fps by setting…
mAx
  • 546
  • 1
  • 6
  • 17