class_docstr: Base class of all clips (VideoClips and AudioClips).
  
  Attributes
  ----------
  
  start : float
    When the clip is included in a composition, time of the
    composition at which the clip starts playing (in seconds).
  
  end : float
    When the clip is included in a composition, time of the
    composition at which the clip stops playing (in seconds).
  
  duration : float
    Duration of the clip (in seconds). Some clips are infinite, in
    this case their duration will be ``None``.
class_docstr_tok: ["Base","class","of","all","clips","(","VideoClips","and","AudioClips",")",".","Attributes","--","--","--","--","--","start",":","float","When","the","clip","is","included","in","a","composition",",","time","of","the","composition","at","which","the","clip","starts","playing","(","in","seconds",")",".","end",":","float","When","the","clip","is","included","in","a","composition",",","time","of","the","composition","at","which","the","clip","stops","playing","(","in","seconds",")",".","duration",":","float","Duration","of","the","clip","(","in","seconds",")",".","Some","clips","are","infinite",",","in","this","case","their","duration","will","be","``","None","``","."]
docstr: Iterates over all the frames of the clip.
  
  Returns each frame of the clip as a HxWxN Numpy array,
  where N=1 for mask clips and N=3 for RGB clips.
  
  This function is not really meant for video editing. It provides an
  easy way to do frame-by-frame treatment of a video, for fields like
  science, computer vision...
  
  Parameters
  ----------
  
  fps : int, optional
    Frames per second for clip iteration. Is optional if the clip already
    has a ``fps`` attribute.
  
  with_times : bool, optional
    Ff ``True`` yield tuples of ``(t, frame)`` where ``t`` is the current
    time for the frame, otherwise only a ``frame`` object.
  
  logger : str, optional
    Either ``"bar"`` for progress bar or ``None`` or any Proglog logger.
  
  dtype : type, optional
    Type to cast Numpy array frames. Use ``dtype="uint8"`` when using the
    pictures to write video, images...
  
  Examples
  --------
  
  >>> # prints the maximum of red that is contained
  >>> # on the first line of each frame of the clip.
  >>> from moviepy import VideoFileClip
  >>> myclip = VideoFileClip('myvideo.mp4')
  >>> print ( [frame[0,:,0].max()
               for frame in myclip.iter_frames()])
docstr_tok: ["Iterates","over","all","the","frames","of","the","clip",".","Returns","each","frame","of","the","clip","as","a","HxWxN","Numpy","array",",","where","N=1","for","mask","clips","and","N=3","for","RGB","clips",".","This","function","is","not","really","meant","for","video","editing",".","It","provides","an","easy","way","to","do","frame-by-frame","treatment","of","a","video",",","for","fields","like","science",",","computer","vision","...","Parameters","--","--","--","--","--","fps",":","int",",","optional","Frames","per","second","for","clip","iteration",".","Is","optional","if","the","clip","already","has","a","``","fps","``","attribute",".","with_times",":","bool",",","optional","Ff","``","True","``","yield","tuples","of","``","(","t",",","frame",")","``","where","``","t","``","is","the","current","time","for","the","frame",",","otherwise","only","a","``","frame","``","object",".","logger",":","str",",","optional","Either","``","``","bar","''","``","for","progress","bar","or","``","None","``","or","any","Proglog","logger",".","dtype",":","type",",","optional","Type","to","cast","Numpy","array","frames",".","Use","``","dtype=","''","uint8","''","``","when","using","the","pictures","to","write","video",",","images","...","Examples","--","--","--","--",">",">",">","#","prints","the","maximum","of","red","that","is","contained",">",">",">","#","on","the","first","line","of","each","frame","of","the","clip",".",">",">",">","from","moviepy","import","VideoFileClip",">",">",">","myclip","=","VideoFileClip","(","'myvideo.mp4","'",")",">",">",">","print","(","[","frame","[","0",",",":,0","]",".max","(",")","for","frame","in","myclip.iter_frames","(",")","]",")"]
code: def iter_frames(
      self, fps=None, with_times=False, logger=None, dtype=None
  ):
      """Iterates over all the frames of the clip.
  
      Returns each frame of the clip as a HxWxN Numpy array,
      where N=1 for mask clips and N=3 for RGB clips.
  
      This function is not really meant for video editing. It provides an
      easy way to do frame-by-frame treatment of a video, for fields like
      science, computer vision...
  
      Parameters
      ----------
  
      fps : int, optional
        Frames per second for clip iteration. Is optional if the clip already
        has a ``fps`` attribute.
  
      with_times : bool, optional
        Ff ``True`` yield tuples of ``(t, frame)`` where ``t`` is the current
        time for the frame, otherwise only a ``frame`` object.
  
      logger : str, optional
        Either ``"bar"`` for progress bar or ``None`` or any Proglog logger.
  
      dtype : type, optional
        Type to cast Numpy array frames. Use ``dtype="uint8"`` when using the
        pictures to write video, images...
  
      Examples
      --------
  
      >>> # prints the maximum of red that is contained
      >>> # on the first line of each frame of the clip.
      >>> from moviepy import VideoFileClip
      >>> myclip = VideoFileClip('myvideo.mp4')
      >>> print ( [frame[0,:,0].max()
                   for frame in myclip.iter_frames()])
      """
      logger = proglog.default_bar_logger(logger)
      for frame_index in logger.iter_bar(
          frame_index=np.arange(0, int(self.duration * fps))
      ):
          # int is used to ensure that floating point errors are rounded
          # down to the nearest integer
          t = frame_index / fps
  
          frame = self.get_frame(t)
          if (dtype is not None) and (frame.dtype != dtype):
              frame = frame.astype(dtype)
          if with_times:
              yield t, frame
          else:
              yield frame
  
imports: import copy
  from functools import reduce
  from numbers import Real
  from operator import add
  import numpy
  import proglog
  from moviepy.decorators import apply_to_audio, apply_to_mask, convert_parameter_to_seconds, outplace, requires_duration, use_clip_fps_by_default
label_desc: Use image node_id 17 for calling the Clip obj's underlying member method code with example usage: obj.iter_frames(fps, with_times, logger, dtype) without return types