Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Animation conversion to HTML5 video#4785

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

dopplershift
Copy link
Contributor

This adds a method to render animations as an HTML5 video tag (h264 encoded video, base64-encoded directly into the tag.) It then adds the IPython display hook to allow it to automatically render in the notebook, though by default it is off. The use of the rcparam can be extended to also include JSAnimation.

This paves the way for displaying animations in IPython notebooks.
This is configurable using rc params, and defaults to off.
@dopplershift
Copy link
ContributorAuthor

I really wish I had gotten this in sooner for 1.5....

self._base64_video = vid64.decode('ascii')
self._video_size = 'width="{0}" height="{1}"'.format(
*writer.frame_size)
os.remove(f.name) # Now we can remove
Copy link
Member

Choose a reason for hiding this comment

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

Is it safe to remove an open file on all platforms?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I don't think so--good catch. I don't think there's any reason to move that line out of thewith.

@jenshnielsen
Copy link
Member

I like it and don't have any problem with it being merged late. It is a new completely optional feature and we can always mark it as experimental if need be. I do think that it needs an entry in whats new thou.

There are a few usability problems with the nbagg backend. The nbagg backend in interactive mode will show the notebook window with the animation along with therepr_html (if that is enabled) producing double output. But that may be more of an issue with the nbagg backend?

@dopplershift
Copy link
ContributorAuthor

Thanks, I'll address those comments shortly, as well as a few other tweaks.

Regarding nbagg, the original version I'm adapting calledplt.close() to address the double display problem. Personally, I think I'd end up working around this behavior as often as I'd want it. I can't think of any less draconian way to eliminate the display of the figure.

It looks like you can work around this by putting the animation in a different cell than the figure creation.

@jenshnielsen
Copy link
Member

Great. It might be possible in the long term to be more cleaver about when nbagg displays a figure but that is out of the scope of this PR in any case. I ended up wrapping the animation withplt.ioff() andplt.ion() to prevent the nbagg backend in showing a figure automatically.

It might also be worth mentioning somewhere that you can do:

fromIPython.displayimportHTMLHTML(ani.to_html5_video())

If you don't want to enable therepr_html

@tacaswell
Copy link
Member

I talked to@minrk about a related issue at Scipy, but I don't remember the exact outcome of that conversation.

@jenshnielsenjenshnielsen mentioned this pull requestJul 27, 2015
@jenshnielsen
Copy link
Member

👍 Looks good to me

@tacaswell Do we want to do any kind of feature freeze or are we ok to merge this?

@jamespjh this may be of interest to you

@tacaswell
Copy link
Member

Merge it, i want to break feature freeze in a couple of other things that
are far more major changes

On Mon, Jul 27, 2015, 2:28 PM Jens Hedegaard Nielsen <
notifications@github.com> wrote:

[image: 👍] Looks good to me

@tacaswellhttps://github.com/tacaswell Do we want to do any kind of
feature freeze or are we ok to merge this?

@jamespjhhttps://github.com/jamespjh this may be of interest to you


Reply to this email directly or view it on GitHub
#4785 (comment)
.

jenshnielsen added a commit that referenced this pull requestJul 27, 2015
@jenshnielsenjenshnielsen merged commit271a646 intomatplotlib:masterJul 27, 2015
@dopplershiftdopplershift deleted the anim-html5-video branchJuly 28, 2015 03:06
@dopplershift
Copy link
ContributorAuthor

cc @jclark754@lesserwhirls

@QuLogicQuLogic added this to thev1.5.0 milestoneJun 21, 2016
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Projects
None yet
Milestone
v1.5.0
Development

Successfully merging this pull request may close these issues.

4 participants
@dopplershift@jenshnielsen@tacaswell@QuLogic

[8]ページ先頭

©2009-2025 Movatter.jp