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

  • 3rd party like github.com/chibatching/android-view-recorder tried or need a native solution? - Igor SKRYL
  • @IgorSKRYL Thanks for the link. It is possible and not native, but unfortunately it has not yet come out to build the project, and it is not clear whether the program will be able to record frames of 30 per second for a large view - iamtihonov
  • I suspect that most of the time is spent on getting bitmap and not on recording - bukkojot

0