mediacodec

Using getInputImage with MediaCodec for encoding

蹲街弑〆低调 提交于 2019-12-07 15:46:42
问题 Background: I do video file demuxing, decode the video track, apply some changes to frames received, decode and mux them again. The known issue doing this in Android are the number of vendor specify encoder / decoder color formats. Android 4.3 introduced surfaces to get device independent, but I found it hard to work with them as my frame changing routines require a Canvas to write to. Since Android 5.0, the use of flexible YUV420 color formats is promising. Jointly with getOutputImage for

Android MediaCodec output format: GLES External Texture (YUV / NV12) to GLES Texture (RGB)

坚强是说给别人听的谎言 提交于 2019-12-07 12:24:15
问题 I am currently trying to develop a video player on Android, but am struggling with color formats. Context: I extract and decode a video through the standard combinaison of MediaExtractor/MediaCodec . Because I need the extracted frames to be available as OpenGLES textures (RGB) , I setup my decoder ( MediaCodec ) so that it feeds an external GLES texture ( GL_TEXTURE_EXTERNAL_OES ) through a SurfaceTexture. I know the data output by my HW decoder is in the NV12 ( YUV420SemiPlanar ) format,

Why doesn't the decoder of MediaCodec output a unified YUV format(like YUV420P)?

雨燕双飞 提交于 2019-12-07 08:02:29
问题 "The MediaCodec decoders may produce data in ByteBuffers using one of the above formats or in a proprietary format. For example, devices based on Qualcomm SoCs commonly use OMX_QCOM_COLOR_FormatYUV420PackedSemiPlanar32m (#2141391876 / 0x7FA30C04)." This make it difficult even not possible to deal with the output buffer.Why not use a unified YUV format?And why there are so many YUV color formats? @fadden,I find it possible to decode to Surface and get the RGB buffer(like http://bigflake.com

Slow H264 1080P@60fps Decoding on Android Lollipop 5.0.2

我是研究僧i 提交于 2019-12-06 22:17:37
I'm developing a JAVA RTP Streaming App for a company project, which should be capable of joining the Multicast Server and receive the RTP Packets.Later I use the H264 Depacketizer to recreate the a complete frame from the NAL FU (Keep append the data until End Bit & Marker Bit set ) I want to decode and display a raw h264 video byte stream in Android and therefore I'm currently using the MediaCodec classes with Hardware Decoder configured. The Application is Up and running for the Jeallybean (API 17). Various Resolutions which I need to decodes are : 480P at 30/60 FPS 720P/I at 30/60 FPS

Recording video using MediaCodec with Camera2 API

醉酒当歌 提交于 2019-12-06 22:11:40
问题 I am trying to use MediaCodec to record raw frames from ImageReader in onImageAvailable callback but unable to write a working code. Most of the examples are using Camera 1 API or MediaRecorder. My aim is to capture individual frames process it and create an mp4 out of it Raw YUV frames @Override public void onImageAvailable(ImageReader reader) { Image i = reader.acquireLatestImage(); processImage(i); i.close(); Log.d("hehe", "onImageAvailable"); } }; MediaCodec MediaCodec codec = MediaCodec

Orientation Issue while video recording in Portrait Mode android grafika

拜拜、爱过 提交于 2019-12-06 14:09:37
I set the device Orientation Landscape mode then it saves the video perfectly. if I capture a video with both sides. But I set the device orientation Portrait Mode this work weird. For Example: Below Screenshot while i Recording video : But when i save the video and see in MXPlayer then it's look like this: I use below code : Display display = ((WindowManager) getSystemService(WINDOW_SERVICE)).getDefaultDisplay(); if (display.getRotation() == Surface.ROTATION_0) { mCamera.setDisplayOrientation(90); // layout.setAspectRatio((double) cameraPreviewSize.height / cameraPreviewSize.width); } else if

Android decode mp3 with MediaCodec. not use MediaExtractor

有些话、适合烂在心里 提交于 2019-12-06 12:37:38
I want to decode the mp3 using the MediaCodec. However, I do not want to use the MediaExtractor. Because it is because I want to get the meta data from mp3. icy (Shoutcast) stream are also taken into consideration. I tried writing the code to decode the mp3 files from FileInputStream by improving the sample of MediaExtractor. However decode caused the error is not possible. package com.test; import android.app.Activity; import android.media.AudioFormat; import android.media.AudioManager; import android.media.AudioTrack; import android.media.MediaCodec; import android.media.MediaCodec

How to reduce the size of video in Android? [closed]

时光总嘲笑我的痴心妄想 提交于 2019-12-06 11:32:21
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 4 years ago . I am new to Android .I don't know how to compress the video in android . Please, suggest me the options? 回答1: You can try Intel INDE on https://software.intel.com/en-us/intel-inde and Media Pack for Android which is a part of INDE, tutorials on https://software.intel.com/en

Android MediaCodec API not working in Child Thread

徘徊边缘 提交于 2019-12-06 10:46:16
In Android, I tried using MediaCodec api (MediaCodecList.getCodecCount()) in Main Thread seems working fine with no issues. But the same api when i used inside its child thread , ends up with application crash. The crash log was stated below: A/libc(18571): Fatal signal 11 (SIGSEGV), code 1, fault addr 0xe0 in tid 18600 The above scenario was tested with Andriod 5.0.2 mobile device. Why such behaviour and any idea to resolve this ? 来源: https://stackoverflow.com/questions/32884208/android-mediacodec-api-not-working-in-child-thread

MediaMuxer.nativeWriteSampleData always peroidically blocks for about one second during video recording

末鹿安然 提交于 2019-12-06 08:36:52
I am doing android video recording using mediacodec + mediamuxer, and now I can record video and generate mp4 file which can be played. The problem is that I find the recorded video will seize for about one second some time. So I launched traceview and I find MediaMuxer.nativeWriteSampleData() cause the problem. Sometimes this function is very fast and returns within several micro-seconds, but sometimes this function is very slow and will consume about one second or so, and the video blocks at that time. I do not know why this function will perform so varying from time to time. The recording