There is a great View that is changing. It is necessary to record in the video of its display after pressing the start button and before pressing the stop.
How easier (better) to do this? Preferably in the original resolution and frames 30 per second.
Tried to save each frame. View
View.getDrawingCache() in the video using FFmpegFrameRecorder(JavaCV) , but recording one frame takes 200 milliseconds and it turns out that you need to store a large amount of Bitmaps in memory for later saving, which of course FFmpegFrameRecorder(JavaCV) with an out of memory error. There was another thought to pre-record Bitmap to a file, but writing to a file also takes 100 milliseconds.
Creating FFmpegFrameRecorder
FFmpegFrameRecorder recorder = new FFmpegFrameRecorder(videoFile, width, height); recorder.setVideoCodec(avcodec.AV_CODEC_ID_H264); recorder.setFormat("mp4"); recorder.setSampleRate(44100); recorder.setFrameRate(FRAME_RATE); recorder.setVideoBitrate(1200); recorder.setVideoQuality(3); recorder.setVideoOption("preset", "ultrafast"); PS Using MediaProjection not suitable, as it captures the entire screen, secondly, permission is required to ask the user