Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 'Clip.cutout' transformation not being applied properly #1468

Merged
merged 5 commits into from
Jan 19, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Changed deprecated `tostring` method by `tobytes` in `video.io.gif_writers::write_gif` [\#1429](https://github.com/Zulko/moviepy/pull/1429)
- Fixed calling `audio_normalize` on a clip with no sound causing `ZeroDivisionError` [\#1401](https://github.com/Zulko/moviepy/pull/1401)
- Fixed `freeze` FX was freezing at time minus 1 second as the end [\#1461](https://github.com/Zulko/moviepy/pull/1461)
- Fixed `Clip.cutout` transformation not being applied to audio [\#1468](https://github.com/Zulko/moviepy/pull/1468)


## [v2.0.0.dev2](https://github.com/zulko/moviepy/tree/v2.0.0.dev2) (2020-10-05)
Expand Down
8 changes: 2 additions & 6 deletions moviepy/Clip.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,8 +411,6 @@ def subclip(self, start_time=0, end_time=None):

return new_clip

@apply_to_mask
@apply_to_audio
@convert_parameter_to_seconds(["start_time", "end_time"])
def cutout(self, start_time, end_time):
"""
Expand All @@ -429,15 +427,13 @@ def cutout(self, start_time, end_time):
"""

new_clip = self.time_transform(
lambda t: t + (t >= start_time) * (end_time - start_time)
lambda t: t + (t >= start_time) * (end_time - start_time),
apply_to=["audio", "video"],
mondeja marked this conversation as resolved.
Show resolved Hide resolved
)

if self.duration is not None:

return new_clip.with_duration(self.duration - (end_time - start_time))

else:

return new_clip

@requires_duration
Expand Down