summarylogtreecommitdiffstats
path: root/0003-migrate-from-moviepy-v1.x-to-v2.x.patch
blob: 5e392fd6fa4861ebcb953aab6ada61b091b4ded0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
From 929097cd9296be0f75f1ea04653839a0bb9102b1 Mon Sep 17 00:00:00 2001
From: bemxio <bemxiov@protonmail.com>
Date: Fri, 27 Jun 2025 10:22:57 +0200
Subject: [PATCH 3/3] migrate from moviepy v1.x to v2.x

---
 jumpcutter/clip.py | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/jumpcutter/clip.py b/jumpcutter/clip.py
index bd80453..2f8dbe5 100644
--- a/jumpcutter/clip.py
+++ b/jumpcutter/clip.py
@@ -2,10 +2,8 @@
 
 import numpy as np
 
-from moviepy.audio.io.AudioFileClip import AudioFileClip
-from moviepy.editor import concatenate_videoclips
-from moviepy.video.fx.all import speedx
-from moviepy.video.io.VideoFileClip import VideoFileClip
+from moviepy import AudioFileClip, concatenate_videoclips, VideoFileClip
+from moviepy.video.fx import MultiplySpeed
 from tqdm import tqdm
 
 
@@ -50,22 +48,22 @@ def jumpcut_silent_parts(
         jumpcutted_clips = []
         previous_stop = 0
         for start, stop in tqdm(intervals_to_cut, desc="Cutting silent intervals"):
-            clip_before = self.clip.subclip(previous_stop, start)
+            clip_before = self.clip.subclipped(previous_stop, start)
 
             if clip_before.duration > self.min_loud_part_duration:
                 jumpcutted_clips.append(clip_before)
 
             if self.silence_part_speed is not None:
-                silence_clip = self.clip.subclip(start, stop)
-                silence_clip = speedx(
-                    silence_clip, self.silence_part_speed
-                ).without_audio()
+                silence_clip = self.clip.subclipped(start, stop)
+                silence_clip = silence_clip.with_effects([
+                    MultiplySpeed(self.silence_part_speed)
+                ]).without_audio()
                 jumpcutted_clips.append(silence_clip)
 
             previous_stop = stop
 
         if previous_stop < self.clip.duration:
-            last_clip = self.clip.subclip(previous_stop, self.clip.duration)
+            last_clip = self.clip.subclipped(previous_stop, self.clip.duration)
             jumpcutted_clips.append(last_clip)
         return jumpcutted_clips
 
@@ -75,7 +73,7 @@ def jumpcut_voiced_parts(
         jumpcutted_clips = []
         for start, stop in tqdm(intervals_to_cut, desc="Cutting voiced intervals"):
             if start < stop:
-                silence_clip = self.clip.subclip(start, stop)
+                silence_clip = self.clip.subclipped(start, stop)
                 jumpcutted_clips.append(silence_clip)
         return jumpcutted_clips
 
-- 
2.50.0