In [16]:
using PyCall
using PyPlot
@pyimport matplotlib.animation as anim
video = anim.FFMpegWriter(extra_args=["-vcodec", "libx264", "-pix_fmt", "yuv420p"])
video[:setup](gcf(), "writer_test.mp4", 100)
for i in 1:100
l = plot(randn(), randn(), "k-o")
video[:grab_frame]()
end
video[:finish]()
In [19]:
;ls -l *.mp4
embed_video(filename)=display("text/html", string("""<video autoplay controls><source src="data:video/x-m4v;base64,""",
base64(open(readbytes,filename)),"""" type="video/mp4"></video>"""))
embed_video("writer_test.mp4")
In [ ]: