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.