moviepy.video.io.display_in_notebook.html_embed#

moviepy.video.io.display_in_notebook.html_embed(clip, filetype=None, maxduration=60, rd_kwargs=None, center=True, **html_kwargs)[source]#

Returns HTML5 code embedding the clip.

Parameters:
  • clip (moviepy.Clip.Clip) -- Either a file name, or a clip to preview. Either an image, a sound or a video. Clips will actually be written to a file and embedded as if a filename was provided.

  • filetype (str, optional) -- One of 'video','image','audio'. If None is given, it is determined based on the extension of filename, but this can bug.

  • maxduration (float, optional) -- An error will be raised if the clip's duration is more than the indicated value (in seconds), to avoid spoiling the browser's cache and the RAM.

  • rd_kwargs (dict, optional) -- Keyword arguments for the rendering, like dict(fps=15, bitrate="50k"). Allow you to give some options to the render process. You can, for example, disable the logger bar passing dict(logger=None).

  • center (bool, optional) -- If true (default), the content will be wrapped in a <div align=middle> HTML container, so the content will be displayed at the center.

  • html_kwargs -- Allow you to give some options, like width=260, autoplay=True, loop=1 etc.

Examples

from moviepy import *
# later ...
html_embed(clip, width=360)
html_embed(clip.audio)

clip.write_gif("test.gif")
html_embed('test.gif')

clip.save_frame("first_frame.jpeg")
html_embed("first_frame.jpeg")