I am working on a project to read a video file from sdcard then process frames and re diplay as a video in real time. So far I didn't manage to come up with a solution for directly extract frames from the MediaPlayer
like MediaPlayer.getCurrentFrame();
. MediaMetadataRetriever.getFrameAtTime()
is super slow, difficult to get a descent frame rate.
The only thing I have right now is using a TextureView
surface with MediaPlayer
. Here I start the MediaPlayer
and in real time read the bitmap form TextureView
asTextureView.getBitMap()
, then process BitMap
and display it on another ImageView
. Here this gives me a a descent frame rate.
The problem here is TextureView
has to be in the xml layout and should visible, Which I do not want.
Can some one please shed some light here? Is it possible to somehow hide the TextureView
which is attaching to the MediaPlayer
, without fake hiding like using RelativeLayouts :). iOS has a solution for this which is AVPLAyerItemVideoOutput
, I need something like that with android.
Or any other work around to extract frames from video file?
Thank you