Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Cleanup Animation frame_formats.#19044
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Uh oh!
There was an error while loading.Please reload this page.
QuLogic commentedDec 1, 2020 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I'm not sure about the class in Matplotlib, but at least ffmpeg can accept rgba frames (specifying size, etc. via command-line info)https://ffmpeg.org/ffmpeg-formats.html#rawvideo |
I specifically meant the Matplotlib class, when used for reconstituting a moviefrom on-disk image (rgba) files. If you (or someone else) knows the right invocation to make the example given above work, then that's even better :) |
Yes, I linked to the wrong format, but it should be possible. I just need to test out the other frame formats to be sure I didn't break it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Can you revert the raw/rgba removal bits, and then I can add tests into#19056.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
anntzer commentedDec 2, 2020 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Actually, looks like the check for FileMovieWriter when setting the frame format to rgba is still needed for HTMLWriter, which does not support that format... |
QuLogic commentedDec 3, 2020 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Isn't that overwritten in |
Ah yes, that's a good idea. |
Unfortunately, seems to have broken docs. |
- Warn if the requested frame format is unsupported and fallback occurs.- ImageMagickFileWriter supports 'rgba' but requires explicit frame_size and depth to do so (they are the same as for ImageMagickWriter, and passing them doesn't negatively impact other formats); it does not support 'raw' (perhttps://imagemagick.org/script/formats.php) but we can just override it as 'rgba'.Test script:```pythonimport numpy as npimport matplotlib.pyplot as pltimport matplotlib.animation as animationfig, ax = plt.subplots()x = np.arange(0, 2*np.pi, 0.01)line, = ax.plot(x, np.sin(x))def animate(i): line.set_ydata(np.sin(x + i / 50)) # update the data. return line,ani = animation.FuncAnimation( fig, animate, interval=50, blit=True, save_count=20)plt.rcParams["animation.frame_format"] = "rgba" # or "raw"writer = animation.FFMpegFileWriter() # or animation.ImageMagickFileWriter()ani.save("/tmp/movie.mp4", writer=writer)```(Also move import of PIL up, as it's a standard dependency now.)
hopefully fixed now... |
way to forward the relevant frame size/bitdepth info).
and depth to do so (they are the same as for ImageMagickWriter, and
passing them doesn't negatively impact other formats), but it does not
support 'raw' (perhttps://imagemagick.org/script/formats.php).
Test script:
(Also move import of PIL up, as it's a standard dependency now.)
PR Summary
PR Checklist
pytest
passes).flake8
on changed files to check).flake8-docstrings
and runflake8 --docstring-convention=all
).doc/users/next_whats_new/
(follow instructions in README.rst there).doc/api/next_api_changes/
(follow instructions in README.rst there).