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

Android MediaCodec and camera: how to achieve a higher frame rate to get frame raw data from camera?

The example of CameraToMpegTest.java in bigflake.com, or "Show + capture camera" in Grafika, uses the camera.preview to get the frame data. Experiments show that (Nexus 4, Android 4.4.2) the frame rate is 10 fps. This is not as high as expected. If…
user1914692
  • 3,033
  • 5
  • 36
  • 61
7
votes
4 answers

Set AVC/H.264 profile when encoding video in Android using MediaCodec API

Android provides a way to query the supported encoding profiles. But when setting up an encoder I cannot find the way to specify the desired profile to be used. Finding supported profile/level pairs Using the MediaCodec API in android you can call…
pauld
  • 73
  • 1
  • 1
  • 5
7
votes
0 answers

MediaCodec converted file from WAV to AMR does not play

I am using MediaCodec to convert a .wav file to .amr. I have used following code for input and getting encoded buffer. I get the encoded file but it does not play, my input is proper as i am able to play that file in Audacity. I am using…
7
votes
1 answer

Illegal State Exception when calling MediaCodec.configure()

I get the IllegalStateException on MediaCodec.configure() line, I'm trying to record audio using MediaCodec. This only occur on some phones, on tabs everything is fine. This particular crash example is from Samsung Galaxy S4. Exception traces:…
Alexey
  • 287
  • 1
  • 4
  • 9
7
votes
2 answers

How to provide both audio data and video data to MediaMux

I'm trying to get video raw data by Preview, get audio raw data by AudioRecord. Then I will send them to MediaCodec(I will set two Codec instance). After that I will send the video data and audio data to MediaMux to get a mp4 file. I have two…
Brendon Tsai
  • 1,267
  • 1
  • 17
  • 31
7
votes
1 answer

Decoding audio files and re-encoding to desired PCM format: 44,100 kHz, 2 Channels, 16 Bit

I want to decode audio files to raw PCM data to stream it to a playback device in the local network. I use the new MediaExtractor and MediaCodec classes, introduced with API level 16, for that. The device requires the PCM data to be in 44,100 kHz,…
pocmo
  • 660
  • 6
  • 24
7
votes
1 answer

MediaCodec with Surface input: Producing chunked output

I'm trying to produce short sequential mp4 files from CameraPreview data via MediaCodec.createInputSurface(). However, recreating the MediaCodec and it's associated Surface requires stopping the Camera to allow another call to…
dbro
  • 1,718
  • 1
  • 20
  • 34
7
votes
4 answers

How to initialize MediaFormat to configure a MediaCodec to decode raw AAC data?

I have a strange issue with my StreamPlayer and I need any help I can get. The main goal I need to achieve is StreamPlayer which is able to play back MPEG-2 Transport Streams with smallest possible latency. For this I am following this approach: The…
twetjen
  • 131
  • 1
  • 6
6
votes
3 answers

Flutter: Flutter Video Player cannot play a video file TWICE [Video controller cannot be used after disposed]~

I'm using Official Flutter Video Player Package for my flutter app, but the displayer is totally black and I also got this error while displaying it on the screen: E/flutter (10774): [ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception:…
6
votes
0 answers

Video and Audio Sychronization issue

I am saving frames to H264 format and I saved audio to aac format. Then I concatenate of these format to creating mp4 format using ffmpeg player in android but When I concatenate Audio and Video, audio getting back of video they aren't playing at…
Diego
  • 937
  • 8
  • 24
6
votes
0 answers

Firebase MLKit Android from an external camera

I believe I found a bug in the Firebase MLKit for Android, but perhaps other people have some insight into it. I am currently streaming video from a drone to my Android device. It is being decoded to YUV420-888 with MediaCodecand written to an…
hellowill89
  • 1,538
  • 2
  • 15
  • 26
6
votes
1 answer

Screen Sharing between Devices using Media Projection API

I am developing an app which has the functionality of sharing screens with other apps. I used the Media projection API for this. I also used MediaMuxer to combine the audio and video outputs for screen sharing. I know that Media Projection APIs are…
6
votes
0 answers

Android MediaExtractor / MediaCodec Native Crash

I have developed a simple audio player in Android that, among others, plays .mp3-files. To decode the files I am using the Android MediaExtractor and the Android MediaCodec. The sample code looks as follows: int inIndex =…
6
votes
1 answer

How or where to specify omx decoder supports tunneling

The BSP supports tunneling of Hw accelerated codec. Android uses feature-tunneled-playback to check if tunneling is supported. If yes It will try to configure tunneling. How to implement or specify the android extension…
nmxprime
  • 1,506
  • 3
  • 25
  • 52
6
votes
2 answers

How to adjust play speed of video on android?

I need to implement a requriment of adjust play speed when playing a video, how can I do that using Android API (MediaPlayer) or other 3rd-party library? I google it, and no any idea by far. Any suggestions welcome, thank you.
sunjinbo
  • 2,137
  • 4
  • 22
  • 45