问题描述
我正在开发一个应用程序,用于将效果实时应用于相机图像.目前,我正在将MediaMuxer
类与MediaCodec
结合使用.这些类是使用Android 4.3实现的.现在,我想重新设计我的应用程序,使其与更多设备兼容.我在互联网上发现的唯一东西是FFmpeg和OpenCV的结合,但是我读到如果要使用高分辨率,帧率不是很好.
I'm developing an app for applying effects to the camera image in real-time. Currently I'm using the MediaMuxer
class in combination with MediaCodec
. Those classes were implemented with Android 4.3.Now I wanted to redesign my app and make it compatible for more devices. The only thing I found in the internet was a combination of FFmpeg and OpenCV, but I read that the framerate is not very well if I want to use a high resolution. Is there any possibility to encode video in real-time while capturing the camera image without using MediaMuxer
and MediaCodec
?
PS:我正在将GLSurfaceView用于OpenGL片段着色器效果.所以这是必须的.
PS: I'm using GLSurfaceView for OpenGL fragment shader effects. So this is a must-have.
推荐答案
软件编解码器不会以中等帧速率对大型帧进行实时编码.
Real-time encoding of large frames at a moderate frame rate is not going to happen with software codecs.
MediaCodec
是4.1中引入的,因此只要您可以处理各种问题.如果想要结尾的.mp4文件,您仍然需要MediaMuxer
的替代方法.
MediaCodec
was introduced in 4.1, so you can still take advantage of hardware-accelerated compression so long as you can deal with the various problems. You'd still need an alternative to MediaMuxer
if you want a .mp4 file at the end.
一些商业游戏记录器,例如 Kamcord 和 Everyplay ,声称可以在Android 4.1+上运行.因此,从技术上讲是可能的,尽管我不知道它们是否使用非公共API将表面直接馈送到视频编码器中.
Some commercial game recorders, such as Kamcord and Everyplay, claim to work on Android 4.1+. So it's technically possible, though I don't know if they used non-public APIs to feed surfaces directly into the video encoder.
在Jellybean之前的Android中,它只会变得更难.
In pre-Jellybean Android it only gets harder.
(对于有兴趣在> = 4.3中记录GL的任何人,请参见 EncodeAndMuxTest 或 Grafika的记录GL应用程序".)
(For anyone interested in recording GL in >= 4.3, see EncodeAndMuxTest or Grafika's "Record GL app".)
这篇关于在<上记录GLSurfaceView Android 4.3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!