35112

MediaCodec returns null for getOutputImage on real devices - Emulator works

Question:

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).

Recommend

  • Fortran function returning unallocated array causes segmentation fault
  • Is jQuery BBQ-Plugin still working with JQuery 1.7x?
  • Sencha touch 2.0 carousel, image resolution
  • Sorting elements of vector where each element is a pair [duplicate]
  • Is the integer width relevant in bitfield declaration?
  • Android in-app-billing. When to unregister the ResponseHandler?
  • Samsung phones and Notification.FLAG_INSISTENT bug?
  • UITextField TapGesture doesn't respond on iOS 7.1
  • How do I apply function to third-dimension array effectively with numpy?
  • ng-pattern that allows decimal ratios
  • Unable to scan Code 128
  • yarn hadoop 2.4.0: info message: ipc.Client Retrying connect to server
  • Can't get LogCat (Alcatel OneTouch Evolve)
  • App Memory Usage differs between Devices
  • How do I recognize a line break with a switch case that evaluates a char in Java?
  • How to add System.Windows dll to Visual Studio 2010 express?
  • Android custom URI scheme incorrectly encoded when type in browser
  • Outlines on links in IE9 remains when focus is changed
  • UWP/C# - Issue with AQS and USB Devices
  • Breaking out column by groups in Pandas
  • How solve “Qt: Untested Windows version 10.0 detected!”
  • HTTP/2 streams vs HTTP/1.1 connections
  • Ionic 2 storage is not cleaning up on uninstall - Only for signed APK
  • Time complexity of a program which involves multiple variables
  • Atlas images wrong size on iPad iOS 9
  • Disable Enter in editText android
  • Cannot resolve symbol 'MyApi'
  • Syntax for setting draggablecursor property in google maps api
  • If I include Java 8 in my Android app does that affect which devices it will work on?
  • Projection media query: browser support and workarounds?
  • Is my CUDA kernel really runs on device or is being mistekenly executed by host in emulation?
  • Javascript Callbacks with Object constructor
  • Release, debug version and Authorization Google?
  • WOWZA + RTMP + HTML5 Playback?
  • GridView Sorting works once only
  • How to get icons for entities from eclipse?
  • Proper folder structure for lots of source files
  • Is there any way to bind data to data.frame by some index?
  • How can I use `wmic` in a Windows PE script?
  • How to push additional view controllers onto NavigationController but keep the TabBar?