Android的视频滤波器 [英] Android video filter

查看:212
本文介绍了Android的视频滤波器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图创建一个应用程序在那里我能过滤器添加到录制的视频。基本上,我想复制这种存在于Instagram的视频或Viddy的功能。

I'm trying to create an app where I am able to add filters to a recorded video. Basically, I want to replicate the functionality that exists in Instagram video, or Viddy.

我已经做了研究,我无法拼凑它一起。我已经研究过使用GLSurfaceView播放录制的视频,我知道我可以使用NDK做像素处理,并将其发送回SurfaceView或保存它以某种方式。问题是,我不知道如何发送的像素数据,因为似乎没有什么功能来访问它。这个想法来自于摄像功能的previewFrame。该函数返回一个字节数组让我来操纵像素并显示出来。

I've done research and I can't piece it all together. I've looked into using GLSurfaceView to play the recorded video and I know I could use NDK to do the pixel manipulation and send it back to the SurfaceView or save it somehow. The problem is, I don't know how to send the pixel data because there seems to be no function to access it. This idea came from the Camera function "onPreviewFrame". The function returns a byte array allowing me to manipulate the pixels and display it.

另一个想法是使用GLSurfaceView和使用OpenGL渲染滤波器。 GLSurfaceView有一个渲染器,你可以设置,但我不是很熟悉的OpenGL。但是同样,这可以追溯到实际上得到每个视频帧的像素。我也读到翻录每一帧作为纹理,然后操纵纹理在OpenGL,但我遇到的答案不是很详细。

Another idea is to use GLSurfaceView and use OpenGL to render the filter. GLSurfaceView has a renderer you can set, but I'm not very familiar with OpenGL. But again, this goes back to actually getting the pixels of each video frame. I also read about ripping each frame as a texture and then manipulating the texture in OpenGL but the answers I've come across are not very detailed.

最后,我看着JavaCV。试图用FFmpegFrameGrabber,但我没有太多两种。我想只要抓住一个帧,但是当我尝试写帧的ByteBuffer的一个ImageView的,我得到一个像素缓冲区不够大的错误。

Lastly, I've looked into JavaCV. Trying to use FFmpegFrameGrabber, but I haven't had much either. I wanted to just grab one frame, but when I try to write the frame's ByteBuffer to an ImageView, I get a "buffer not large enough for pixels" error.

任何指导,将是巨大的。

Any guidance would be great.

推荐答案

从安卓4.3,你可以使用表面作为输入到您的EN codeR。 http://developer.android.com/about/versions/android-4.3 html的#多媒体

From Android 4.3 you can use a Surface as the input to your encoder. http://developer.android.com/about/versions/android-4.3.html#Multimedia

所以,你可以使用GLSurfaceView使用片段着色应用过滤器。

So you can use GLSurfaceView and apply the filters using fragment shaders.

您可以在这里找到一些很好的例子。 http://bigflake.com/media$c$cc/

You can find some good examples here. http://bigflake.com/mediacodec/

这篇关于Android的视频滤波器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆