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

Get MPEG-4 video stream's profile programmatically on Android

Is there any way to get MPEG-4 video fils's profile-code using standard Android API? Sample profile-codes are: baseline, main, high and so on. I don't want to include ffmpeg binary in the android app just to get this information. I found reference…
12
votes
3 answers

What does error code -1010 in Android MediaCodec mean?

Here is the stack trace: E/ACodec: [OMX.qcom.video.encoder.avc] configureCodec returning error -1010 E/ACodec: signalError(omxError 0x80001001, internalError -1010) E/MediaCodec: Codec reported err 0xfffffc0e, actionCode 0, while in state 3 …
Chickin Nick
  • 517
  • 1
  • 6
  • 21
12
votes
2 answers

Unable to mux both audio and video

I'm writing an app that records screen capture and audio using MediaCodec. I use MediaMuxer to mux video and audio to create mp4 file. I successfuly managed to write video and audio separately, however when I try muxing them together live, the…
Alexey
  • 287
  • 1
  • 4
  • 9
11
votes
2 answers

Recording video using MediaCodec with Camera2 API

I am trying to use MediaCodec to record raw frames from ImageReader in onImageAvailable callback but unable to write a working code. Most of the examples are using Camera 1 API or MediaRecorder. My aim is to capture individual frames process it and…
HimalayanCoder
  • 9,630
  • 6
  • 59
  • 60
11
votes
1 answer

Android MediaCodec not decoding all input buffers

In Android 4.4.2, I am using MediaCodec to decode mp3 files. I'm using queueInputBuffer() to queue an input mp3 encoded frames and dequeueOutputBuffer() to get the decoded frames. But decoder gives decoded output from 8th frame onwards ( based on…
nmxprime
  • 1,506
  • 3
  • 25
  • 52
11
votes
1 answer

native_window_api_connect returned an error: Invalid argument (-22)

I am writing a Video player application using MediaCodec API. I have to show blank screen before video decoding started. So i am using following code to show blank screen. Canvas c=null; c = surfaceView.getHolder().lockCanvas(); …
saa
  • 1,538
  • 2
  • 17
  • 35
10
votes
2 answers

How to live broadcast from Android

I want to do live broadcasting in the way Periscope is doing it. I did a quick search online and found a bunch of libraries like ffmpeg that use native libraries but according to MediaCodec encoding should be supported straight out of the box with…
MichelReap
  • 5,630
  • 11
  • 37
  • 99
10
votes
2 answers

Transcoding Audio/Video/Image file in Android Device

I am working on a chat application like whatsApp, I want to transcode media file before uploading to server,I have gone through so many links but not able to decide which method i should use, is there any straight forward way of transcoding in…
Anshu P
  • 63
  • 4
  • 14
10
votes
1 answer

Android Unable to instantiate codec 'video/avc'

This is my first post, so bear with me. I'm trying to play raw h264 video onto a Surface object in an android app. I'm using android 5.0.1 on an HTC one. After reading through the android docs, I've found that I need to use a MediaCodec object to…
JMLoy
  • 121
  • 1
  • 1
  • 6
10
votes
9 answers

MediaMuxer video file size reducing (re-compress, decrease resolution)

I'm looking for efficient way to reduce some video weight (as a File, for upload) and obvious answer for that is: lets reduce resolution! (fullHD or 4K not needed, simple HD is sufficient for me) I've tried lot of ways which should work through lot…
snachmsm
  • 17,866
  • 3
  • 32
  • 74
10
votes
0 answers

Android Video Circular Buffer with Sound

I am using Google's Open Source Example: Grafika. I am using it's ContinuousCaptureActivity.java The CircularBuffer's Implementation is demonstrated in this Activity, but there is no audio included in the resultant Video file. I want to add the…
Salman Khakwani
  • 6,684
  • 7
  • 33
  • 58
10
votes
0 answers

Video encode bug using OnAudioFilterRead data

I'm trying to record Unity game audio to mp4 file by using OnAudioFilterRead function. function OnAudioFilterRead(var data:float[], var channels:int) Overview of my solution. Step1. Convert data samples that get from Unity to bytes[] private void…
huythang
  • 313
  • 1
  • 3
  • 13
10
votes
2 answers

How to get bitmap (frames) from video using MediaCodec

I'm trying to get all frames from video file using MediaCodec. If I try display video on SurfaceView, everything is ok. But if surface is null, and when I try get Bitmap from byte array, alwaus get null or runtime exception. This is my code: private…
user3577955
  • 103
  • 1
  • 1
  • 4
10
votes
1 answer

MediaCodec KEY_FRAME_RATE seems to be ignored

I am trying to modify the source for screenrecord in android 4.4 and lower the captured frame rate, but no matter what value I put in: format->setFloat("frame-rate", 5); the result is always the same ( a very high frame rate ) Is the encoder…
jacob
  • 1,397
  • 1
  • 26
  • 53
10
votes
1 answer

Android MediaCodec decode h264 raw frame

I am using Android MediaCodec API to decode h264 frames. I could decode and render the frames on the view. My problem is the decoder miss lots of frames,especially the first some frames. DecodeMediaCodec.dequeueOutputBuffer() return -1. aAbout 150…
Read Mark
  • 683
  • 3
  • 11
  • 19
1 2
3
78 79