Skip to content

Video editing with Python

update some doc

osaajani502e61b9a6ef
diff --git a/moviepy/Effect.py b/moviepy/Effect.py
index 5ea4a77a..33c6c602 100644
--- a/moviepy/Effect.py
+++ b/moviepy/Effect.py
@@ -1,10 +1,11 @@
+
from abc import ABCMeta, abstractmethod
from moviepy.Clip import Clip
import copy as _copy
class Effect(metaclass=ABCMeta):
- """
- Base abastract class for all effects.
+ """Base abastract class for all effects in MoviePy.
+ Any new effect have to extend this base class.
"""
def copy(self):
diff --git a/moviepy/__init__.py b/moviepy/__init__.py
index 7464f781..989fceaf 100644
--- a/moviepy/__init__.py
+++ b/moviepy/__init__.py
@@ -1,5 +1,5 @@
"""Imports everything that you need from the MoviePy submodules so that every thing
-can be directly imported with `from moviepy import *`.
+can be directly imported with ``from moviepy import *``.
"""
from moviepy.audio import fx as afx
diff --git a/moviepy/audio/AudioClip.py b/moviepy/audio/AudioClip.py
index 22681e9a..cef6f878 100644
--- a/moviepy/audio/AudioClip.py
+++ b/moviepy/audio/AudioClip.py
@@ -282,24 +282,24 @@ class AudioClip(Clip):
----------
fps
- Frame rate of the sound. 44100 gives top quality, but may cause
- problems if your computer is not fast enough and your clip is
- complicated. If the sound jumps during the preview, lower it
- (11025 is still fine, 5000 is tolerable).
+ Frame rate of the sound. 44100 gives top quality, but may cause
+ problems if your computer is not fast enough and your clip is
+ complicated. If the sound jumps during the preview, lower it
+ (11025 is still fine, 5000 is tolerable).
buffersize
- The sound is not generated all at once, but rather made by bunches
- of frames (chunks). ``buffersize`` is the size of such a chunk.
- Try varying it if you meet audio problems (but you shouldn't
- have to).
+ The sound is not generated all at once, but rather made by bunches
+ of frames (chunks). ``buffersize`` is the size of such a chunk.
+ Try varying it if you meet audio problems (but you shouldn't
+ have to).
nbytes:
- Number of bytes to encode the sound: 1 for 8bit sound, 2 for
- 16bit, 4 for 32bit sound. 2 bytes is fine.
+ Number of bytes to encode the sound: 1 for 8bit sound, 2 for
+ 16bit, 4 for 32bit sound. 2 bytes is fine.
audio_flag, video_flag:
- Instances of class threading events that are used to synchronize
- video and audio during ``VideoClip.preview()``.
+ Instances of class threading events that are used to synchronize
+ video and audio during ``VideoClip.preview()``.
"""
ffplay_audiopreview(clip=self, fps=fps, buffersize=buffersize, nbytes=nbytes, audio_flag=audio_flag, video_flag=video_flag)
diff --git a/moviepy/audio/__init__.py b/moviepy/audio/__init__.py
index e69de29b..a171db6d 100644
--- a/moviepy/audio/__init__.py
+++ b/moviepy/audio/__init__.py
@@ -0,0 +1 @@
+"""Everything about audio manipulation."""
\ No newline at end of file
diff --git a/moviepy/audio/fx/__init__.py b/moviepy/audio/fx/__init__.py
index dc3d462a..26b00067 100644
--- a/moviepy/audio/fx/__init__.py
+++ b/moviepy/audio/fx/__init__.py
@@ -1,3 +1,5 @@
+"""All the audio effects that can be applied to AudioClip and VideoClip."""
+
# import every video fx function
from moviepy.audio.fx.AudioDelay import AudioDelay
diff --git a/moviepy/tools.py b/moviepy/tools.py
index a260e75b..0b75c943 100644
--- a/moviepy/tools.py
+++ b/moviepy/tools.py
@@ -168,3 +168,43 @@ def find_extension(codec):
"specify a temp_audiofile with the right extension "
"in write_videofile."
)
+
+
+def close_all_clips(objects="globals", types=("audio", "video", "image")):
+ """Closes all clips in a context.
+
+ Follows different strategies retrieving the namespace from which the clips
+ to close will be retrieved depending on the ``objects`` argument, and filtering
+ by type of clips depending on the ``types`` argument.
+
+ Parameters
+ ----------
+
+ objects : str or dict, optional
+ - If is a string an the value is ``"globals"``, will close all the clips
+ contained by the ``globals()`` namespace.
+ - If is a dictionary, the values of the dictionary could be clips to close,
+ useful if you want to use ``locals()``.
+
+ types : Iterable, optional
+ Set of types of clips to close, being "audio", "video" or "image" the supported
+ values.
+ """
+ from moviepy.audio.io.AudioFileClip import AudioFileClip
+ from moviepy.video.io.VideoFileClip import VideoFileClip
+ from moviepy.video.VideoClip import ImageClip
+
+ CLIP_TYPES = {
+ "audio": AudioFileClip,
+ "video": VideoFileClip,
+ "image": ImageClip,
+ }
+
+ if objects == "globals": # pragma: no cover
+ objects = globals()
+ if hasattr(objects, "values"):
+ objects = objects.values()
+ types_tuple = tuple(CLIP_TYPES[key] for key in types)
+ for obj in objects:
+ if isinstance(obj, types_tuple):
+ obj.close()
diff --git a/moviepy/utils.py b/moviepy/utils.py
deleted file mode 100644
index eb7a0958..00000000
--- a/moviepy/utils.py
+++ /dev/null
@@ -1,42 +0,0 @@
-"""Useful utilities working with MoviePy."""
-
-from moviepy.audio.io.AudioFileClip import AudioFileClip
-from moviepy.video.io.VideoFileClip import VideoFileClip
-from moviepy.video.VideoClip import ImageClip
-
-
-CLIP_TYPES = {
- "audio": AudioFileClip,
- "video": VideoFileClip,
- "image": ImageClip,
-}
-
-
-def close_all_clips(objects="globals", types=("audio", "video", "image")):
- """Closes all clips in a context.
-
- Follows different strategies retrieving the namespace from which the clips
- to close will be retrieved depending on the ``objects`` argument, and filtering
- by type of clips depending on the ``types`` argument.
-
- Parameters
- ----------
-
- objects : str or dict, optional
- - If is a string an the value is ``"globals"``, will close all the clips
- contained by the ``globals()`` namespace.
- - If is a dictionary, the values of the dictionary could be clips to close,
- useful if you want to use ``locals()``.
-
- types : Iterable, optional
- Set of types of clips to close, being "audio", "video" or "image" the supported
- values.
- """
- if objects == "globals": # pragma: no cover
- objects = globals()
- if hasattr(objects, "values"):
- objects = objects.values()
- types_tuple = tuple(CLIP_TYPES[key] for key in types)
- for obj in objects:
- if isinstance(obj, types_tuple):
- obj.close()
diff --git a/moviepy/video/__init__.py b/moviepy/video/__init__.py
index e69de29b..32be8f28 100644
--- a/moviepy/video/__init__.py
+++ b/moviepy/video/__init__.py
@@ -0,0 +1 @@
+"""Everything about video manipulation."""
\ No newline at end of file
diff --git a/moviepy/video/compositing/__init__.py b/moviepy/video/compositing/__init__.py
index e69de29b..38139ef5 100644
--- a/moviepy/video/compositing/__init__.py
+++ b/moviepy/video/compositing/__init__.py
@@ -0,0 +1 @@
+"""All for compositing video clips."""
\ No newline at end of file
diff --git a/moviepy/video/fx/__init__.py b/moviepy/video/fx/__init__.py
index 5a0de03e..33ce668f 100644
--- a/moviepy/video/fx/__init__.py
+++ b/moviepy/video/fx/__init__.py
@@ -1,3 +1,5 @@
+"""All the visual effects that can be applied to VideoClip."""
+
# import every video fx function
from moviepy.video.fx.AccelDecel import AccelDecel