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

Getting QualComm encoders to work via MediaCodec API

I am trying to do hardware encoding (avc) of NV12 stream using Android MediaCodec API. When using OMX.qcom.video.encoder.avc, resolutions 1280x720 and 640x480 work fine, while the others (i.e. 640x360, 320x240, 800x480) produce output where chroma…
6
votes
1 answer

Android MediaCodec API video plays too fast

I'm currently working with Android Jelly Bean MediaCodec API to develop a simple video player. I extract tracks, play audio and video in separate threads. The problem is that video track always is played too fast. Where can be the problem…
5
votes
1 answer

AMR decoding from RTP

I'm receving some RTP stream, which I know only its AMR-WB octet-aligned 100 ms per packet. Some 3rd party can receive same stream and its "hearable", so its proper. Now I'm receiving this data and trying to decode, without luck... init: val…
snachmsm
  • 17,866
  • 3
  • 32
  • 74
5
votes
0 answers

How to record an existing surface (not a PersistentSurface) using MediaRecorder

I'm trying to record the camera stream which I don't have access to. I'm only have access to a custom SurfaceView that gets the images from the camera preview and render the images. I would like to save the surface \ camera video into a file. I'm…
Aviram Fireberger
  • 3,910
  • 5
  • 50
  • 69
5
votes
1 answer

How can I share a Surface between MediaCodec encoder and CameraX

I want to get the images from CameraX (Preview Use case) and encode them as h.264 Video using MediaCodec. How can I achieve this ? What I was trying was, to use the Surface returned from MediaCodec.createInputSurface() in Preview.Builder() by using…
5
votes
0 answers

How to trim a video file at a precise position without re-encoding using FFMPEG

I am having trouble trimming video files without causing the Video/Audio to go out of sync. From what I understand, using the seek argument -ss before or after the input file results in two different behaviors. For Example: ffmpeg -ss…
Wassim Erriha
  • 63
  • 1
  • 7
5
votes
0 answers

Android MediaCodec fails to start

I'm trying to use MediaCodec to generate a mp4 file from a set of bitmaps i have. After a lot of coding and testing I noticed that no example existent on internet or whatever work on the Android Studio emulator, but they do work in both of my real…
Rafael Lima
  • 3,079
  • 3
  • 41
  • 105
5
votes
0 answers

Play Multiple ExoPlayer's inside RecyclerView (Inside ViewPager) causes MediaCodec Exception

I am trying to play multiple (10) ExoPlayer's inside RecyclerView inside ViewPager (Running on Samsung Galaxy Note9) and after swiping right and left enough times i got exceptions and the players(that throws the exceptions) stopping play. You can…
5
votes
4 answers

How to get frame by frame from MP4? (MediaCodec)

Actually I am working with OpenGL and I would like to put all my textures in MP4 in order to compress them. Then I need to get it from MP4 on my Android I need somehow decode MP4 and get frame by frame by request. I found this…
Sirop4ik
  • 4,543
  • 2
  • 54
  • 121
5
votes
1 answer

Problems in making Video from Lottie JSON File and Overlay it with original video using FFMPEG

there is some unique concept about processing Lottie Animations using FFMPEG video processing library and MediaCodec. In that, I wants to make video from Lottie animation and overlay that video on other original video. But the problem is i'm unable…
Krishna Vyas
  • 1,009
  • 8
  • 25
5
votes
1 answer

Understanding of MediaCodec and MediaExtractor

I want to do some processing on audio files without playing them, just math. I doubt if I'm doing right and have several questions. I read some examples but most of them is about video streaming and there is no working with raw data at all. I…
Powercoder
  • 695
  • 1
  • 5
  • 25
5
votes
0 answers

How to crop the video buffer from dequeoutputbuffer of media codec in android surface?

We have raw streaming data which we are decoding and rendering using MediaCodec native code on Kitkat. Consider our video resolution is 800 X 480 and the actual video content lies in 800 X 380. The top and bottom height margin each of 50px contains…
5
votes
0 answers

Android FFmpeg - Mux encoded h264 frames from MediaCodec

I'm trying to capture h264 frames from Android camera (encoded by MediaCodec) and pass them to an FFmpeg process running on the same device. I currently do it by writing the encoded byte arrays I receive from the MediaCodec to a file called…
Bob Ross
  • 756
  • 6
  • 13
5
votes
0 answers

MediaCodec.release() causes crashes: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR) in _ZNK7android7RefBase9decStrongEPKv

An app is quite stable. The vast majority of its occasional crashes are caused by MediaCodec.release() in the following code: mediaCodec.stop() mediaCodec.release(); or mediaCodec.reset() mediaCodec.release(); The exception cannot be caught. …
Hong
  • 17,643
  • 21
  • 81
  • 142
5
votes
0 answers

using media projection with media recorder produce corrupted video

I am trying to use media projection api that became available on lollipop devices (android 5 and above), now I realized 2 ways of using this api with android: First way: Using the mediacodec and media muxer. Second way Using the media recorder…