Video editing with Python
Black whitespace changes
Tom Burrowscff36b7db940
diff --git a/ez_setup.py b/ez_setup.pyindex 704f6ea1..80c141e4 100644--- a/ez_setup.py+++ b/ez_setup.py@@ -182,10 +182,10 @@ def download_setuptools(def _extractall(self, path=".", members=None):"""Extract all members from the archive to the current working- directory and set owner, modification time and permissions on- directories afterwards. `path' specifies a different directory- to extract to. `members' is optional and must be a subset of the- list returned by getmembers().+ directory and set owner, modification time and permissions on+ directories afterwards. `path' specifies a different directory+ to extract to. `members' is optional and must be a subset of the+ list returned by getmembers()."""import copyimport operatordiff --git a/moviepy/Clip.py b/moviepy/Clip.pyindex fac0fab3..c135dff7 100644--- a/moviepy/Clip.py+++ b/moviepy/Clip.py@@ -23,25 +23,25 @@ class Clip:"""- Base class of all clips (VideoClips and AudioClips).+ Base class of all clips (VideoClips and AudioClips).- Attributes- -----------+ Attributes+ ------------ start:- When the clip is included in a composition, time of the- composition at which the clip starts playing (in seconds).+ start:+ When the clip is included in a composition, time of the+ composition at which the clip starts playing (in seconds).- end:- When the clip is included in a composition, time of the- composition at which the clip stops playing (in seconds).+ end:+ When the clip is included in a composition, time of the+ composition at which the clip stops playing (in seconds).- duration:- Duration of the clip (in seconds). Some clips are infinite, in- this case their duration will be ``None``.+ duration:+ Duration of the clip (in seconds). Some clips are infinite, in+ this case their duration will be ``None``.- """+ """# prefix for all temporary video and audio files.# You can overwrite it with@@ -60,8 +60,8 @@ class Clip:self.memoize_frame = Nonedef copy(self):- """ Shallow copy of the clip.-+ """Shallow copy of the clip.+Returns a shallow copy of the clip whose mask and audio willbe shallow copies of the clip's mask and audio if they exist.@@ -98,7 +98,7 @@ class Clip:return self.make_frame(t)def fl(self, fun, apply_to=None, keep_duration=True):- """ General processing of a clip.+ """General processing of a clip.Returns a new Clip whose frames are a transformation(through function ``fun``) of the frames of the current clip.@@ -300,8 +300,8 @@ class Clip:@outplacedef set_fps(self, fps):- """ Returns a copy of the clip with a new default fps for functions like- write_videofile, iterframe, etc. """+ """Returns a copy of the clip with a new default fps for functions like+ write_videofile, iterframe, etc."""self.fps = fps@outplace@@ -440,7 +440,7 @@ class Clip:@requires_duration@use_clip_fps_by_defaultdef iter_frames(self, fps=None, with_times=False, logger=None, dtype=None):- """ Iterates over all the frames of the clip.+ """Iterates over all the frames of the clip.Returns each frame of the clip as a HxWxN np.array,where N=1 for mask clips and N=3 for RGB clips.@@ -479,8 +479,8 @@ class Clip:yield framedef close(self):- """- Release any resources that are in use.+ """+ Release any resources that are in use."""# Implementation note for subclasses:diff --git a/moviepy/audio/AudioClip.py b/moviepy/audio/AudioClip.pyindex 689f876f..f55452ed 100644--- a/moviepy/audio/AudioClip.py+++ b/moviepy/audio/AudioClip.py@@ -10,37 +10,37 @@ from moviepy.tools import extensions_dictclass AudioClip(Clip):- """ Base class for audio clips.-+ """Base class for audio clips.+See ``AudioFileClip`` and ``CompositeSoundClip`` for usable classes.-+An AudioClip is a Clip with a ``make_frame`` attribute ofthe form `` t -> [ f_t ]`` for mono sound and``t-> [ f1_t, f2_t ]`` for stereo sound (the arrays are Numpy arrays).The `f_t` are floats between -1 and 1. These bounds can betrespassed without problems (the program will put the- sound back into the bounds at conversion time, without much impact).-+ sound back into the bounds at conversion time, without much impact).+Parameters------------+make_frameA function `t-> frame at time t`. The frame does not mean muchfor a sound, it is just a float. What 'makes' the sound arethe variations of that float in the time.-+nchannelsNumber of channels (one or two for mono or stereo).-+Examples----------+>>> # Plays the note A (a sine wave of frequency 440HZ)>>> import numpy as np>>> make_frame = lambda t: 2*[ np.sin(440 * 2 * np.pi * t) ]>>> clip = AudioClip(make_frame, duration=5)>>> clip.preview()-+"""def __init__(self, make_frame=None, duration=None, fps=None):@@ -70,8 +70,7 @@ class AudioClip(Clip):nbytes=2,logger=None,):- """ Iterator that returns the whole sound array of the clip by chunks- """+ """Iterator that returns the whole sound array of the clip by chunks"""if fps is None:fps = self.fpslogger = proglog.default_bar_logger(logger)@@ -99,18 +98,18 @@ class AudioClip(Clip):"""Transforms the sound into an array that can be played by pygameor written in a wav file. See ``AudioClip.preview``.-+Parameters-------------+fpsFrame rate of the sound for the conversion.44100 for top quality.-+nbytesNumber of bytes to encode the sound: 1 for 8bit sound,2 for 16bit, 4 for 32bit sound.-+"""if fps is None:fps = self.fps@@ -172,7 +171,7 @@ class AudioClip(Clip):write_logfile=False,logger="bar",):- """ Writes an audio file from the AudioClip.+ """Writes an audio file from the AudioClip.Parameters@@ -206,7 +205,7 @@ class AudioClip(Clip):write_logfileIf true, produces a detailed logfile named filename + '.log'when writing the file-+loggerEither 'bar' or None or any Proglog logger@@ -244,20 +243,20 @@ class AudioClip(Clip):class AudioArrayClip(AudioClip):"""-+An audio clip made from a sound array.-+Parameters------------+arrayA Numpy array representing the sound, of size Nx1 for mono,Nx2 for stereo.-+fpsFrames per second : speed at which the sound is supposed to beplayed.-+"""def __init__(self, array, fps):@@ -268,8 +267,8 @@ class AudioArrayClip(AudioClip):self.duration = 1.0 * len(array) / fpsdef make_frame(t):- """ complicated, but must be able to handle the case where t- is a list of the form sin(t) """+ """complicated, but must be able to handle the case where t+ is a list of the form sin(t)"""if isinstance(t, np.ndarray):array_inds = np.round(self.fps * t).astype(int)@@ -289,18 +288,18 @@ class AudioArrayClip(AudioClip):class CompositeAudioClip(AudioClip):- """ Clip made by composing several AudioClips.-+ """Clip made by composing several AudioClips.+An audio clip made by putting together several audio clips.-+Parameters-------------+clipsList of audio clips, which may start playing at different times ortogether. If all have their ``duration`` attribute set, theduration of the composite clip is computed automatically.-+"""def __init__(self, clips):diff --git a/moviepy/audio/fx/audio_fadein.py b/moviepy/audio/fx/audio_fadein.pyindex 631a21ab..82dfb76a 100644--- a/moviepy/audio/fx/audio_fadein.py+++ b/moviepy/audio/fx/audio_fadein.py@@ -5,8 +5,8 @@ from moviepy.decorators import audio_video_fx@audio_video_fxdef audio_fadein(clip, duration):- """ Return an audio (or video) clip that is first mute, then the- sound arrives progressively over ``duration`` seconds. """+ """Return an audio (or video) clip that is first mute, then the+ sound arrives progressively over ``duration`` seconds."""def fading(gf, t):gft = gf(t)diff --git a/moviepy/audio/fx/audio_fadeout.py b/moviepy/audio/fx/audio_fadeout.pyindex 61700872..dc008ad7 100644--- a/moviepy/audio/fx/audio_fadeout.py+++ b/moviepy/audio/fx/audio_fadeout.py@@ -6,8 +6,8 @@ from moviepy.decorators import audio_video_fx, requires_duration@audio_video_fx@requires_durationdef audio_fadeout(clip, duration):- """ Return a sound clip where the sound fades out progressively- over ``duration`` seconds at the end of the clip. """+ """Return a sound clip where the sound fades out progressively+ over ``duration`` seconds at the end of the clip."""def fading(gf, t):gft = gf(t)diff --git a/moviepy/audio/fx/audio_left_right.py b/moviepy/audio/fx/audio_left_right.pyindex c98abcc0..33bbc57f 100644--- a/moviepy/audio/fx/audio_left_right.py+++ b/moviepy/audio/fx/audio_left_right.py@@ -3,8 +3,8 @@ import numpy as npdef audio_left_right(audioclip, left=1, right=1, merge=False):"""- NOT YET FINISHED-+ NOT YET FINISHED+For a stereo audioclip, this function enables to change the volumeof the left and right channel separately (with the factors `left`and `right`)diff --git a/moviepy/audio/fx/audio_loop.py b/moviepy/audio/fx/audio_loop.pyindex 10b862ab..fe34c02d 100644--- a/moviepy/audio/fx/audio_loop.py+++ b/moviepy/audio/fx/audio_loop.py@@ -2,7 +2,7 @@ from ..AudioClip import concatenate_audioclipsdef audio_loop(audioclip, nloops=None, duration=None):- """ Loops over an audio clip.+ """Loops over an audio clip.Returns an audio clip that plays the given clip either`nloops` times, or during `duration` seconds.diff --git a/moviepy/audio/fx/audio_normalize.py b/moviepy/audio/fx/audio_normalize.pyindex 5d0485bf..0bdb4a86 100644--- a/moviepy/audio/fx/audio_normalize.py+++ b/moviepy/audio/fx/audio_normalize.py@@ -5,7 +5,7 @@ from .volumex import volumex@audio_video_fxdef audio_normalize(clip):- """ Return a clip whose volume is normalized to 0db.+ """Return a clip whose volume is normalized to 0db.Return an audio (or video) clip whose audio volume is normalizedso that the maximum volume is at 0db, the maximum achievable volume.diff --git a/moviepy/audio/fx/volumex.py b/moviepy/audio/fx/volumex.pyindex dffbd834..9633f95f 100644--- a/moviepy/audio/fx/volumex.py+++ b/moviepy/audio/fx/volumex.py@@ -3,7 +3,7 @@ from moviepy.decorators import audio_video_fx@audio_video_fxdef volumex(clip, factor):- """ Returns a clip with audio volume multiplied by the+ """Returns a clip with audio volume multiplied by thevalue `factor`. Can be applied to both audio and video clips.This effect is loaded as a clip method when you use moviepy.editor,diff --git a/moviepy/audio/io/AudioFileClip.py b/moviepy/audio/io/AudioFileClip.pyindex 5e101a60..9070c5a5 100644--- a/moviepy/audio/io/AudioFileClip.py+++ b/moviepy/audio/io/AudioFileClip.py@@ -83,9 +83,9 @@ class AudioFileClip(AudioClip):self.nchannels = self.reader.nchannelsdef coreader(self):- """ Returns a copy of the AudioFileClip, i.e. a new entrance point- to the audio file. Use copy when you have different clips- watching the audio file at different times. """+ """Returns a copy of the AudioFileClip, i.e. a new entrance point+ to the audio file. Use copy when you have different clips+ watching the audio file at different times."""return AudioFileClip(self.filename, self.buffersize)def close(self):diff --git a/moviepy/audio/tools/cuts.py b/moviepy/audio/tools/cuts.pyindex 9e56b93f..c057f5cf 100644--- a/moviepy/audio/tools/cuts.py+++ b/moviepy/audio/tools/cuts.py@@ -2,8 +2,8 @@ import numpy as npdef find_audio_period(aclip, t_min=0.1, t_max=2, t_res=0.01):- """ Finds the period, in seconds of an audioclip.-+ """Finds the period, in seconds of an audioclip.+The beat is then given by bpm = 60/Tt_min and _tmax are bounds for the returned value, t_resdiff --git a/moviepy/decorators.py b/moviepy/decorators.pyindex 436e7aba..bf991dda 100644--- a/moviepy/decorators.py+++ b/moviepy/decorators.py@@ -26,8 +26,8 @@ def convert_masks_to_RGB(f, clip, *a, **k):@decorator.decoratordef apply_to_mask(f, clip, *a, **k):- """ This decorator will apply the same function f to the mask of- the clip created with f """+ """This decorator will apply the same function f to the mask of+ the clip created with f"""newclip = f(clip, *a, **k)if getattr(newclip, "mask", None):@@ -37,8 +37,8 @@ def apply_to_mask(f, clip, *a, **k):@decorator.decoratordef apply_to_audio(f, clip, *a, **k):- """ This decorator will apply the function f to the audio of- the clip created with f """+ """This decorator will apply the function f to the audio of+ the clip created with f"""newclip = f(clip, *a, **k)if getattr(newclip, "audio", None):@@ -58,8 +58,8 @@ def requires_duration(f, clip, *a, **k):@decorator.decoratordef audio_video_fx(f, clip, *a, **k):- """ Use an audio function on a video/audio clip-+ """Use an audio function on a video/audio clip+This decorator tells that the function f (audioclip -> audioclip)can be also used on a video clip, at which case it returns avideoclip with unmodified video and modified audio.diff --git a/moviepy/tools.py b/moviepy/tools.pyindex 09d30cce..2e70737a 100644--- a/moviepy/tools.py+++ b/moviepy/tools.py@@ -20,7 +20,7 @@ def sys_write_flush(s):def subprocess_call(cmd, logger="bar", errorprint=True):- """ Executes the given subprocess command.+ """Executes the given subprocess command.Set logger to None or a custom Proglog logger to avoid printings."""@@ -48,7 +48,7 @@ def subprocess_call(cmd, logger="bar", errorprint=True):def cvsecs(time):- """ Will convert any time into seconds.+ """Will convert any time into seconds.If the type of `time` is not valid,it's returned as is.@@ -82,7 +82,7 @@ def cvsecs(time):def deprecated_version_of(f, oldname, newname=None):- """ Indicates that a function is deprecated and has a new name.+ """Indicates that a function is deprecated and has a new name.`f` is the new function, `oldname` the name of the deprecatedfunction, `newname` the name of `f`, which can be automaticallydiff --git a/moviepy/video/VideoClip.py b/moviepy/video/VideoClip.pyindex bc17edf1..3fe9637a 100644--- a/moviepy/video/VideoClip.py+++ b/moviepy/video/VideoClip.py@@ -123,7 +123,7 @@ class VideoClip(Clip):@convert_to_seconds(["t"])@convert_masks_to_RGBdef save_frame(self, filename, t=0, withmask=True):- """ Save a clip's frame to an image file.+ """Save a clip's frame to an image file.Saves the frame of clip corresponding to time ``t`` in'filename'. ``t`` can be expressed in seconds (15.35), in@@ -272,7 +272,7 @@ class VideoClip(Clip):loggerEither "bar" for progress bar or None or any Proglog logger.-+pix_fmtPixel format for the output video file.@@ -364,7 +364,7 @@ class VideoClip(Clip):@use_clip_fps_by_default@convert_masks_to_RGBdef write_images_sequence(self, nameformat, fps=None, withmask=True, logger="bar"):- """ Writes the videoclip to a sequence of image files.+ """Writes the videoclip to a sequence of image files.Parameters-----------@@ -431,7 +431,7 @@ class VideoClip(Clip):logger="bar",pix_fmt=None,):- """ Write the VideoClip to a GIF file.+ """Write the VideoClip to a GIF file.Converts a VideoClip into an animated GIF using ImageMagickor ffmpeg.@@ -1311,10 +1311,10 @@ class TextClip(ImageClip):@staticmethoddef search(string, arg):"""Returns the of all valid entries which contain ``string`` for the- argument ``arg`` of ``TextClip``, for instance+ argument ``arg`` of ``TextClip``, for instance- >>> # Find all the available fonts which contain "Courier"- >>> print(TextClip.search('Courier', 'font'))+ >>> # Find all the available fonts which contain "Courier"+ >>> print(TextClip.search('Courier', 'font'))"""string = string.lower()diff --git a/moviepy/video/compositing/CompositeVideoClip.py b/moviepy/video/compositing/CompositeVideoClip.pyindex ec240379..df31e301 100644--- a/moviepy/video/compositing/CompositeVideoClip.py+++ b/moviepy/video/compositing/CompositeVideoClip.py@@ -8,11 +8,11 @@ from moviepy.video.VideoClip import ColorClip, VideoClipclass CompositeVideoClip(VideoClip):- """-+ """+A VideoClip made of other videoclips displayed together. This is thebase class for most compositions.-+Parameters----------@@ -29,11 +29,11 @@ class CompositeVideoClip(VideoClip):on top (i.e. it has the higher layer).For each clip:-+- The attribute ``pos`` determines where the clip is placed.See ``VideoClip.set_pos``- The mask of the clip determines which parts are visible.-+Finally, if all the clips in the list have their ``duration``attribute set, then the duration of the composite video clipis computed automatically@@ -46,8 +46,8 @@ class CompositeVideoClip(VideoClip):Set to True if the first clip in the list should be used as the'background' on which all other clips are blitted. That first clip musthave the same size as the final clip. If it has no transparency, the final- clip will have no mask.-+ clip will have no mask.+The clip with the highest FPS will be the FPS of the composite clip."""@@ -115,8 +115,8 @@ class CompositeVideoClip(VideoClip):)def make_frame(t):- """ The clips playing at time `t` are blitted over one- another. """+ """The clips playing at time `t` are blitted over one+ another."""f = self.bg.get_frame(t)for c in self.playing_clips(t):@@ -126,8 +126,8 @@ class CompositeVideoClip(VideoClip):self.make_frame = make_framedef playing_clips(self, t=0):- """ Returns a list of the clips in the composite clips that are- actually playing at the given time `t`. """+ """Returns a list of the clips in the composite clips that are+ actually playing at the given time `t`."""return [c for c in self.clips if c.is_playing(t)]def close(self):@@ -152,7 +152,7 @@ def clips_array(array, rows_widths=None, cols_widths=None, bg_color=None):widths of the different colums in pixels. If None, is set automatically.cols_widths-+bg_colorFill color for the masked and unfilled regions. Set to None for theseregions to be transparent (will be slower).diff --git a/moviepy/video/compositing/concatenate.py b/moviepy/video/compositing/concatenate.pyindex d9ee7f9e..34fd9f13 100644--- a/moviepy/video/compositing/concatenate.py+++ b/moviepy/video/compositing/concatenate.py@@ -10,7 +10,7 @@ from moviepy.video.VideoClip import ColorClip, VideoClipdef concatenate_videoclips(clips, method="chain", transition=None, bg_color=None, ismask=False, padding=0):- """ Concatenates several video clips+ """Concatenates several video clipsReturns a video clip made by clip by concatenating several video clips.(Concatenated means that they will be played one after another).diff --git a/moviepy/video/compositing/on_color.py b/moviepy/video/compositing/on_color.pyindex 86ceb398..9c4a7e01 100644--- a/moviepy/video/compositing/on_color.py+++ b/moviepy/video/compositing/on_color.py@@ -3,11 +3,11 @@ from moviepy.video.VideoClip import ColorClipdef on_color(clip, size=None, color=(0, 0, 0), pos=None, col_opacity=None):- """+ """Returns a clip made of the current clip overlaid on a colorclip of a possibly bigger size. Can serve to flatten transparentclips (ideal for previewing clips with masks).-+:param size: size of the final clip. By default it will be thesize of the current clip.:param bg_color: the background color of the final clipdiff --git a/moviepy/video/compositing/transitions.py b/moviepy/video/compositing/transitions.pyindex ba622699..2ad1b132 100644--- a/moviepy/video/compositing/transitions.py+++ b/moviepy/video/compositing/transitions.py@@ -14,7 +14,7 @@ from .CompositeVideoClip import CompositeVideoClip@requires_duration@add_mask_if_nonedef crossfadein(clip, duration):- """ Makes the clip appear progressively, over ``duration`` seconds.+ """Makes the clip appear progressively, over ``duration`` seconds.Only works when the clip is included in a CompositeVideoClip."""clip.mask.duration = clip.duration@@ -26,7 +26,7 @@ def crossfadein(clip, duration):@requires_duration@add_mask_if_nonedef crossfadeout(clip, duration):- """ Makes the clip disappear progressively, over ``duration`` seconds.+ """Makes the clip disappear progressively, over ``duration`` seconds.Only works when the clip is included in a CompositeVideoClip."""clip.mask.duration = clip.duration@@ -36,7 +36,7 @@ def crossfadeout(clip, duration):def slide_in(clip, duration, side):- """ Makes the clip arrive from one side of the screen.+ """Makes the clip arrive from one side of the screen.Only works when the clip is included in a CompositeVideoClip,and if the clip has the same size as the whole composition.@@ -78,7 +78,7 @@ def slide_in(clip, duration, side):@requires_durationdef slide_out(clip, duration, side):- """ Makes the clip go away by one side of the screen.+ """Makes the clip go away by one side of the screen.Only works when the clip is included in a CompositeVideoClip,and if the clip has the same size as the whole composition.@@ -122,9 +122,9 @@ def slide_out(clip, duration, side):@requires_durationdef make_loopable(clip, cross_duration):- """ Makes the clip fade in progressively at its own end, this way+ """Makes the clip fade in progressively at its own end, this wayit can be looped indefinitely. ``cross`` is the duration in seconds- of the fade-in. """+ of the fade-in."""d = clip.durationclip2 = clip.fx(crossfadein, cross_duration).set_start(d - cross_duration)return CompositeVideoClip([clip, clip2]).subclip(cross_duration, d)diff --git a/moviepy/video/fx/accel_decel.py b/moviepy/video/fx/accel_decel.pyindex 75d85526..c5ba289c 100644--- a/moviepy/video/fx/accel_decel.py+++ b/moviepy/video/fx/accel_decel.py@@ -4,7 +4,7 @@ def f_accel_decel(t, old_d, new_d, abruptness=1.0, soonness=1.0):negative abruptness (>-1): speed up down upzero abruptness : no effectpositive abruptness: speed down up down-+soonnessfor positive abruptness, determines how soon thespeedup occurs (0<soonness < inf)@@ -34,7 +34,7 @@ def accel_decel(clip, new_duration=None, abruptness=1.0, soonness=1.0):negative abruptness (>-1): speed up down upzero abruptness : no effectpositive abruptness: speed down up down-+soonnessfor positive abruptness, determines how soon thespeedup occurs (0<soonness < inf)diff --git a/moviepy/video/fx/blackwhite.py b/moviepy/video/fx/blackwhite.pyindex 19ed8c93..7c99cfa2 100644--- a/moviepy/video/fx/blackwhite.py+++ b/moviepy/video/fx/blackwhite.py@@ -2,7 +2,7 @@ import numpy as npdef blackwhite(clip, RGB=None, preserve_luminosity=True):- """ Desaturates the picture, makes it black and white.+ """Desaturates the picture, makes it black and white.Parameter RGB allows to set weights for the different colorchannels.If RBG is 'CRT_phosphor' a special set of values is used.diff --git a/moviepy/video/fx/crop.py b/moviepy/video/fx/crop.pyindex 58c78d0a..8d3cbff2 100644--- a/moviepy/video/fx/crop.py+++ b/moviepy/video/fx/crop.py@@ -14,29 +14,29 @@ def crop(original clip is conserved. x1,y1 indicates the top left corner andx2,y2 is the lower right corner of the croped region.All coordinates are in pixels. Float numbers are accepted.-+To crop an arbitrary rectangle:-+>>> crop(clip, x1=50, y1=60, x2=460, y2=275)-+Only remove the part above y=30:-+>>> crop(clip, y1=30)-+Crop a rectangle that starts 10 pixels left and is 200px wide-+>>> crop(clip, x1=10, width=200)-+Crop a rectangle centered in x,y=(300,400), width=50, height=150 :-+>>> crop(clip, x_center=300 , y_center=400,width=50, height=150)-+Any combination of the above should work, like for this rectanglecentered in x=300, with explicit y-boundaries:-+>>> crop(clip, x_center=300, width=400, y1=100, y2=600)-+"""if width and x1 is not None:diff --git a/moviepy/video/fx/even_size.py b/moviepy/video/fx/even_size.pyindex 2a547a01..7b11d42a 100644--- a/moviepy/video/fx/even_size.py+++ b/moviepy/video/fx/even_size.py@@ -3,7 +3,7 @@ from moviepy.decorators import apply_to_mask@apply_to_maskdef even_size(clip):- """+ """Crops the clip to make dimensions even."""w, h = clip.sizediff --git a/moviepy/video/fx/freeze.py b/moviepy/video/fx/freeze.pyindex e163ce53..e959b662 100644--- a/moviepy/video/fx/freeze.py+++ b/moviepy/video/fx/freeze.py@@ -5,7 +5,7 @@ from moviepy.video.VideoClip import ImageClip@requires_durationdef freeze(clip, t=0, freeze_duration=None, total_duration=None, padding_end=0):- """ Momentarily freeze the clip at time t.+ """Momentarily freeze the clip at time t.Set `t='end'` to freeze the clip at the end (actually it will freeze on theframe at time clip.duration - padding_end seconds).diff --git a/moviepy/video/fx/freeze_region.py b/moviepy/video/fx/freeze_region.pyindex b5f03bae..7677ac2f 100644--- a/moviepy/video/fx/freeze_region.py+++ b/moviepy/video/fx/freeze_region.py@@ -6,8 +6,8 @@ from .crop import crop# @apply_to_maskdef freeze_region(clip, t=0, region=None, outside_region=None, mask=None):- """ Freezes one region of the clip while the rest remains animated.-+ """Freezes one region of the clip while the rest remains animated.+You can choose one of three methods by providing either `region`,`outside_region`, or `mask`.diff --git a/moviepy/video/fx/invert_colors.py b/moviepy/video/fx/invert_colors.pyindex db91d063..7d5aad6b 100644--- a/moviepy/video/fx/invert_colors.py+++ b/moviepy/video/fx/invert_colors.py@@ -1,7 +1,7 @@def invert_colors(clip):- """ Returns the color-inversed clip.+ """Returns the color-inversed clip.- The values of all pixels are replaced with (255-v) or (1-v) for masks+ The values of all pixels are replaced with (255-v) or (1-v) for masksBlack becomes white, green becomes purple, etc."""maxi = 1.0 if clip.ismask else 255diff --git a/moviepy/video/fx/loop.py b/moviepy/video/fx/loop.pyindex 4e0d90e5..2a57c551 100644--- a/moviepy/video/fx/loop.py+++ b/moviepy/video/fx/loop.py@@ -8,7 +8,7 @@ def loop(clip, n=None, duration=None):"""Returns a clip that plays the current clip in an infinite loop.Ideal for clips coming from gifs.-+Parameters------------ndiff --git a/moviepy/video/fx/make_loopable.py b/moviepy/video/fx/make_loopable.pyindex 01d3a08b..81cd7bf6 100644--- a/moviepy/video/fx/make_loopable.py+++ b/moviepy/video/fx/make_loopable.py@@ -6,7 +6,7 @@ def make_loopable(clip, cross):"""Makes the clip fade in progressively at its own end, this wayit can be looped indefinitely. ``cross`` is the duration in seconds- of the fade-in. """+ of the fade-in."""d = clip.durationclip2 = clip.fx(transfx.crossfadein, cross).set_start(d - cross)return CompositeVideoClip([clip, clip2]).subclip(cross, d)diff --git a/moviepy/video/fx/margin.py b/moviepy/video/fx/margin.pyindex af950430..9b12d557 100644--- a/moviepy/video/fx/margin.py+++ b/moviepy/video/fx/margin.py@@ -10,18 +10,18 @@ def margin():"""Draws an external margin all around the frame.-+:param mar: if not ``None``, then the new clip has a margin ofsize ``mar`` in pixels on the left, right, top, and bottom.-+:param left, right, top, bottom: width of the margin in pixelin these directions.-+:param color: color of the margin.-+:param mask_margin: value of the mask on the margin. Settingthis value to 0 yields transparent margins.-+"""if (opacity != 1.0) and (clip.mask is None) and not (clip.ismask):diff --git a/moviepy/video/fx/mask_and.py b/moviepy/video/fx/mask_and.pyindex b2daebb1..3ba7d31d 100644--- a/moviepy/video/fx/mask_and.py+++ b/moviepy/video/fx/mask_and.py@@ -4,9 +4,9 @@ from ..VideoClip import ImageClipdef mask_and(clip, other_clip):- """ Returns the logical 'and' (min) between two masks.- other_clip can be a mask clip or a picture (np.array).- The result has the duration of 'clip' (if it has any)+ """Returns the logical 'and' (min) between two masks.+ other_clip can be a mask clip or a picture (np.array).+ The result has the duration of 'clip' (if it has any)"""# To ensure that 'or' of two ImageClips will be an ImageClip.diff --git a/moviepy/video/fx/mask_color.py b/moviepy/video/fx/mask_color.pyindex 89b64dcc..8e791b8e 100644--- a/moviepy/video/fx/mask_color.py+++ b/moviepy/video/fx/mask_color.py@@ -2,12 +2,12 @@ import numpy as npdef mask_color(clip, color=None, thr=0, s=1):- """ Returns a new clip with a mask for transparency where the original+ """Returns a new clip with a mask for transparency where the originalclip is of the given color.You can also have a "progressive" mask by specifying a non-nul distancethreshold thr. In this case, if the distance between a pixel and the given- color is d, the transparency will be+ color is d, the transparency will bed**s / (thr**s + d**s)diff --git a/moviepy/video/fx/mask_or.py b/moviepy/video/fx/mask_or.pyindex b93e9144..01059c1b 100644--- a/moviepy/video/fx/mask_or.py+++ b/moviepy/video/fx/mask_or.py@@ -4,9 +4,9 @@ from ..VideoClip import ImageClipdef mask_or(clip, other_clip):- """ Returns the logical 'or' (max) between two masks.- other_clip can be a mask clip or a picture (np.array).- The result has the duration of 'clip' (if it has any)+ """Returns the logical 'or' (max) between two masks.+ other_clip can be a mask clip or a picture (np.array).+ The result has the duration of 'clip' (if it has any)"""# To ensure that 'or' of two ImageClips will be an ImageClip.diff --git a/moviepy/video/fx/resize.py b/moviepy/video/fx/resize.pyindex 57f17c46..5f85d953 100644--- a/moviepy/video/fx/resize.py+++ b/moviepy/video/fx/resize.py@@ -56,34 +56,34 @@ except ImportError:def resize(clip, newsize=None, height=None, width=None, apply_to_mask=True):- """+ """Returns a video clip that is a resized version of the clip.-+Parameters-------------+newsize:- Can be either+ Can be either- ``(width,height)`` in pixels or a float representing- A scaling factor, like 0.5- A function of time returning one of these.-+width:width of the new clip in pixel. The height is then computed so- that the width/height ratio is conserved.-+ that the width/height ratio is conserved.+height:height of the new clip in pixel. The width is then computed sothat the width/height ratio is conserved.-+Examples-----------+>>> myClip.resize( (460,720) ) # New resolution: (460,720)>>> myClip.resize(0.6) # width and heigth multiplied by 0.6>>> myClip.resize(width=800) # height computed automatically.>>> myClip.resize(lambda t : 1+0.02*t) # slow swelling of the clip-+"""w, h = clip.sizediff --git a/moviepy/video/fx/supersample.py b/moviepy/video/fx/supersample.pyindex 329f17f0..63adad4a 100644--- a/moviepy/video/fx/supersample.py+++ b/moviepy/video/fx/supersample.py@@ -2,7 +2,7 @@ import numpy as npdef supersample(clip, d, nframes):- """ Replaces each frame at time t by the mean of `nframes` equally spaced frames+ """Replaces each frame at time t by the mean of `nframes` equally spaced framestaken in the interval [t-d, t+d]. This results in motion blur."""def fl(gf, t):diff --git a/moviepy/video/io/ImageSequenceClip.py b/moviepy/video/io/ImageSequenceClip.pyindex f6d5c0ce..9d548fef 100644--- a/moviepy/video/io/ImageSequenceClip.py+++ b/moviepy/video/io/ImageSequenceClip.py@@ -8,9 +8,9 @@ from ..VideoClip import VideoClipclass ImageSequenceClip(VideoClip):"""-+A VideoClip made from a series of images.-+Parameters-----------@@ -20,7 +20,7 @@ class ImageSequenceClip(VideoClip):- The name of a folder (containing only pictures). The pictureswill be considered in alphanumerical order.- A list of names of image files. In this case you can choose to- load the pictures in memory pictures+ load the pictures in memory pictures- A list of Numpy arrays representing images. In this last case,masks are not supported currently.@@ -40,10 +40,10 @@ class ImageSequenceClip(VideoClip):Notes------- If your sequence is made of image files, the only image kept in+ If your sequence is made of image files, the only image kept in+-"""def __init__(diff --git a/moviepy/video/io/bindings.py b/moviepy/video/io/bindings.pyindex 8509fe0e..d04ab2ad 100644--- a/moviepy/video/io/bindings.py+++ b/moviepy/video/io/bindings.py@@ -7,8 +7,8 @@ import numpy as npdef PIL_to_npimage(im):- """ Transforms a PIL/Pillow image into a numpy RGB(A) image.- Actually all this do is returning numpy.array(im)."""+ """Transforms a PIL/Pillow image into a numpy RGB(A) image.+ Actually all this do is returning numpy.array(im)."""return np.array(im)# w,h = im.size# d = (4 if im.mode=="RGBA" else 3)diff --git a/moviepy/video/io/downloader.py b/moviepy/video/io/downloader.pyindex 5016bc44..a89ad41b 100644--- a/moviepy/video/io/downloader.py+++ b/moviepy/video/io/downloader.py@@ -10,7 +10,7 @@ from moviepy.tools import subprocess_calldef download_webfile(url, filename, overwrite=False):- """ Small utility to download the file at 'url' under name 'filename'.+ """Small utility to download the file at 'url' under name 'filename'.If url is a youtube video ID like z410eauCnH it will download the videousing youtube-dl (install youtube-dl first !).If the filename already exists and overwrite=False, nothing will happen.diff --git a/moviepy/video/io/ffmpeg_reader.py b/moviepy/video/io/ffmpeg_reader.pyindex 818f9f07..53cf62d2 100644--- a/moviepy/video/io/ffmpeg_reader.py+++ b/moviepy/video/io/ffmpeg_reader.py@@ -171,7 +171,7 @@ class FFMPEG_VideoReader:return resultdef get_frame(self, t):- """ Read a file video frame at time t.+ """Read a file video frame at time t.Note for coders: getting an arbitrary frame in the video withffmpeg can be painfully slow if some decoding has to be done.@@ -221,7 +221,7 @@ class FFMPEG_VideoReader:def ffmpeg_read_image(filename, with_mask=True, pix_fmt=None):- """ Read an image file (PNG, BMP, JPEG...).+ """Read an image file (PNG, BMP, JPEG...).Wraps FFMPEG_Videoreader to read just one image.Returns an ImageClip.diff --git a/moviepy/video/io/ffmpeg_tools.py b/moviepy/video/io/ffmpeg_tools.pyindex 0c3bb224..a46ab4d1 100644--- a/moviepy/video/io/ffmpeg_tools.py+++ b/moviepy/video/io/ffmpeg_tools.py@@ -35,8 +35,8 @@ def ffmpeg_movie_from_frames(filename, folder, fps, digits=6, bitrate="v"):@convert_path_to_string(("filename", "targetname"))def ffmpeg_extract_subclip(filename, t1, t2, targetname=None):- """ Makes a new video file playing video file ``filename`` between- the times ``t1`` and ``t2``. """+ """Makes a new video file playing video file ``filename`` between+ the times ``t1`` and ``t2``."""name, ext = os.path.splitext(filename)if not targetname:T1, T2 = [int(1000 * t) for t in [t1, t2]]@@ -72,8 +72,8 @@ def ffmpeg_merge_video_audio(ffmpeg_output=False,logger="bar",):- """ merges video file ``video`` and audio file ``audio`` into one- movie file ``output``. """+ """merges video file ``video`` and audio file ``audio`` into one+ movie file ``output``."""cmd = [FFMPEG_BINARY,"-y",@@ -110,8 +110,8 @@ def ffmpeg_extract_audio(inputfile, output, bitrate=3000, fps=44100):@convert_path_to_string(("video", "output"))def ffmpeg_resize(video, output, size):- """ resizes ``video`` to new size ``size`` and write the result- in file ``output``. """+ """resizes ``video`` to new size ``size`` and write the result+ in file ``output``."""cmd = [FFMPEG_BINARY,"-i",diff --git a/moviepy/video/io/ffmpeg_writer.py b/moviepy/video/io/ffmpeg_writer.pyindex 7f402e6d..d1a4a15e 100644--- a/moviepy/video/io/ffmpeg_writer.py+++ b/moviepy/video/io/ffmpeg_writer.py@@ -13,7 +13,7 @@ from moviepy.config import FFMPEG_BINARYclass FFMPEG_VideoWriter:- """ A class for FFMPEG-based video writing.+ """A class for FFMPEG-based video writing.A class to write videos using ffmpeg. ffmpeg will write in a largechoice of formats.@@ -228,7 +228,7 @@ def ffmpeg_write_video(logger="bar",pix_fmt=None,):- """ Write the clip to a videofile. See VideoClip.write_videofile for details+ """Write the clip to a videofile. See VideoClip.write_videofile for detailson the parameters."""logger = proglog.default_bar_logger(logger)@@ -270,8 +270,8 @@ def ffmpeg_write_video(def ffmpeg_write_image(filename, image, logfile=False, pix_fmt=None):- """ Writes an image (HxWx3 or HxWx4 numpy array) to a file, using- ffmpeg. """+ """Writes an image (HxWx3 or HxWx4 numpy array) to a file, using+ ffmpeg."""if image.dtype != "uint8":image = image.astype("uint8")diff --git a/moviepy/video/io/gif_writers.py b/moviepy/video/io/gif_writers.pyindex bfd51219..16865c11 100644--- a/moviepy/video/io/gif_writers.py+++ b/moviepy/video/io/gif_writers.py@@ -31,7 +31,7 @@ def write_gif_with_tempfiles(logger="bar",pix_fmt=None,):- """ Write the VideoClip to a GIF file.+ """Write the VideoClip to a GIF file.Converts a VideoClip into an animated GIF using ImageMagick@@ -149,7 +149,7 @@ def write_gif(logger="bar",pix_fmt=None,):- """ Write the VideoClip to a GIF file, without temporary files.+ """Write the VideoClip to a GIF file, without temporary files.Converts a VideoClip into an animated GIF using ImageMagickor ffmpeg.@@ -248,7 +248,14 @@ def write_gif(popen_params["stdout"] = sp.DEVNULLproc1 = sp.Popen(- cmd1 + ["-pix_fmt", (pix_fmt), "-r", "%.02f" % fps, filename,],+ cmd1+ + [+ "-pix_fmt",+ (pix_fmt),+ "-r",+ "%.02f" % fps,+ filename,+ ],**popen_params,)else:@@ -287,7 +294,14 @@ def write_gif(if opt:cmd3 = (- [IMAGEMAGICK_BINARY, "-", "-fuzz", "%d" % fuzz + "%", "-layers", opt,]+ [+ IMAGEMAGICK_BINARY,+ "-",+ "-fuzz",+ "%d" % fuzz + "%",+ "-layers",+ opt,+ ]+ (["-colors", "%d" % colors] if colors is not None else [])+ [filename])diff --git a/moviepy/video/io/html_tools.py b/moviepy/video/io/html_tools.pyindex 2992b55c..5cdc6ad3 100644--- a/moviepy/video/io/html_tools.py+++ b/moviepy/video/io/html_tools.py@@ -51,7 +51,7 @@ templates = {def html_embed(clip, filetype=None, maxduration=60, rd_kwargs=None, center=True, **html_kwargs):- """ Returns HTML5 code embedding the clip+ """Returns HTML5 code embedding the clipclipEither a file name, or a clip to preview.diff --git a/moviepy/video/io/preview.py b/moviepy/video/io/preview.pyindex 652c0b82..aa936b4b 100644--- a/moviepy/video/io/preview.py+++ b/moviepy/video/io/preview.py@@ -24,17 +24,17 @@ def imdisplay(imarray, screen=None):def show(clip, t=0, with_mask=True, interactive=False):"""Splashes the frame of clip corresponding to time ``t``.-+Parameters-------------+tTime in seconds of the frame to display.-+with_mask``False`` if the clip has a mask but you want to see the clipwithout the mask.-+"""if isinstance(t, tuple):@@ -74,7 +74,7 @@ def preview(audio_nbytes=2,fullscreen=False,):- """+ """Displays the clip in a window, at the given frames per second(of movie) rate. It will avoid that the clip be played fasterthan normal, but it cannot avoid the clip to be played slowerdiff --git a/moviepy/video/io/sliders.py b/moviepy/video/io/sliders.pyindex 3a388ea5..27473572 100644--- a/moviepy/video/io/sliders.py+++ b/moviepy/video/io/sliders.py@@ -3,17 +3,17 @@ from matplotlib.widgets import Sliderdef sliders(f, sliders_properties, wait_for_validation=False):- """ A light GUI to manually explore and tune the outputs of- a function.- slider_properties is a list of dicts (arguments for Slider )-- def volume(x,y,z):- return x*y*z-- intervals = [ { 'label' : 'width', 'valmin': 1 , 'valmax': 5 },- { 'label' : 'height', 'valmin': 1 , 'valmax': 5 },- { 'label' : 'depth', 'valmin': 1 , 'valmax': 5 } ]- inputExplorer(volume,intervals)+ """A light GUI to manually explore and tune the outputs of+ a function.+ slider_properties is a list of dicts (arguments for Slider )++ def volume(x,y,z):+ return x*y*z++ intervals = [ { 'label' : 'width', 'valmin': 1 , 'valmax': 5 },+ { 'label' : 'height', 'valmin': 1 , 'valmax': 5 },+ { 'label' : 'depth', 'valmin': 1 , 'valmax': 5 } ]+ inputExplorer(volume,intervals)"""nVars = len(sliders_properties)diff --git a/moviepy/video/tools/credits.py b/moviepy/video/tools/credits.pyindex edebd9dd..51e6fe37 100644--- a/moviepy/video/tools/credits.py+++ b/moviepy/video/tools/credits.py@@ -25,31 +25,31 @@ def credits1(Parameters------------+creditfileA string or path like object pointing to a text filewhose content must be as follows: ::-+# This is a comment# The next line says : leave 4 blank lines.blank 4-+..Executive Story EditorMARCEL DURAND-+..Associate ProducersMARTIN MARCELDIDIER MARTIN-+..Music SupervisorJEAN DIDIER-+widthTotal width of the credits text in pixels-+gapHorizontal gap in pixels between the jobs and the names-+colorColor of the text. See ``TextClip.list('color')``for a list of acceptable names.@@ -67,11 +67,11 @@ def credits1(stroke_widthWidth of the stroke, in pixels. Can be a float, like 1.5.--++Returns----------+imageAn ImageClip instance that looks like this and can be scrolledto make some credits:@@ -80,7 +80,7 @@ def credits1(Associate Producers MARTIN MARCELDIDIER MARTINMusic Supervisor JEAN DIDIER-+"""# PARSE THE TXT FILEdiff --git a/moviepy/video/tools/cuts.py b/moviepy/video/tools/cuts.pyindex 1eae98bc..c19602ce 100644--- a/moviepy/video/tools/cuts.py+++ b/moviepy/video/tools/cuts.py@@ -102,7 +102,7 @@ class FramesMatches(list):@staticmethoddef load(filename):- """ Loads a FramesMatches object from a file.+ """Loads a FramesMatches object from a file.>>> matching_frames = FramesMatches.load("somefile")"""arr = np.loadtxt(filename)@@ -111,7 +111,7 @@ class FramesMatches(list):@staticmethoddef from_clip(clip, dist_thr, max_d, fps=None):- """ Finds all the frames tht look alike in a clip, for instance to make a+ """Finds all the frames tht look alike in a clip, for instance to make alooping gif.This teturns a FramesMatches object of the all pairs of frames with@@ -288,7 +288,7 @@ class FramesMatches(list):@use_clip_fps_by_defaultdef detect_scenes(clip=None, luminosities=None, thr=10, logger="bar", fps=None):- """ Detects scenes of a clip based on luminosity changes.+ """Detects scenes of a clip based on luminosity changes.Note that for large clip this may take some timediff --git a/moviepy/video/tools/drawing.py b/moviepy/video/tools/drawing.pyindex a8d00c3f..fdf51bba 100644--- a/moviepy/video/tools/drawing.py+++ b/moviepy/video/tools/drawing.py@@ -7,8 +7,8 @@ import numpy as npdef blit(im1, im2, pos=None, mask=None, ismask=False):- """ Blit an image over another.-+ """Blit an image over another.+Blits ``im1`` on ``im2`` as position ``pos=(x,y)``, using the``mask`` if provided. If ``im1`` and ``im2`` are mask pictures(2D float arrays) then ``ismask`` must be ``True``.@@ -53,35 +53,35 @@ def color_gradient(size, p1, p2=None, vector=None, r=None, col1=0, col2=1.0, shape="linear", offset=0):"""Draw a linear, bilinear, or radial gradient.-+The result is a picture of size ``size``, whose color variesgradually from color `col1` in position ``p1`` to color ``col2``in position ``p2``.-+If it is a RGB picture the result must be transformed intoa 'uint8' array to be displayed normally:--++Parameters- -------------+ ------------+sizeSize (width, height) in pixels of the final picture/array.-+p1, p2Coordinates (x,y) in pixels of the limit point for ``col1``and ``col2``. The color 'before' ``p1`` is ``col1`` and itgradually changes in the direction of ``p2`` until it is ``col2``when it reaches ``p2``.-+vectorA vector [x,y] in pixels that can be provided instead of ``p2``.``p2`` is then defined as (p1 + vector).-+col1, col2Either floats between 0 and 1 (for gradients used in masks)or [R,G,B] arrays (for colored gradients).-+shape'linear', 'bilinear', or 'circular'.In a linear gradient the color varies in one direction,@@ -90,7 +90,7 @@ def color_gradient(in the other direction.In a circular gradient it goes from ``col1`` to ``col2`` in alldirections.-+offsetReal number between 0 and 1 indicating the fraction of the vectorat which the gradient actually starts. For instance if ``offset``@@ -98,21 +98,21 @@ def color_gradient(only occur near p2 (before that everything is of color ``col1``)If the offset is 0.9 in a radial gradient, the gradient willoccur in the region located between 90% and 100% of the radius,- this creates a blurry disc of radius d(p1,p2).-+ this creates a blurry disc of radius d(p1,p2).+Returns---------+imageAn Numpy array of dimensions (W,H,ncolors) of type floatrepresenting the image of the gradient.--++Examples----------+>>> grad = color_gradient(blabla).astype('uint8')-+"""# np-arrayize and change x,y coordinates to y,x@@ -182,49 +182,49 @@ def color_split(size, x=None, y=None, p1=None, p2=None, vector=None, col1=0, col2=1.0, grad_width=0):"""Make an image splitted in 2 colored regions.-+Returns an array of size ``size`` divided in two regions called 1 and2 in wht follows, and which will have colors col& and col2respectively.-+Parameters------------+x: (int)If provided, the image is splitted horizontally in x, the leftregion being region 1.-+y: (int)If provided, the image is splitted vertically in y, the top regionbeing region 1.-+p1,p2:Positions (x1,y1),(x2,y2) in pixels, where the numbers can befloats. Region 1 is defined as the whole region on the left whengoing from ``p1`` to ``p2``.-+p1, vector:``p1`` is (x1,y1) and vector (v1,v2), where the numbers can befloats. Region 1 is then the region on the left when startingin position ``p1`` and going in the direction given by ``vector``.-+gradient_widthIf not zero, the split is not sharp, but gradual over a region ofwidth ``gradient_width`` (in pixels). This is preferable in many- situations (for instance for antialiasing).--+ situations (for instance for antialiasing).++Examples----------+>>> size = [200,200]>>> # an image with all pixels with x<50 =0, the others =1>>> color_split(size, x=50, col1=0, col2=1)>>> # an image with all pixels with y<50 red, the others green>>> color_split(size, x=50, col1=[255,0,0], col2=[0,255,0])- >>> # An image splitted along an arbitrary line (see below)+ >>> # An image splitted along an arbitrary line (see below)>>> color_split(size, p1=[20,50], p2=[25,70] col1=0, col2=1)-+"""if grad_width or ((x is None) and (y is None)):@@ -262,8 +262,8 @@ def color_split(def circle(screensize, center, radius, col1=1.0, col2=0, blur=1):- """ Draw an image with a circle.-+ """Draw an image with a circle.+Draws a circle of color ``col1``, on a background of color ``col2``,on a screen of size ``screensize`` at the position ``center=(x,y)``,with a radius ``radius`` but slightly blurred on the border by ``blur``diff --git a/moviepy/video/tools/segmenting.py b/moviepy/video/tools/segmenting.pyindex 41260753..e25bccbe 100644--- a/moviepy/video/tools/segmenting.py+++ b/moviepy/video/tools/segmenting.py@@ -5,13 +5,13 @@ from moviepy.video.VideoClip import ImageClipdef findObjects(clip, rem_thr=500, preview=False):- """+ """Returns a list of ImageClips representing each a separate object onthe screen.-+rem_thr : all objects found with size < rem_Thr will beconsidered false positives and will be removed-+"""image = clip.get_frame(0)diff --git a/moviepy/video/tools/subtitles.py b/moviepy/video/tools/subtitles.pyindex fad32005..73913af8 100644--- a/moviepy/video/tools/subtitles.py+++ b/moviepy/video/tools/subtitles.py@@ -10,8 +10,8 @@ from moviepy.video.VideoClip import TextClip, VideoClipclass SubtitlesClip(VideoClip):- """ A Clip that serves as "subtitle track" in videos.-+ """A Clip that serves as "subtitle track" in videos.+One particularity of this class is that the images of thesubtitle texts are not generated beforehand, but only ifneeded.@@ -21,14 +21,14 @@ class SubtitlesClip(VideoClip):subtitlesEither the name of a file as a string or path-like object, or a list-+encodingOptional, specifies srt file encoding.Any standard Python encoding is allowed (listed at https://docs.python.org/3.8/library/codecs.html#standard-encodings)Examples=========-+>>> from moviepy.video.tools.subtitles import SubtitlesClip>>> from moviepy.video.io.VideoFileClip import VideoFileClip>>> generator = lambda txt: TextClip(txt, font='Georgia-Regular', fontsize=24, color='white')@@ -37,7 +37,7 @@ class SubtitlesClip(VideoClip):>>> myvideo = VideoFileClip("myvideo.avi")>>> final = CompositeVideoClip([clip, subtitles])>>> final.write_videofile("final.mp4", fps=myvideo.fps)-+"""def __init__(self, subtitles, make_textclip=None, encoding=None):@@ -70,9 +70,9 @@ class SubtitlesClip(VideoClip):self.end = self.durationdef add_textclip_if_none(t):- """ Will generate a textclip if it hasn't been generated asked+ """Will generate a textclip if it hasn't been generated askedto generate it yet. If there is no subtitle to show at t, return- false. """+ false."""sub = [((ta, tb), txt)for ((ta, tb), txt) in self.textclips.keys()@@ -105,9 +105,9 @@ class SubtitlesClip(VideoClip):self.mask = VideoClip(make_mask_frame, ismask=True) if hasmask else Nonedef in_subclip(self, t_start=None, t_end=None):- """ Returns a sequence of [(t1,t2), txt] covering all the given subclip+ """Returns a sequence of [(t1,t2), txt] covering all the given subclipfrom t_start to t_end. The first and last times will be cropped so as- to be exactly t_start and t_end if possible. """+ to be exactly t_start and t_end if possible."""def is_in_subclip(t1, t2):try:@@ -155,7 +155,7 @@ class SubtitlesClip(VideoClip):@convert_path_to_string("filename")def file_to_subtitles(filename, encoding=None):- """ Converts a srt file into subtitles.+ """Converts a srt file into subtitles.The returned list is of the form ``[((ta,tb),'some text'),...]``and can be fed to SubtitlesClip.diff --git a/moviepy/video/tools/tracking.py b/moviepy/video/tools/tracking.pyindex 64723aeb..eda90854 100644--- a/moviepy/video/tools/tracking.py+++ b/moviepy/video/tools/tracking.py@@ -38,11 +38,11 @@ def manual_tracking(clip, t1=None, t2=None, fps=None, nobjects=1, savefile=None)times `t1` and `t2`. This displays the clip frame by frameand you must click on the object(s) in each frame. If ``t2=None``only the frame at ``t1`` is taken into account.-+Returns a list [(t1,x1,y1),(t2,x2,y2) etc... ] if there is one- object per frame, else returns a list whose elements are of the+ object per frame, else returns a list whose elements are of theform (ti, [(xi1,yi1), (xi2,yi2), ...] )-+Parameters-------------@@ -62,7 +62,7 @@ def manual_tracking(clip, t1=None, t2=None, fps=None, nobjects=1, savefile=None)Examples----------+>>> from moviepy.editor import VideoFileClip>>> from moviepy.video.tools.tracking import manual_tracking>>> clip = VideoFileClip("myvideo.mp4")@@ -75,7 +75,7 @@ def manual_tracking(clip, t1=None, t2=None, fps=None, nobjects=1, savefile=None)>>> traj1, traj2, traj3 = Trajectory.load_list('track.txt')>>> # If ever you only have one object being tracked, recover it with>>> traj, = Trajectory.load_list('track.txt')-+"""import pygame as pgdiff --git a/tests/test_VideoFileClip.py b/tests/test_VideoFileClip.pyindex 387178ac..1fc07e6b 100644--- a/tests/test_VideoFileClip.py+++ b/tests/test_VideoFileClip.py@@ -47,8 +47,8 @@ def test_ffmpeg_resizing():def test_shallow_copy():"""Call a function which uses @outplace- and verify that making a shallow copy and deleting it- does not corrupt the original clip."""+ and verify that making a shallow copy and deleting it+ does not corrupt the original clip."""video_file = "media/big_buck_bunny_0_30.webm"video = VideoFileClip(video_file)video_copy = video.set_start(1)diff --git a/tests/test_fx.py b/tests/test_fx.pyindex 73542b44..3ef1cd9e 100644--- a/tests/test_fx.py+++ b/tests/test_fx.py@@ -228,7 +228,20 @@ def test_margin():# 1 pixel black marginclip2 = margin(clip, mar=1)target = BitmapClip(- [["OOOOO", "ORRRO", "ORRRO", "OOOOO",], ["OOOOO", "ORRBO", "ORRBO", "OOOOO",],],+ [+ [+ "OOOOO",+ "ORRRO",+ "ORRRO",+ "OOOOO",+ ],+ [+ "OOOOO",+ "ORRBO",+ "ORRBO",+ "OOOOO",+ ],+ ],fps=1,)assert target == clip2@@ -236,7 +249,20 @@ def test_margin():# 1 pixel green marginclip3 = margin(clip, mar=1, color=(0, 255, 0))target = BitmapClip(- [["GGGGG", "GRRRG", "GRRRG", "GGGGG",], ["GGGGG", "GRRBG", "GRRBG", "GGGGG",],],+ [+ [+ "GGGGG",+ "GRRRG",+ "GRRRG",+ "GGGGG",+ ],+ [+ "GGGGG",+ "GRRBG",+ "GRRBG",+ "GGGGG",+ ],+ ],fps=1,)assert target == clip3diff --git a/tests/test_resourcereleasedemo.py b/tests/test_resourcereleasedemo.pyindex 74091413..d991c36d 100644--- a/tests/test_resourcereleasedemo.py+++ b/tests/test_resourcereleasedemo.py@@ -22,13 +22,13 @@ from tests.test_helper import TMP_DIRdef test_failure_to_release_file():- """ This isn't really a test, because it is expected to fail.- It demonstrates that there *is* a problem with not releasing resources when running on- Windows.+ """This isn't really a test, because it is expected to fail.+ It demonstrates that there *is* a problem with not releasing resources when running on+ Windows.- The real issue was that, as of movepy 0.2.3.2, there was no way around it.+ The real issue was that, as of movepy 0.2.3.2, there was no way around it.- See test_resourcerelease.py to see how the close() methods provide a solution.+ See test_resourcerelease.py to see how the close() methods provide a solution."""# Get the name of a temporary file we can use.