roipeker / graphx

GraphX package for Flutter.
https://pub.dev/packages/graphx
MIT License
496 stars 49 forks source link

[Question] How could I embed the drawing (rasterizing?) into some video stream? #46

Closed ryuujo1573 closed 2 years ago

ryuujo1573 commented 2 years ago

Firstly, I would express my appreciation for your work, which is amazing and cool.

If convenient for you, could you give my any hint on doing some stuffs which AE/Pr would do, like video composing, with Flutter widgets and your graphx abilities?

Sorry for my poor knowledge but I want to know if it is possible, for I've known that Flutter is based on Skia. May it be okay to do some special work to be capable of video composing. Which document I should refer to?

Excuse my strange language and thank you 👍

roipeker commented 2 years ago

Hi @ryuujo1573 . If you mean capturing a video from a Widget, like screen recorder, you should see if you can find a package in pub.dev I think Flutter processing has an option to export gifs. Graphx has nothing on the subject.

Did I answered your question?

ryuujo1573 commented 2 years ago

I've found this “Video Editor in Flutter using dart”, which is the similar case.

Maybe I was wondering how could I harness graphx abilities to make some awesome effects in producing video (or live-stream)... and seemingly this "Render Flutter animation directly to video" may be the clue to embed the drawing into videos.

Thank you.

roipeker commented 2 years ago

sorry the misunderstanding. You can rasterize any DisplayObject with createImage() (outputs a dart.ui.Image) might be cpu intensive... the callback is async though, so I guess you can have a flag on stage.onEnterFrame to capture the stage for a period of time and save the images in a List, then output every image separately as frame1.png, frame2.png etc then use ffmpeg to join them as video/gif... i doubt u can get 60fps though in this process... and probably will need some fine tuning, but might work.

ryuujo1573 commented 2 years ago

Is it possible to access Skia so as to draw into the buffer using GPU? (or any APU by some authentic SDK from manufacturers) I found nothing on how to do this, or maybe I could make a fork to Flutter and mess with bunches of code? Appreciations, Zhang.

roipeker commented 2 years ago

I think you have to recompile the flutter engine with the exposed backend from Skia that you need. That's beyond my knowledge though.

ryuujo1573 commented 2 years ago

I'll try for that. Thank you ❤️

ryuujo1573 commented 2 years ago

https://github.com/flutter/flutter/issues/99593 Initiated! Any advise?