Skip to content

Video editing with Python

Add coreader function to VideoFileClip (#1332)

ToxicOverload21fff157858e
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4729aa19..d6fd9dc2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Important Announcements
### Added <!-- for new features -->
+- `VideoFileClip.coreader()` that creates a new clip created from the same source file as the original (to complement the existing `AudioFileClip.coreader()`) [#1332]
### Changed <!-- for changes in existing functionality -->
diff --git a/moviepy/video/io/VideoFileClip.py b/moviepy/video/io/VideoFileClip.py
index fd7b38f9..24d62549 100644
--- a/moviepy/video/io/VideoFileClip.py
+++ b/moviepy/video/io/VideoFileClip.py
@@ -145,6 +145,12 @@ class VideoFileClip(VideoClip):
nbytes=audio_nbytes,
)
+ def coreader(self):
+ """Returns a copy of the VideoFileClip, i.e. a new entrance point
+ to the video file. Use copy when you have different clips
+ watching the video file at different times."""
+ return VideoFileClip(self.filename, audio_buffersize=self.audio.buffersize)
+
def close(self):
""" Close the internal reader. """
if self.reader: