mediacodec

Android MediaCodec decode h264 raw frame

点点圈 提交于 2019-12-03 03:02:10
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 h264 frames,just decoded 43 frames. I can not find where the problem is. Here is my codes. /** * init decoder */ private void initDecodeMediaCodec() { mDecodeMediaCodec = MediaCodec.createDecoderByType(MIME_TYPE); MediaFormat format = MediaFormat.createVideoFormat(MIME_TYPE, VIDEO_WIDTH_640, VIDEO_HEIGHT_480); mDecodeMediaCodec.configure(format, new

How MediaCodec finds the codec inside the framework in Android?

匿名 (未验证) 提交于 2019-12-03 02:52:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to understanding how MediaCodec is used for hardware decoding. My knowledge in android internal is very limited. Here is my findings: There is a xml file which represents the codec details in the android system . device/ti/omap3evm/media_codecs.xml for an example. Which means, that If we create a codec from the Java Application with Media Codec MediaCodec codec = MediaCodec.createDecoderByType(type); It should be finding out respective coder with the help of xml file. What am I doing? I am trying to figure our which part of the

MediaCodec with Surface Input: Recording in background

匿名 (未验证) 提交于 2019-12-03 02:49:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm working on a video encoding application which I want to prevent from stopping when the hosting Activity enters the background, or the screen cycles off/on. The architecture of my encoder is derived from the excellent CameraToMpegTest example, with the addition of displaying camera frames to a GLSurfaceView (see Github links below). I'm currently performing background recording with a two-state solution: When the hosting Activity is in the foreground, encode one video frame on each call to the GLSurfaceView.Renderer 's onDrawFrame . This

How to use ByteBuffer in the MediaCodec context in android

匿名 (未验证) 提交于 2019-12-03 02:48:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: So far I am able to setup a MediaCodec to encode a video stream. The aim is to save my user generated artwork into a video file. I use android Bitmap objects of the user artwork to push frames into the stream. See the code snippet I use at the bottom of this post (it is the full code nothing is trimmed): MediaCodec uses ByteBuffer to deal with video/audio streams. Bitmaps are based on int[] which if converted to byte[] will require x4 the size of the int[] I did some research to figure out what contracts are there in place for the ByteBuffer

MediaCodec with Surface Input: Recording in background

拈花ヽ惹草 提交于 2019-12-03 02:47:27
I'm working on a video encoding application which I want to prevent from stopping when the hosting Activity enters the background, or the screen cycles off/on. The architecture of my encoder is derived from the excellent CameraToMpegTest example, with the addition of displaying camera frames to a GLSurfaceView (see Github links below). I'm currently performing background recording with a two-state solution: When the hosting Activity is in the foreground, encode one video frame on each call to the GLSurfaceView.Renderer 's onDrawFrame . This allows me access to the GLSurfaceView's EGL state in

Mediacodec and camera, color space incorrect

匿名 (未验证) 提交于 2019-12-03 02:47:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: By referring Aegonis's work 1 and work 2 , I also got the H.264 stream , but the color is not correct. I am using HTC Butterfly for development. Here is part of my code: Camera: parameters.setPreviewSize(width, height); parameters.setPreviewFormat(ImageFormat.YV12); parameters.setPreviewFrameRate(frameRate); MediaCodec: mediaCodec = MediaCodec.createEncoderByType("video/avc"); MediaFormat mediaFormat = MediaFormat.createVideoFormat("video/avc", 320, 240); mediaFormat.setInteger(MediaFormat.KEY_BIT_RATE, 500000); mediaFormat.setInteger

How to reduce latency in MediaCodec video/avc decoding

匿名 (未验证) 提交于 2019-12-03 02:45:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I performed some simple timing of MoviePlayer.java in the Grafika MediaCodec sample code running on a Nexus 5. I put a log statement at these locations: At line 203 just before decoder.queueInputBuffer At line 244 after decoder.dequeueOutputBuffer I correlated the log statements using presentationTimeUs . Here is an excerpt from logcat: 01-29 10:56:43.295: I/Grafika(21286): queueInputBuffer index/pts, 2,0 01-29 10:56:43.305: I/Grafika(21286): queueInputBuffer index/pts, 0,33100 01-29 10:56:43.315: I/Grafika(21286): queueInputBuffer index/pts

AVC HW encoder with MediaCodec Surface reliability?

匿名 (未验证) 提交于 2019-12-03 02:26:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm working on a Android app that uses MediaCodec to encode H.264 video using the Surface method. I am targeting Android 5.0 and I've followed all the examples and samples from bigflake.com (I started working on this project two years ago, so I kind of went through all the gotchas and other issues). All is working nice and well on Nexus 6 (which uses the Qualcomm hardware encoder for doing this), and I'm able to record flawlessly in real-time 1440p video with AAC audio, in a multitude of outputs (from MP4 local files, upto http streaming).

Encoding H.264 from camera with Android MediaCodec

匿名 (未验证) 提交于 2019-12-03 02:08:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I'm trying to get this to work on Android 4.1 (using an upgraded Asus Transformer tablet). Thanks to Alex's response to my previous question , I already was able to write some raw H.264 data to a file, but this file is only playable with ffplay -f h264 , and it seems like it's lost all information regarding the framerate (extremely fast playback). Also the color-space looks incorrect (atm using the camera's default on encoder's side). public class AvcEncoder { private MediaCodec mediaCodec ; private BufferedOutputStream

Illegal State Exception when calling MediaCodec.configure()

匿名 (未验证) 提交于 2019-12-03 02:05:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: 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: 01-22 17:33:38.379: V/ACodec(16541): [OMX.google.aac.decoder] Now Loaded 01-22 17:33:38.379: V/ACodec(16541): onConfigureComponent 01-22 17:33:38.379: W/ACodec(16541): [OMX.google.aac.decoder] Failed to set standard component role 'audio_encoder.aac'. 01-22 17:33:38.379: E/ACodec(16541): [OMX.google