<jupyter_start><jupyter_text>Frame grabbingUse a MovieWriter directly to grab individual frames and write them to afile.  This avoids any event loop integration, and thus works even with the Aggbackend.  This is not recommended for use in an interactive setting.<jupyter_code>import numpy as np
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
from matplotlib.animation import FFMpegWriter

# Fixing random state for reproducibility
np.random.seed(19680801)


metadata = dict(title='Movie Test', artist='Matplotlib',
                comment='Movie support!')
writer = FFMpegWriter(fps=15, metadata=metadata)

fig = plt.figure()
l, = plt.plot([], [], 'k-o')

plt.xlim(-5, 5)
plt.ylim(-5, 5)

x0, y0 = 0, 0

with writer.saving(fig, "writer_test.mp4", 100):
    for i in range(100):
        x0 += 0.1 * np.random.randn()
        y0 += 0.1 * np.random.randn()
        l.set_data(x0, y0)
        writer.grab_frame()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11734164070612668, 'fraction_numerical': 0.03426791277258567, 'mean_word_length': 3.994818652849741, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '663707', 'license': 'MIT', 'n_tokens_mistral': 353, 'n_tokens_neox': 324, 'n_words': 96, 'path': 'matplotlib/gallery_jupyter/animation/frame_grabbing_sgskip.ipynb', 'repo_name': 'kingreatwill/penter', 'size': '963'}