Python Multimedia
Then, I want to embed this .avi animation into a beamer presentation, but the file will just not play. Other avi files play, but the ones produced by the python code do not. I suspect the encoding is wrong, but I am by far not an expert in these matters. Any input is appreciated.
MWE Python:
import numpy as np from matplotlib import pyplot as plt from matplotlib import animation fig = plt.figure ax = plt.axes(xlim=(0, 2), ylim=(-2, 2)) line, = ax.plot(, , lw=2) def init: line.set_data(, ) return line, # animation function. This is called sequentially def animate(i): x = np.linspace(0, 2, 1000) y = np.sin(2 * np.pi * (x - 0.01 * i)) line.set_data(x, y) return line, anim = animation.FuncAnimation(fig, animate, init_func=init, frames=200, interval=20, blit=True) anim.save('basic_animation.avi', fps=30, extra_args=['-vcodec', 'libx264'])
MWE Tex Beamer. The pdf has to be opened with Adobe Acrobat, or any reader that supports videos/animations.














