I'm trying to grab the Image of a Video via the <a href="https://developer.android.com/reference/android/media/MediaCodec.html" rel="nofollow">MediaCodec</a> using the <a href="https://developer.android.com/reference/android/media/MediaCodec.html#getOutputImage(int)" rel="nofollow">getOutputImage</a> method (Framework used: Exoplayer). I'm NOT using a SurfaceView and every thing else seems fine (<a href="https://stackoverflow.com/a/48928528/4584212" rel="nofollow">this</a> is the implementation). On my emulator I get proper Images. On all my real devices (OnePlus One with Android 7.1.1, Honor 8 with Android 7.0, Samsung Galaxy Tab S with Android 6.0.1) I ALWAYS get null as Image. The Video does play however because I can hear the sound. When showing the Image on a SurfaceView, all my real devices also work fine.
I'm slowly going crazy. Can anyone point me into a direction what I might be doing wrong? Or any direction I might debug / test to figure out what's going wrong?Answer1:
I believe the Exoplayer (v.7) uses the MediaCodec with a <a href="https://google.github.io/ExoPlayer/doc/reference/index.html?com/google/android/exoplayer2/video/DummySurface.html" rel="nofollow">DummySurface</a> inside <a href="https://google.github.io/ExoPlayer/doc/reference/com/google/android/exoplayer2/video/MediaCodecVideoRenderer.html" rel="nofollow">MediaCodecVideoRenderer</a> when configuring the MediaCodec when you don't pass a own Surface to the Exoplayer. <strong>In other words, its probably not a good idea to extract the Image from the MediaCodec when using the Exoplayer because it actually should never work...</strong> (but strangely does on Android 8).