Is it possible to grab the pixel data (e.g. as RGB byte array) from a running video within the ExoPlayer? Ideally as the real video resolution and not the size as the shown View. I'd want to forward that data to OpenCV for ImageProcessing purposes.
Alternatively I'm looking for a robust (ffmpeg based) Android framework to input videos into OpenCV where the input might be IP-Cameras, local files, online files and online streams.
Any help is appreciated.
WARNING this solution currently only works on my Android 8 emulator because of this.
Ok, here is my solution. I'm using the
SimpleExoPlayer
with a customMediaCodecVideoRenderer
. I'm not binding the player to a SimpleExoPlayerView because I'm not allowed to if I want to manually grab the image data. Within my customMediaCodecVideoRenderer
I override theprocessOutputBuffer
and usegetOutputImage
to get a nice standard Android Image. I then send it through my OpenCV code and then transform it back into an Android Bitmap using the OpenCV Utils whenever I need. Careful this code requires API >= 21. Also this codes does not output any audio.I found the Image to Mat conversion here.