mediacodec

Will all phones support YUV 420 (Semi) Planar color format in h.264 encoder?

◇◆丶佛笑我妖孽 提交于 2019-12-06 08:33:15
Preambule: This may sound like a very specific question, but this is actually a go / no go to build an API 16+ Android application using MediaCodec that is compatible with most phone. I have an application with a h.264 MediaCodec that receives data from a buffer - and not a surface since I'm doing a lot of manipulations on the image. When creating the Encoder , I iterate through the list of possible encoders from the phone to make sure I'm using a proprietary encoder if any. This part is not a problem. The problem is that each encoder has its color format preference. This may lead to color

Android MediaCodec appears to buffer H264 frames

China☆狼群 提交于 2019-12-06 07:37:04
I'm manually reading a RTP/H264 stream and pass the H264 frames to the Android MediaCodec. I use the "markerBit" as a border for the frames. The MediaCodec is tied to a OpenGL Texture (SurfaceTexture). In general everything works fine. But the Decoder appears to buffer frames. If I put a frame in the decoder it is not rendered immediately to the texture. After I put 2-3 frames more in the decoder the first frame is rendered to the texture. I'm implementing against Android 4.4.4. private static final int INFINITE_TIMEOUT = -1; private static final int TIMEOUT_OUTPUT_BUFFER_MEDIA_CODEC = 1000; .

Color_FormatSurface implementation

心不动则不痛 提交于 2019-12-06 07:30:50
问题 Is there any available documentation about Color_FormatSurface (AndroidOpaque) color format? My video encoder currently does not support this format, and I am supposed to add that feature, but I cannot find anything about it. Any help would be appreciated. 回答1: There is no documentation on it, because it is opaque. That's "opaque" in the programming sense, not the alpha-blending sense. The idea behind the "opaque" format is that it's whatever the device manufacturer decides is most

MediaCodec simultaneous encoding and decoding

别说谁变了你拦得住时间么 提交于 2019-12-06 07:16:49
问题 I am trying to apply effects to the frames of a video using the GPU and then to re-encode those frames into a new result video. In the interest of performance I have implemented the following flow: There are 3 different threads, each with it's own OpenGL context. These contexts are set up in such a way that they share textures between them. Thread 1 extracts frames from the video and holds them in the GPU memory as textures, similar to this example. Thread 2 processes the textures using a

Converting specialized NV12 video frames to RGB

放肆的年华 提交于 2019-12-06 07:16:35
问题 I have an H264 stream that's decoded using an Android MediaCodec. When I query the output MediaFormat, the color format is 2141391875. Apparently, that's a specialized NV12 variant known as HAL_PIXEL_FORMAT_NV12_ADRENO_TILED. This is on a Nexus 7 (2013). I want to take this data and convert it to RGB so I can create a Bitmap. I've found StackOverflow posts for converting other formats to RGB, not this format. I've tried code from those other posts, the result is just streaks of color. (To

Z-order issue with MediaCodec and TextureView

你。 提交于 2019-12-06 05:52:48
In my Android app I have the need to render three views with the following Z-order: At bottom, the output surface of a MediaCodec decoder covering the whole screen. I have the requirement that I have to transform the image produced by MediaCodec (e.g. scale it) In the middle, a GLSurfaceView (or other surface/view running GL shaders I define), covering the whole screen. Obviously some of the pixels in this layer will be transparent, in order to see the MediaCodec output beneath. On top, any other view - say an ImageView . Not sure if I will require transparency for these topmost views, maybe

Illegal Exception on MediaCodec.configure

℡╲_俬逩灬. 提交于 2019-12-06 05:30:56
I am trying to learn to encode a mp4 or any sort of video file using the Camera's onPreviewFrame call back. Currently, I am trying the example codes from this post Encoding H.264 from camera with Android MediaCodec Unfortunately, I am keep getting an IllegalException on the mediaCodec.configure(mediaFormat, null, null, MediaCodec.CONFIGURE_FLAG_ENCODE); From another post IllegalStateException when MediaCodec.configure Android , I notice that are some mandatory values I have to set for the MediaCodec. I tried all the mandatory mediacodec's mandatory values but still no luck of getting past the

Android MediaCodec backward seeking

百般思念 提交于 2019-12-06 05:14:55
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_PREVIOUS_SYNC); Log.d("TEST_MEDIA", "sampleTime: " + mExtractor.getSampleTime()/1000 + " -- position: " +

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

梦想的初衷 提交于 2019-12-06 04:42:41
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, and I need to convert it to RGB by rendering it (with a fragment shader doing the conversion). MediaCodec

Audio file captured by MediaRecorder is broken after it is sent to server using Retrofit 2

百般思念 提交于 2019-12-06 03:32:56
问题 My app records an audio clip and send the clip to the server using Retrofit2 after the recording is completed.The file is received in server,but the file is broken,what I mean by broken is that it cannot be played. I use the following URL(example url: mydomain.co/audio/myaudio.mp4 ) to play the audio clip,which I tried with another audio file using postman ,the audio file can be played successfully.Besides,even downloading the audio clip captured by android via Filezilla also has the same