File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,8 @@ from moviepy.video.io.bindings import mplfig_to_npimage
31
31
import moviepy.editor as mpy
32
32
33
33
from IPython.display import Image
34
+ from IPython.display import HTML
35
+ from base64 import b64encode
34
36
35
37
# DRAW A FIGURE WITH MATPLOTLIB
36
38
@@ -50,9 +52,14 @@ def make_frame_mpl(t):
50
52
return mplfig_to_npimage(fig_mpl) # RGB image of the figure
51
53
52
54
animation =mpy.VideoClip(make_frame_mpl, duration=duration)
53
- animation.write_gif("sinc_mpl.gif", fps=20)
55
+ animation.write_videofile("sinc_mpl.mp4", fps=20)
56
+
57
+
58
+ video = open("/home/pyxie/sinc_mpl.mp4", "rb").read()
59
+ video_encoded = b64encode(video)
60
+ video_tag = '<video controls alt =" test " src =" data:video/x-m4v;base64,{0} " >'.format(video_encoded)
61
+ HTML(data=video_tag)
54
62
55
- Image(filename='sinc_mpl.gif')
56
63
</pre >
57
64
58
65
Equations:
You can’t perform that action at this time.
0 commit comments