我正在制作Android游戏。(使用andengine)
我需要录制游戏屏幕。
这不是为了制作宣传视频,而是为了让玩家回顾自己的游戏玩法。
我的应用程序应该自己录制视频。
所以我无法使用市场上可用的录音应用程序来解决这个问题。
我已经检查过下面的代码。
<一href="http://code.google.com/p/andengineexamples/source/browse/src/org/anddev/andengine/examples/ScreenCaptur eExample.java?spec=svn66d3057f672175a8a21f9d06e7a045942331f65c&r=66d3057f672175a8a21f9d06e7a045942331f65c" rel="nofollow">http://code.google.com/p/andengineexamples/source/browse/src/org/anddev/andengine/examples/ScreenCap tureExample.java?spec=svn66d3057f672175a8a21f9d06e7a045942331f65c&r=66d3057f672175a8a21f9d06e7a045942331f65c
它运作得很好..
但我想录制游戏视频,而不是一张屏幕截图。
至少我需要 24fps 才能流畅重播,但是如果我使用 glreadpixels ,我可以在我的 xoom 设备上获得 5 fps。
我搜索了各个网站来解决这个优化问题。
大多数人说 glreadplxels 录制视频太慢。
http://www.gamedev.net/topic/473794- glreadpixel-takes-tooooo-much-time/
他们推荐 glcopyteximage2d 而不是 glreadpixels。
因为 glcopyteximage2d 比 glreadpixels 快得多。
但我找不到如何在 andengine 中使用 glcopyteximage2d 。
甚至有人说android opengl ES不支持glcopyteximage2d。
也许存在另一种方法来录制流畅的视频。
它是读取Android设备的帧缓冲区。
市场上大多数录音应用程序都使用这种方法。但这些应用程序需要 root 权限才能获取帧缓冲区。
我读到一些消息称 android 将在姜饼之后支持从 suface_flinger 捕获屏幕。
但我不知道如何在没有root权限的情况下使用framebuffer。 T_T
这些是我的猜测解决方案。
-
使用另一个比 glreadpixels 速度更快的 opengl API。
-
发现一些android API可以在没有root权限的情况下获取framebuffer。
(也许我可以访问android SURFACE_FLINGER?)
-
绘制另一个屏幕外纹理来录制视频。
但我不知道如何实现这些方法。
哪种方法是正确的?
你有一个为Android录制视频的示例代码吗?
请帮我解决这个问题。
如果您知道任何其他方法,那将会有所帮助。
任何帮助将不胜感激
I'm making android game.(using andengine)
I need to record game play screen .
This is not for making promotion video, It is for game players to review their game play.
My app should record video by itself.
So I can't solve this problem using available recording app in market.
I already checked below code.
http://code.google.com/p/andengineexamples/source/browse/src/org/anddev/andengine/examples/ScreenCaptureExample.java?spec=svn66d3057f672175a8a21f9d06e7a045942331f65c&r=66d3057f672175a8a21f9d06e7a045942331f65c
It works very well..
But I want to record game play video, not a one screenshot.
At least I need 24fps for smooth replay, But If I use glreadpixels , I can get 5 fps at my xoom device.
I searched various websites to solve this optimization problem.
most people saying glreadplxels is too slow to record video.
http://www.gamedev.net/topic/473794-glreadpixel-takes-tooooo-much-time/
they recommend glcopyteximage2d instead of glreadpixels.
because glcopyteximage2d is much more faster than glreadpixels.
but I can't find how to use glcopyteximage2d in andengine.
even someone say that android opengl ES do not support glcopyteximage2d.
Maybe Another method exists to record smooth video.
It is read framebuffer of android device.
most of recording app in market using this method. but these app needs root permission to grab framebuffer.
I've read some news that android will be support capture screen from suface_flinger after gingerbread.
But I can't find out how to use framebuffer without root permission. T_T
These are my guessing solution.
-
use another opengl API which has better speed than glreadpixels.
-
find some android API can get framebuffer without root permission.
(Maybe I can access to android SURFACE_FLINGER ??)
-
draw another offscreen texture to record video.
But I don't know how to implement these methods.
Which approach is correct?
Do you have a example code to record video for android?
please help me to solve this problem.
If you know any other method, That will be helpful.
any help will be appreciated
发布评论
评论(1)
您设备的GPU供应商是否支持es3.0,如果支持您可以尝试使用PBO。
这是我的一个主题,您可以参考:PBO 读回性能低,救命!!!!!
Does the GPU vendor of your device support es3.0, if it does you can try to use PBO.
Here is a topic I you can refer to :Low readback performance with PBO , help !!!!!