Android OpenGL视频采集
有谁知道一些方便的方法来捕获视频到文件或从 Android 设备上的 OpenGL 应用程序流式传输?
例如,我们可以从opengl视图中捕获视频吗?
我刚刚发现以下情况: 1)我们可以使用glReadPixels获取帧。 (这一步没有视频吗?) 2) MediaRecorder 可以对视频进行编码,但是如果可能的话,我们如何为其提供原始源呢? 3)ffmpeg(例如)或其他编码库的工作端口吗?有一些 portng ffmpeg 与 NDK 一起使用的教程。那么,有了原始帧和 ffmeg 的工作端口,我们就可以创建视频了吗?这一步有什么问题吗?有人成功移植任何编码库吗?我需要 ffpmeg 的哪些组件?
首选格式是 mp4 或 flv。目标设备> 2.1. NDK没问题
Does anyone knows some convinient method to capture video to file or stream from OpenGL app on Android device?
For example, can we capture video from a view, opengl view?
I just found out the following:
1) We can get frames using glReadPixels. (No video on this step?)
2) MediaRecorder can encode video, but how can we provide it our raw source, if possible?
3) Any working ports of ffmpeg(for example) or other encoding libraries? There are some tutorials of portng ffmpeg to use withing NDK. So, having raw frames and working port of ffmeg we can create video? Any issues on this step? Anyone managed to port any encoding library successfully? What components do I need from ffpmeg?
Preffered formats are mp4 or flv. Target devices > 2.1. NDK is no problem
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这对您的问题来说不是一个简单的答案,但这里有一些提示至少可以让您朝着正确的方向前进。
为了捕获视频帧(非 gl 视图),例如从通用 MediaPlayer 捕获视频帧,您需要硬件支持,我的意思是设备驱动程序。如今,大多数硬件供应商都在其芯片中提供硬件加速器,例如 DSP,以加快视频和相机用例的速度。除此之外,还有用户空间支持(媒体框架和应用程序)允许您访问设备驱动程序,因此媒体框架将是完成捕获视频的最佳选择。我建议研究一些开源项目,例如 Android 中的 gst-plugins (http://gitorious.org/rowboat/external-gst-plugins-android/trees/master),这肯定会让您了解事情是如何叠加的。
对于 gl-view 情况,您需要在 GL 驱动程序中提供某种纹理流支持。目前还没有标准的方法来执行此操作(即,当前的驱动程序可能通过专有扩展来支持它)。使用 glReadPixels 捕获帧的效率不是很高,因为涉及刷新,这会损害您的帧速率。
Not an easy answer to your questions but here's some pointers to at least get you going in the right direction.
For capturing video frames (non-gl view) such as from a generic MediaPlayer you would need hardware support and by that I mean a device driver. Nowadays most hardware vendors are providing h/w accelerators into their chips such as a DSP, in order to speed up video and camera use cases. In addition to that there's the user space support (Media Framework and apps) to allow you to access the device driver, so a media framework would be your best bet to accomplish capturing video. I would recommend studying some of the projects in open source such as gst-plugins in Android (http://gitorious.org/rowboat/external-gst-plugins-android/trees/master), that would definitely will give you an idea on how things stack up.
For the gl-view case, you would need some sort of Texture Streaming support in the GL driver. Right now there's no standard way for doing this (i.e., current drivers may support it through a proprietary extension). The use of glReadPixels for capturing frames is not very efficient as there's a flush involved and that will hurt your frame rate.