Android MediaCodec:解码,处理每一帧,然后进行编码

时间:2014-03-23 22:58:16

标签: android mediacodec

bigflake.com中的示例DecodeEditEncodeTest.java演示了一个简单编辑的示例(使用OpenGL FRAGMENT_SHADER交换颜色通道)。

在这里,我想对每个帧进行一些复杂的图像处理(例如在其中添加内容)。 这样,是否意味着我不能使用表面。相反,我需要使用缓冲区? 但是从EncodeDecodeTest.java,它说:

(1)    Buffer-to-buffer. Buffers are software-generated YUV frames in ByteBuffer objects, and decoded to the same. This is the slowest (and least portable) approach, but it allows the application to examine and modify the YUV data.
(2)    Buffer-to-surface. Encoding is again done from software-generated YUV data in ByteBuffers, but this time decoding is done to a Surface. Output is checked with OpenGL ES, using glReadPixels().
(3)    Surface-to-surface. Frames are generated with OpenGL ES onto an input Surface, and decoded onto a Surface. This is the fastest approach, but may involve conversions between YUV and RGB. 

如果我使用Buffer-to-buffer,从上面所说,它是最慢和最不便携的。它有多慢?

或者我使用表面到表面,并从表面读取像素。

哪种方式更可行? 有任何可用的例子吗?

0 个答案:

没有答案