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: Returns a copy of the clip, with the  ``duration`` attribute set to
  ``t``, which can be expressed in seconds (15.35), in (min, sec), in
  (hour, min, sec), or as a string: '01:03:05.35'. Also sets the duration
  of the mask and audio, if any, of the returned clip.
  
  If ``change_end is False``, the start attribute of the clip will be
  modified in function of the duration and the preset end of the clip.
  
  Parameters
  ----------
  
  duration : float
    New duration attribute value for the clip.
  
  change_end : bool, optional
    If ``True``, the ``end`` attribute value of the clip will be adjusted
    accordingly to the new duration using ``clip.start + duration``.
docstr_tok: ["Returns","a","copy","of","the","clip",",","with","the","``","duration","``","attribute","set","to","``","t","``",",","which","can","be","expressed","in","seconds","(","15.35",")",",","in","(","min",",","sec",")",",","in","(","hour",",","min",",","sec",")",",","or","as","a","string",":","'01:03:05.35","'",".","Also","sets","the","duration","of","the","mask","and","audio",",","if","any",",","of","the","returned","clip",".","If","``","change_end","is","False","``",",","the","start","attribute","of","the","clip","will","be","modified","in","function","of","the","duration","and","the","preset","end","of","the","clip",".","Parameters","--","--","--","--","--","duration",":","float","New","duration","attribute","value","for","the","clip",".","change_end",":","bool",",","optional","If","``","True","``",",","the","``","end","``","attribute","value","of","the","clip","will","be","adjusted","accordingly","to","the","new","duration","using","``","clip.start","+","duration","``","."]
code: def with_duration(self, duration, change_end=True):
      """Returns a copy of the clip, with the  ``duration`` attribute set to
      ``t``, which can be expressed in seconds (15.35), in (min, sec), in
      (hour, min, sec), or as a string: '01:03:05.35'. Also sets the duration
      of the mask and audio, if any, of the returned clip.
  
      If ``change_end is False``, the start attribute of the clip will be
      modified in function of the duration and the preset end of the clip.
  
      Parameters
      ----------
  
      duration : float
        New duration attribute value for the clip.
  
      change_end : bool, optional
        If ``True``, the ``end`` attribute value of the clip will be adjusted
        accordingly to the new duration using ``clip.start + duration``.
      """
      self.duration = duration
  
      if change_end:
          self.end = (
              None if (duration is None) else (self.start + duration)
          )
      else:
          if self.duration is None:
              raise ValueError(
                  "Cannot change clip start when new duration is None"
              )
          self.start = self.end - duration
  
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 9 for calling the Clip obj's underlying member method code with example usage: obj.with_duration(duration, change_end) without return types