Fameempathy
Lurker
Hey I'm trying to develop an app which will save a screencast to a file. So far I've been able to produce a video files of correct length(when I recorded for 5 seconds it produced a 5 seconds video file), the problem is my videos are empty, when I try to run them in various video players it shows only black screen.
Logcat when I'm running my application:
My whole activity
My code
These code snippets might also be relevant:
I start with preparing video encoder
Creating mediaProjection
Then i drain video encoder and release video encoder at the end. I didn't want to post my whole app here becuase of the topic rules but you can have a look at the link I've provided earlier.
Cheers Kyle
Logcat when I'm running my application:
Code:
08-29 14:47:57.722 1973-1991/com.example.stw.myapplication W/EGL_emulation﹕ eglSurfaceAttrib not implemented
08-29 14:47:57.722 1973-1991/com.example.stw.myapplication W/OpenGLRenderer﹕ Failed to set EGL_SWAP_BEHAVIOR on surface 0xabdbee60, error=EGL_SUCCESS
08-29 14:47:58.870 1973-1991/com.example.stw.myapplication E/Surface﹕ getSlotFromBufferLocked: unknown buffer: 0xab659760
08-29 14:47:58.875 1973-1991/com.example.kamil.myapplication D/OpenGLRenderer﹕ endAllStagingAnimators on 0xab32c580 (ListPopupWindow$DropDownListView) with handle 0xa333d8d0
08-29 14:48:00.652 1973-1973/com.example.kamil.myapplication D/MPEG4Writer﹕ Video track stopping
08-29 14:48:00.652 1973-1973/com.example.kamil.myapplication D/MPEG4Writer﹕ Video track source stopping
08-29 14:48:00.652 1973-1973/com.example.kamil.myapplication D/MPEG4Writer﹕ Video track source stopped
My code
These code snippets might also be relevant:
I start with preparing video encoder
Code:
private void prepareVideoEncoder() {
mVideoBufferInfo = new MediaCodec.BufferInfo();
MediaFormat format = MediaFormat.createVideoFormat(VIDEO_MIME_TYPE, VIDEO_WIDTH, VIDEO_HEIGHT);
//some configuration
try {
mVideoEncoder = MediaCodec.createEncoderByType(VIDEO_MIME_TYPE);
mVideoEncoder.configure(format, null, null, MediaCodec.CONFIGURE_FLAG_ENCODE);
mInputSurface = mVideoEncoder.createInputSurface();
mVideoEncoder.start();
} catch (IOException e) {
releaseEncoders();
}
}
Code:
mMediaProjection.createVirtualDisplay("Recording Display", screenWidth,
screenHeight, screenDensity, DisplayManager.VIRTUAL_DISPLAY_FLAG_PRESENTATION, mInputSurface,
null /* callback */, null /* handler */);
Cheers Kyle