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
18
votes
3 answers

MediaMuxer error "Failed to stop the muxer"

I'm encoding Camera preview data using MediaCodec with mime-type "video/avc" and passing the encoded data (video-only, no audio) to MediaMuxer. The muxer seems to run fine and creates a reasonably sized output file (i.e., gets larger the longer I…
Andrew Cottrell
  • 3,312
  • 3
  • 26
  • 41
18
votes
3 answers

Muxing AAC audio with Android's MediaCodec and MediaMuxer

I'm modifying an Android Framework example to package the elementary AAC streams produced by MediaCodec into a standalone .mp4 file. I'm using a single MediaMuxer instance containing one AAC track generated by a MediaCodec instance. However I always…
dbro
  • 1,718
  • 1
  • 20
  • 34
17
votes
1 answer

How to compress mp4 video using MediaCodec Android?

In my Android app, I want to compress mp4 video by changing its resolution, bitrate. I don't want to use FFmpeg (because I don't want to use NDK), so I decided to use MediaCodec API. Here are my logical steps: Extract video file with…
TOP
  • 2,574
  • 5
  • 35
  • 60
17
votes
1 answer

Using MediaCodec to save series of images as Video

I am trying to use MediaCodec to save a series of Images, saved as Byte Arrays in a file, to a video file. I have tested these images on a SurfaceView (playing them in series) and I can see them fine. I have looked at many examples using MediaCodec,…
Mohamed_AbdAllah
  • 5,311
  • 3
  • 28
  • 47
16
votes
2 answers

Impossible to mix audio file and video file using MediaMuxer?

I'm developing an Android App that records screen video and audio. I recorded these 2 files : mp3 audio file and mp4 video file(no sound). Now I want to mix them and create a new mp4 video file(with sound). From Android 4.3, Google suggests using…
nguoitotkhomaisao
  • 1,247
  • 1
  • 13
  • 24
16
votes
1 answer

How to pass Camera preview to the Surface created by MediaCodec.createInputSurface()?

Ideally I'd like to accomplish two goals: Pass the Camera preview data to a MediaCodec encoder via a Surface. I can create the Surface using MediaCodec.createInputSurface() but the Camera.setPreviewDisplay() takes a SurfaceHolder, not a Surface. …
Andrew Cottrell
  • 3,312
  • 3
  • 26
  • 41
15
votes
1 answer

Android MediaCodec: Reduce mp4 video size

I am looking for a way to "compress" an mp4 video. To achieve this, I want to reduce the resolution of the video and / or reduce FPS. After long research, I think the way to do it is to use MediaCodec and related APIs as follows : -> MediaExtractor…
Ricardo Cion
  • 151
  • 1
  • 1
  • 4
15
votes
2 answers

In Android, how to pass a predefined Surface to MediaCodec for encoding?

I have an app that manages its own GLSurfaceView and now I want to use Android 4.3's new MediaCodec feature that takes a Surface as input. In all the examples I've seen, the Surface is created using MediaCodec.createInputSurface(), then the GL…
Vin Kemp
  • 301
  • 3
  • 6
14
votes
1 answer

Recording a Surface using MediaCodec

So, In my application, I am able to show effects(like blur filter, gaussian) to video that comes from Camera using GPUImage library. Basically, I (library) will take the input from the Camera, get's the raw byte data, converts it into RGBA format…
14
votes
2 answers

Resizing surface view for aspect ratio change in video display in android

I am working on a video conferencing project. My video display is using surface view. Now during a video call there is a chance of aspect ratio change for the incoming frames. So i have tried the following code for it public void surfaceResize() { …
Kevin K
  • 589
  • 2
  • 7
  • 28
14
votes
2 answers

MediaCodec H264 Encoder not working on Snapdragon 800 devices

I have written a H264 Stream Encoder using the MediaCodec API of Android. I tested it on about ten different devices with different processors and it worked on all of them, except on Snapdragon 800 powered ones (Google Nexus 5 and Sony Xperia Z1).…
lowtraxx
  • 321
  • 3
  • 8
14
votes
1 answer

IllegalStateException at MediaCodec.dequeInputBuffer / dequeOutputBuffer

I am trying to convert a PNG file to a one slice video clip, so to just to make a start-up over a project. What I had code to make it happen is :- private boolean MediaConversion() { MediaCodec codec =…
Harpreet
  • 2,990
  • 3
  • 38
  • 52
12
votes
2 answers

I want to attach Pre-Rolls to videos taken on android devices

I'm using mp4parser and the videos need to be of the same kind. I was thinking of using android's media codec to decode & encode the preroll video to fit the same encoding output of the cameras (front & back) any suggestion on how this can be done…
Gorilla
  • 553
  • 1
  • 6
  • 11
12
votes
1 answer

Android MediaCodec encoder - weird results for Samsung device

Edit: Seems the issue is this device needs not multiple of 16 dimensions...but multiple of 32. Thing is, I still have no idea how to determine what quantifies as a problematic device. This does appear to use qcom (which I've seen to be problematic…
12
votes
1 answer

How to set average+max bitrate for MediaCodec to encode H.264 video?

I'm using MediaCodec to encode H.264 video from camera, the problem is, when I move my phone, the output video's quality is very pool, full of mosaic/visual blocks in the video. Belows are some details: My encoder bitrate is 500 kbps, and…
Piasy
  • 989
  • 13
  • 35
1
2
3
78 79