fastplotlib / fastplotlib

Next-gen fast plotting library running on WGPU using the pygfx rendering engine
https://fastplotlib.readthedocs.io/
Apache License 2.0
348 stars 33 forks source link

Recording Functionality on ImageWidget #503

Open apasarkar opened 1 month ago

apasarkar commented 1 month ago

I'm finding some compression artifacts with the recording functionality in ImageWidget. Wondering if there is a way we can toggle compression levels, essentially allowing users to move between the default compression level and lossless video generation. This could make the recording feature more broadly useful.

kushalkolar commented 1 month ago

Right now you could manually call fig.recorder.start() with your own kwargs:

https://github.com/fastplotlib/fastplotlib/blob/9a309ef1359244eb3791ddcfebc8b08b2697ae9f/fastplotlib/layouts/_figure.py#L670-L710

You can choose a diff codec and/or choose a different q:v or crf value depending on the codec, examples are given above for mpeg4 and libx264.

Long term I wonder if there's a better way to record video with pygfx, posted https://github.com/pygfx/pygfx/issues/754