I'm using OpenGLES3.0 to do video processing.
I found that it's possible to get frames from a video by using Android MediaExtractor
and MediaCodec
API together with Surface texture, like below.
glGenTextures( 1, &textureId );
glBindTexture(GL_TEXTURE_EXTERNAL_OES, textureId);
glTexParameterf(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameterf(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glBindTexture(GL_TEXTURE_EXTERNAL_OES, 0);
But there is no such API in GLES3.0.
My question is: is there a relevant API in OpenGLES3.0 to generate and use surface texture? Or is there some other APIs in Android to get all frames from a video?
I tried getFrameAtTime()
in MediaMetadataRetriever
and FFmpegMediaMetadataRetriever
but I could only get the key frames rather than all frames, even with MediaMetadataRetriever.OPTION_CLOSEST
.