Thanks to visit codestin.com
Credit goes to github.com

Skip to content

basic recording for Plot #178

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
May 22, 2023
Merged

basic recording for Plot #178

merged 8 commits into from
May 22, 2023

Conversation

kushalkolar
Copy link
Member

@kushalkolar kushalkolar commented Apr 19, 2023

closes #171

usage:

# make plot and stuff

plot.record_start("./video.mp4")

# ... do stuff, interact, etc

plot.record_stop()

codec options:

plot_movie.record_start("./test_265.mp4", codec="libx264", options={"crf": "20"})

Uses a separate Process for writing frames using PyAV, snapshot of canvas is sent using Queue. It should be fast enough for anything that's not too crazy. Right now the framerate is variable since we just grab frames in an animation function.

Tried OpenCV initially but it was acting really weird. It would write a video file just fine, but then when you started writing the next video file it made the previous one unreadable. VideoCapture.relese() was called, but there was something weird with multiprocessing I think. PyAV doesn't have this issue and seems to be better anyways with codecs etc.

@kushalkolar kushalkolar requested a review from clewis7 May 20, 2023 11:56
@kushalkolar kushalkolar mentioned this pull request May 20, 2023
10 tasks
Copy link
Member

@clewis7 clewis7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, I see what you mean with the mixin class now

@clewis7
Copy link
Member

clewis7 commented May 22, 2023

just out of curiosity, what happens when you change the size during the recording?

@kushalkolar
Copy link
Member Author

The video width and height are fixed, so if you change the canvas size the width and height will change. I think it then would get trimmed.

@kushalkolar kushalkolar merged commit 162910a into master May 22, 2023
@kushalkolar kushalkolar deleted the record-plot branch May 23, 2023 04:47
kushalkolar added a commit that referenced this pull request Jun 14, 2023
* restarted tests, now work from the command line

* more tests

* more tests, still working on iw

* ipywidget can only be tested w/ nbmake

* updated tests

* support numpy fancy indexing for colors and data features (#177)

* type annotation fix for older python versions

* adding fancy indexing implemented in #177

* requested changes

* adding diff storage for CI pipeline usage

* use readthedocs.yaml for doc build (#189)

* tests changes, ready to start CI pipeline

* allow for screenshots to be regenerated via os.environ key

* CI build

* linux-build passes, still working on examples passing

* progress on CI pipeline, still need to figure out test build

* still failing test build, what I have for now

* kwargs for Plot and GridPlot to set canvas star size (#194)

* Update ci.yml

use pygfx before pylinalg refactor

* Update ci.yml

sed to remove pygfx from setup.py

* Update ci.yml

imageio

* Delete requirements_rtd.txt

* Update ci.yml

testing upload screens

* create BaseSelector, heatmap also works with LinearSelector and LinearRegionSelector (#187)

* BaseSelector handles most of the event handling, simplifies a lot of implementation.
* same functionality between Linear and LinearRegion, shift + arrow keys to move
* sync not tested for LinearRegion
* HeatmapGraphic has helpers to add Linear and LinearRegion
* indices getters and get_selected_data() are now based on Graphic type, so line and heatmap are handled differently
* started RectangleRegionSelector, will finish in another PR

* add features section to docs for Graphics

* fix sync bug, arrow key movements are toggleable (#198)

* finishes #107, #119, #192 (#200)

* more selector stuff (#199)

* garbage collection of selectors, not tested yet

* selecors gc progress, not there yet but not broken either

* move events for transparent fill areas

* rectangle region selector basic functionality works

* more rectangle region stuff

* basic recording for Plot (#178)

* basic recording for Plot

* opencv conditional import, reduce fps slightly in recorded vid to compensat, looks fine now

* forgot to add the actual recorder

* record Plot or GridPlot, uses PyAV, works well enough

* comment, organization

* cleaup

* changing linux build to have python versions matrix

* working on toolbar (#195)

* working on toolbar

* toolbar updates

* basic toolbar for plot implemented

* base logic in notebook for gridplot toolbar

* gp toolbar working when subplots have names & mix names/no names

* initial changes to simple plot toolbar

* updates to plot toolbar, still need to refactor into separate file

* fixed gridplot toolbar, still need to move to separate class

* add flip button

* adding click event handler for gp toolbar dropdown options

* keep new clicked plot up-to-date with toggle button values

* requested changes

* catchup with pygfx linalg refactor (#203)

* WIP, mapping to points and selectors not updated

* everything updated for linalg refactor except rectangle selector

* update toolbar w.r.t. linalg refactor

* update examples w.r.t. linalg refactor

* update readme

* image selector and heatmap linalg fixes (#204)

* add selector performance example nb

* Docs build fix (#210)

* Update .readthedocs.yaml, install pygfx from main

* Update .readthedocs.yaml

* Update .readthedocs.yaml

* all feature docs (#212)

* add all feature docs

* Create examples README

* Update README

* Update and rename README to README.md

* finish buttons for toolbar (#207)

* working on toolbar

* toolbar updates

* basic toolbar for plot implemented

* base logic in notebook for gridplot toolbar

* gp toolbar working when subplots have names & mix names/no names

* initial changes to simple plot toolbar

* updates to plot toolbar, still need to refactor into separate file

* fixed gridplot toolbar, still need to move to separate class

* add flip button

* adding click event handler for gp toolbar dropdown options

* keep new clicked plot up-to-date with toggle button values

* requested changes

* adding record button

* record button

* silly miss in merge conflict resolve

* wow I am struggling this am

* imagewidget toolbar for single plot iw

* toolbar for iw with gridplot

* requested changes

* update flip icon

* toolbar updates

* changes to linear selector event handler removal

* Update fastplotlib/widgets/image.py

* simplify toolbar stuff in show(), simplify image widget toolbar

---------

Co-authored-by: Kushal Kolar <[email protected]>

* nbmake tests work

* updating CI file

* all tests passing locally

* trying to get CI to run on ghub

* change screenshots to be stored as png files

* restarted tests, now work from the command line

* more tests

* more tests, still working on iw

* ipywidget can only be tested w/ nbmake

* updated tests

* adding fancy indexing implemented in #177

* requested changes

* adding diff storage for CI pipeline usage

* tests changes, ready to start CI pipeline

* allow for screenshots to be regenerated via os.environ key

* CI build

* linux-build passes, still working on examples passing

* progress on CI pipeline, still need to figure out test build

* still failing test build, what I have for now

* Update ci.yml

use pygfx before pylinalg refactor

* Update ci.yml

sed to remove pygfx from setup.py

* Update ci.yml

imageio

* Update ci.yml

testing upload screens

* changing linux build to have python versions matrix

* nbmake tests work

* updating CI file

* all tests passing locally

* trying to get CI to run on ghub

* change screenshots to be stored as png files

* rebase with master and update CI

* track *.png files using Git LFS

* yml for regenerating screenshots, updating CI yml to not regenerate

* update .gitignore and regen screenshots yml

* hopefully works

* add screenshots

* remove screenshots from git

* add screenshots, yet again

* setup options

* remove type annotation

* change workflow to use setup optiosn

* add pyav to setup for tests

* add scikit-image

* opencv instead of pyav

* add libpng-dev

* try pillow, better work ffs

* bah

* add git-lfs to apt install for github actions

* add interactive again

* install git lfs before checkout repo

* add git lfs fetch pull

* diffs

* diffs path

* update examples for canvas size and autoscale

* remove gpu screenshots

* add screenshot ground truth files from github actions generated screenshots

* remove interactive session stuff

---------

Co-authored-by: Kushal Kolar <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

record plot to video file
2 participants