mediacodec

Use MediaCodec to record 720p video but fps of encoding video is too low

喜夏-厌秋 提交于 2019-12-10 18:47:06
问题 I managed to write a video recording demo, my implementation is the same as ContinuousCaptureActivity of Grafika. In ContinuousCaptureActivity.java, The author create egl object in SurfaceCreated which run in UI thread and call drawFrame also in UI thread. He did 2 things in drawFrame, draw frame to screen and push data to encoder. See the code here: ContinuousCaptureActivity Because I set the encoding video size to 1280*720 which is large, the camera preview is not smooth and fps of target

How to detect the chipset in android device? [closed]

泄露秘密 提交于 2019-12-10 17:22:51
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . I need to detect the chipset of the android device. So I can disable certain functionality on MediaTek chipset. (1080p encoding as discussed in this question MediaCodec Encoded video has green bar at bottom and chrominance screwed up) I have taken a look at http://developer.android.com/reference/android/os/Build

Non-streamable video file created with MediaMuxer

我与影子孤独终老i 提交于 2019-12-10 15:38:19
问题 I am using MediaCodec to encode video. Frames are coming through the camera preview callback to the MediaCodec instance (no Surface used). I am using JCodec library for muxing and I am able to stream produced video (video player is showing correct duration and I am able to change video position with seek bar). Today I've tried to use MediaMuxer instead of JCodec and I've got video which still looks fine, but duration is absolutely incorrect (a few hours instead of one minute) and the seek bar

Android MediaMuxer readSampleData IllegalStateException

倾然丶 夕夏残阳落幕 提交于 2019-12-10 11:58:47
问题 I am using the following code to generate a video. However, one in every 5 attempts the readSampleData raises either a IllegalArgumentException or a IllegalStateException. What can I do to stop the exceptions. Can I check the state of the extractor before calling readSampleData. If so, how? MediaExtractor videoExtractor = new MediaExtractor(); videoExtractor.setDataSource(SOURCE); Log.d(TAG, "Video Extractor Track Count " + videoExtractor.getTrackCount() ); MediaMuxer muxer = new MediaMuxer

support full swing android media decoder?

青春壹個敷衍的年華 提交于 2019-12-10 11:54:41
问题 When I decode a full swing video using Android MediaCodec class, the output is always in studio swing? am I missing a header in the video file? I know after Android 24, I can use MediaFormat class to set COLOR_RANGE_FULL ? Any help on this? seems like even setting MediaFormat.setInteger(MediaFormat.KEY_COLOR_RANGE, MediaFormat.COLOR_RANGE_FULL); Also doesn't help on android 24. 回答1: I talked to engineers from Android team at Google, and they mentioned this part of the code should be

OMX.google.aac.encoder do not work in MediaCodec when encode pcm to aac

落花浮王杯 提交于 2019-12-10 11:50:54
问题 I am encoding pcm track of wav file into aac using MediaCodec on Android 4.1, on my S3, there are two encoders, OMX.google.aac.encoder and OMX.SEC.aac.enc, the first one is used if call createEncoderByType, but it does not work, the output can't be played(has no sound), if call createByCodecName with "OMX.SEC.aac.enc", it works. While on my HTC ONE, there is only "OMX.google.aac.encoder", and does not work. I think my code has no problem, because it was copied from google, and the second

Media Codec and Rendering using GLSurfaceview, Optimization for OnDrawFrame

情到浓时终转凉″ 提交于 2019-12-10 11:48:44
问题 I am using media codec for encoding frame coming from camera and render it using gl surface view. my ondrawframe looks like this public void onDrawFrame(GL10 unused) { float[] mtx = new float[16]; GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT); surface.updateTexImage(); surface.getTransformMatrix(mtx); mDirectVideo.draw(surface); saveRenderState(); delegate.mInputSurface.makeCurrent(); mDirectVideo.draw(surface); delegate.swapBuffers(); restoreRenderState(); } So here

Android MediaCodec backward seeking

那年仲夏 提交于 2019-12-10 10:59:35
问题 I'm trying to implement precise seeking for video using MediaCodec and MediaExtractor . By following Grafika's MoviePlayer, I've managed to implement the forward seeking. However I'm still having problem with backward seeking. The relevant bit of code is here: public void seekBackward(long position){ final int TIMEOUT_USEC = 10000; int inputChunk = 0; long firstInputTimeNsec = -1; boolean outputDone = false; boolean inputDone = false; mExtractor.seekTo(position, MediaExtractor.SEEK_TO

Andriod 录屏:AudioRecord、MediaProjection、MediaCodec、MediaMuxer

别说谁变了你拦得住时间么 提交于 2019-12-10 09:51:00
文章目录 背景 Android 音视频组件介绍 模块介绍 状态介绍 音频录制模块:AudioRecord + MediaCodec 视频录制模块:MediaProjection + MediaCodec 混合模块:MediaMuxer 流程图 问题 1. 时间戳同步问题 2. 暂停和恢复 3. 花屏问题或者启动奔溃问题 (1) 长宽限制 (2) 启动崩溃 (3) 切换场景会出现糊或者花屏 4. 纯视频时候,播放速度过快问题 5. 异常处理 6. MediaCodec数量限制、AudioRecord被占用 7. 绕过权限检测 8. 死锁问题 9. 录制系统声音 10. 利用SurfaceControl替换MediaProjection 11. 强制输出key帧 背景 Android 为开发者提供了MediaRecorder的类,可以帮助录屏。但是重要的缺陷: MediaRecorder控制粒度很粗,无法完成更多的自定义功能,如对音频数据处理 MediaRecorder录制的效果很差,特别是音频效果。 为了更好的效果,最终决定利用AudioRecord、MediaProjection、MediaCodec、MediaMuxer几个重要的组件进行录屏。 这几个组件都涉及到很多的音视频的知识,建议先看之前的音视频相关的文章介绍。 Android 音视频组件介绍 AudioRecord :

How to record webview activity screen using Android MediaCodec?

百般思念 提交于 2019-12-10 06:59:00
问题 I have the task to record user activity in a webview, in other words I need to create an mp4 video file while the user navigates in a webview. Pretty challenging :) I font that in Android 4.3 introduced MediaCodec : was expanded to include a way to provide input through a Surface (via the createInputSurface method). This allows input to come from camera preview or OpenGL ES rendering. I even find an example where you could record a game written in opengl : http://bigflake.com/mediacodec/ My