class_docstr: Frames matches inside a set of frames.
  
  You can instantiate it passing a list of FramesMatch objects or
  using the class methods ``load`` and ``from_clip``.
  
  Parameters
  ----------
  
  lst : list
    Iterable of FramesMatch objects.
class_docstr_tok: ["Frames","matches","inside","a","set","of","frames",".","You","can","instantiate","it","passing","a","list","of","FramesMatch","objects","or","using","the","class","methods","``","load","``","and","``","from_clip","``",".","Parameters","--","--","--","--","--","lst",":","list","Iterable","of","FramesMatch","objects","."]
docstr: Extract the matching frames represented by the instance from a clip
  and write them as GIFs in a directory, one GIF for each matching frame.
  
  Parameters
  ----------
  
  clip : video.VideoClip.VideoClip
    A video clip whose frames scenes you want to obtain as GIF images.
  
  gif_dir : str
    Directory in which the GIF images will be written.
  
  kwargs
    Passed as ``clip.write_gif`` optional arguments.
  
  Examples
  --------
  
  >>> import os
  >>> from pprint import pprint
  >>> from moviepy.editor import *
  >>> from moviepy.video.tools.cuts import FramesMatches
  >>>
  >>> ch_clip = VideoFileClip("media/chaplin.mp4").subclip(1, 4)
  >>> clip = concatenate_videoclips([ch_clip.time_mirror(), ch_clip])
  >>>
  >>> result = FramesMatches.from_clip(clip, 10, 3).select_scenes(
  ...     1, 2, nomatch_threshold=0,
  ... )
  >>>
  >>> os.mkdir("foo")
  >>> result.write_gifs(clip, "foo")
  MoviePy - Building file foo/00000100_00000400.gif with imageio.
  MoviePy - Building file foo/00000115_00000384.gif with imageio.
  MoviePy - Building file foo/00000128_00000372.gif with imageio.
  MoviePy - Building file foo/00000140_00000360.gif with imageio.
docstr_tok: ["Extract","the","matching","frames","represented","by","the","instance","from","a","clip","and","write","them","as","GIFs","in","a","directory",",","one","GIF","for","each","matching","frame",".","Parameters","--","--","--","--","--","clip",":","video.VideoClip.VideoClip","A","video","clip","whose","frames","scenes","you","want","to","obtain","as","GIF","images",".","gif_dir",":","str","Directory","in","which","the","GIF","images","will","be","written",".","kwargs","Passed","as","``","clip.write_gif","``","optional","arguments",".","Examples","--","--","--","--",">",">",">","import","os",">",">",">","from","pprint","import","pprint",">",">",">","from","moviepy.editor","import","*",">",">",">","from","moviepy.video.tools.cuts","import","FramesMatches",">",">",">",">",">",">","ch_clip","=","VideoFileClip","(","``","media\/chaplin.mp4","''",")",".subclip","(","1",",","4",")",">",">",">","clip","=","concatenate_videoclips","(","[","ch_clip.time_mirror","(",")",",","ch_clip","]",")",">",">",">",">",">",">","result","=","FramesMatches.from_clip","(","clip",",","10",",","3",")",".select_scenes","(","...","1",",","2",",","nomatch_threshold=0",",","...",")",">",">",">",">",">",">","os.mkdir","(","``","foo","''",")",">",">",">","result.write_gifs","(","clip",",","``","foo","''",")","MoviePy","-","Building","file","foo\/00000100_00000400.gif","with","imageio",".","MoviePy","-","Building","file","foo\/00000115_00000384.gif","with","imageio",".","MoviePy","-","Building","file","foo\/00000128_00000372.gif","with","imageio",".","MoviePy","-","Building","file","foo\/00000140_00000360.gif","with","imageio","."]
code: def write_gifs(self, clip, gifs_dir, **kwargs):
      """Extract the matching frames represented by the instance from a clip
      and write them as GIFs in a directory, one GIF for each matching frame.
  
      Parameters
      ----------
  
      clip : video.VideoClip.VideoClip
        A video clip whose frames scenes you want to obtain as GIF images.
  
      gif_dir : str
        Directory in which the GIF images will be written.
  
      kwargs
        Passed as ``clip.write_gif`` optional arguments.
  
      Examples
      --------
  
      >>> import os
      >>> from pprint import pprint
      >>> from moviepy.editor import *
      >>> from moviepy.video.tools.cuts import FramesMatches
      >>>
      >>> ch_clip = VideoFileClip("media/chaplin.mp4").subclip(1, 4)
      >>> clip = concatenate_videoclips([ch_clip.time_mirror(), ch_clip])
      >>>
      >>> result = FramesMatches.from_clip(clip, 10, 3).select_scenes(
      ...     1, 2, nomatch_threshold=0,
      ... )
      >>>
      >>> os.mkdir("foo")
      >>> result.write_gifs(clip, "foo")
      MoviePy - Building file foo/00000100_00000400.gif with imageio.
      MoviePy - Building file foo/00000115_00000384.gif with imageio.
      MoviePy - Building file foo/00000128_00000372.gif with imageio.
      MoviePy - Building file foo/00000140_00000360.gif with imageio.
      """
      for start, end, _, _ in self:
          name = "%s/%08d_%08d.gif" % (gifs_dir, 100 * start, 100 * end)
          clip.subclip(start, end).write_gif(name, **kwargs)
  
imports: from collections import defaultdict
  import numpy
  from moviepy.decorators import convert_parameter_to_seconds, use_clip_fps_by_default
label_desc: Use image node_id 8 for calling the FramesMatches obj's underlying member method code with example usage: obj.write_gifs(clip, gifs_dir) without return types