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
5
votes
1 answer

MediaCodec decoder latency for live-streaming

I'm using MediaCodec to decode a H.264 video @ 30FPS that I receive from an RTSP live stream, the decoder runs on an android device. However, I see a latency in the output of the MediaCodec's decoder. It looks like the decoder waits until it…
5
votes
2 answers

MediaCodec - strange error when sending EOS buffer into audio decoder

I'm working on replacing the audio track of my video with music from another file. So I modified the standard ExtractDecodeEditEncodeTest code (from bigflake) so that the audio MediaExtractor is created from said 'another file'. A strange thing…
Gensoukyou1337
  • 1,507
  • 1
  • 13
  • 31
5
votes
1 answer

Audio file captured by MediaRecorder is broken after it is sent to server using Retrofit 2

My app records an audio clip and send the clip to the server using Retrofit2 after the recording is completed.The file is received in server,but the file is broken,what I mean by broken is that it cannot be played. I use the following URL(example…
ken
  • 2,426
  • 5
  • 43
  • 98
5
votes
1 answer

android - MediaCodec - Encode images to mp4 video

I'm trying to convert a set of images into an mp4 video. I'm having some problems with the video created, and I'm not sure if my code is correct to create a valid mp4 video. I have a lot of problems when I use the result video with FFmpeg. Lof of…
Xys
  • 8,486
  • 2
  • 38
  • 56
5
votes
2 answers

How to trim video with MediaCodec

I'm trying to record the screen with MediaProjection API. I want to trim the video that was recorded by the media projection. Is there a way to do that without using any 3rd party dependency?
mnagy
  • 1,085
  • 1
  • 17
  • 36
5
votes
0 answers

Android MediaFormat KEY_REPEAT_PREVIOUS_FRAME_AFTER ignored?

I am working on an app that streams the content of the screen and streams it over rtsp. I am using MediaCodec and VirtualDisplay. The problem I am having is that when the screen remains static, no data is sent over the network (new frames are not…
Antonio C G
  • 331
  • 2
  • 12
5
votes
0 answers

Android MediaCodec CodecException while configure

I receive an exception when trying to configure for a AVC encoder. I need to shutdown and re create the codec when the video stream resolution changes. Does anyone have inputs for the exception below: 10-14 15:10:20.934 E/OMX-VENC( 980):…
Ajay
  • 51
  • 1
  • 3
5
votes
0 answers

Android convert image to video using mediacodec and Opengl es

I started from : http://bigflake.com/mediacodec/, EncodeAndMuxTest example. There frames are generated using opengl. I changed the generateSurfaceFrame() method as I will show: private void generateSurfaceFrame(int frameIndex) { final int[]…
Siv
  • 193
  • 2
  • 16
5
votes
2 answers

Android MediaCodec configure error, crash

I'm trying to use mediaCodec for creating mp4 video from openGl ES surface. I have an eglSurface, and the source surface of that eglSurface is MediaCodec input surface. I can have different sizes for eglSurface, and when one size (width or height)…
5
votes
0 answers

Android MediaMuxer java.lang.IllegalStateException: Failed to stop the muxer

I am using this library for recording video from a USB camera. The code I used is as follows: try { private MediaMuxerWrapper mMuxer; mMuxer = new MediaMuxerWrapper("FolderName", ".mp4"); new MediaVideoEncoder(mMuxer,…
chengsam
  • 7,315
  • 6
  • 30
  • 38
5
votes
3 answers

Android MediaCodec appears to buffer H264 frames

I'm manually reading a RTP/H264 stream and pass the H264 frames to the Android MediaCodec. I use the "markerBit" as a border for the frames. The MediaCodec is tied to a OpenGL Texture (SurfaceTexture). In general everything works fine. But the…
Soccertrash
  • 1,830
  • 3
  • 28
  • 48
5
votes
2 answers

MediaExtractor throws IllegalArgumentException when used with wav file

I am using the Android MediaExtractor like this: MediaExtractor extractor = new MediaExtractor(); extractor.setDataSource("path/to/my/wav/file.wav"); extractor.selectTrack(0); ByteBuffer inputBuffer = codec.getInputBuffer(inputBufferIndex); int…
muetzenflo
  • 5,653
  • 4
  • 41
  • 82
5
votes
0 answers

How to configure Media Codec AAC Decoder (Audio sent with Gstreamer)

I want to build an app that plays AAC audio stream sent by my Raspberry Pi with Gstreamer. This is the pipeline I set in Gstreamer: gst-launch-1.0 audiotestsrc ! faac "bitrate=64000" ! "audio/mpeg, mpegversion=4, rate = 44100, channels = 1" ! mux.…
J.Ney
  • 201
  • 1
  • 2
  • 11
5
votes
1 answer

Android MediaCodec: How many simultaneous (video) decoding threads are supported on multiple SurfaceViews?

From Grafika project, file DoubleDecodeActivity.java. I tried 3 simultaneous video(h264) decoders using MediaCodec APIs on 3 SurfaceViews. On adding 4th decoder to 4th SurfaceView to Nexus 7 with Android 5.1 CRASHES, So how many simultaneous…
Arpan
  • 613
  • 7
  • 18
5
votes
1 answer

Android resize VirtualDisplay

I have a few problems (actually more, but these are the more critical ones) with Android's MediaProjection API. Reading the graphics architecture won't really help, so I'm just looking to understand if I skipped something in my code flow. Let's…