1

I have been trying to capture the screen from Android Emulator and record it to a .mp4 file. I adopted the standard approach of creating a virtual display and routing the frames to an encoder, multiplexing the video channel and writing to the an external storage. However, the ouput .mp4 file is just a blank screen when played back. The same code works when run on a device.

One observation is that the BufferInfo.size from onOutputBufferAvailable() always has a constant value of 13 or 2718 which clearly indicates trouble with the MediaCodec encoder. Should I change some parameters when configuring the encoder?

Another observation is from Logcat that tells me that a SoftAVCEncoder is used when running in an emulator, which kinda indicates that some software encoding is used but still not sure why this does not work.

Antony Thomas
  • 3,576
  • 2
  • 34
  • 40
  • 1
    What android version is the emulator running? The bundled software AVC encoder (which is the only encoder available in the emulator) was pretty much broken in all possible ways until Android 6.0, where it was replaced with a much better implementation. (Actually, most of the issues were in the layer that hooks it up to the rest of the media framework, but the encoder itself wasn't too great either.) – mstorsjo Mar 30 '16 at 05:47
  • I am using Marshmallow, which is v6.0, I guess. – Antony Thomas Mar 30 '16 at 17:58

0 Answers0