Baseflow / screenrecorder

Flutter package which can be used to record flutter widgets
https://pub.dev/packages/screen_recorder
MIT License
64 stars 30 forks source link

large memory consumption and low quality #35

Closed jdevp closed 4 months ago

jdevp commented 1 year ago

Hi, it's a good job to start with. However, I see the following issues.

  1. Low quality image captured if given ratio 1. If I scale the image based on device pixel ratio, the image becomes very large to save. It quickly uses up a lot of memory if I use 'png' format which causes app crashes. It seems to work fine with 'rawrgba' format but the size is very large.
  2. The method 'toImageSync' app crashes due to memory usage as well. It works with by using 'toImage'.

I don't know if there is a way to solve those issues by using isolates.

ueman commented 4 months ago

Low quality image captured if given ratio 1. If I scale the image based on device pixel ratio, the image becomes very large to save. It quickly uses up a lot of memory if I use 'png' format which causes app crashes. It seems to work fine with 'rawrgba' format but the size is very large.

That's expected though. If you lower the quality, you get a lower quality result. On the other hand, raising the quality results in a larger file which requires more computation effort.

The method 'toImageSync' app crashes due to memory usage as well. It works with by using 'toImage'.

Again, that's kinda expected. If you record too much, you will run out of memory.

I don't know if there is a way to solve those issues by using isolates.

Isolates don't lower memory requirements, but they may speed up computations. There's a branch in which I did some experiments. Feel free to pick it up. See https://github.com/Baseflow/screenrecorder/issues/30