Skip to content

Video editing with Python

small changes in cuts.

Zulkocadb56625c0c
diff --git a/docs/ref/videofx.rst b/docs/ref/videofx.rst
index 1d41d95f..32f2ae39 100644
--- a/docs/ref/videofx.rst
+++ b/docs/ref/videofx.rst
@@ -34,19 +34,26 @@ the module ``video.fx`` is loaded as ``vfx`` and you can use ``vfx.colorx``, ``v
:toctree: videofx
:nosignatures:
+ accel_decel
blackwhite
blink
colorx
crop
+ even_size
fadein
fadeout
freeze
+ freeze_region
gamma_corr
headblur
+ invert_colors
loop
lum_contrast
make_loopable
margin
+ mask_and
+ mask_color
+ mask_or
mirror_x
mirror_y
painting
@@ -54,6 +61,7 @@ the module ``video.fx`` is loaded as ``vfx`` and you can use ``vfx.colorx``, ``v
rotation
scroll
speedx
+ supersample
time_mirror
time_symmetrize
diff --git a/moviepy/video/compositing/concatenate.py b/moviepy/video/compositing/concatenate.py
index 7a16ac17..358a9314 100644
--- a/moviepy/video/compositing/concatenate.py
+++ b/moviepy/video/compositing/concatenate.py
@@ -21,6 +21,8 @@ def concatenate_videoclips(clips, method="chain", transition=None,
not of the same size of anything. If none of the clips have masks the
resulting clip has no mask, else the mask is a concatenation of masks
(using completely opaque for clips that don't have masks, obviously).
+ If you have clips of different size and you want to write directly the
+ result of the concatenation to a file, use the method "compose" instead.
- method="compose", if the clips do not have the same
resolution, the final resolution will be such that no clip has
diff --git a/moviepy/video/io/ffmpeg_reader.py b/moviepy/video/io/ffmpeg_reader.py
index acb64d11..d23488b4 100644
--- a/moviepy/video/io/ffmpeg_reader.py
+++ b/moviepy/video/io/ffmpeg_reader.py
@@ -61,11 +61,11 @@ class FFMPEG_VideoReader:
self.close() # if any
- if starttime !=0 :
+ if starttime != 0 :
offset = min(1, starttime)
- i_arg = ['-ss', "%.03f" % (starttime - offset),
+ i_arg = ['-ss', "%.06f" % (starttime - offset),
'-i', self.filename,
- '-ss', "%.03f" % offset]
+ '-ss', "%.06f" % offset]
else:
i_arg = [ '-i', self.filename]
@@ -144,14 +144,20 @@ class FFMPEG_VideoReader:
"""
# these definitely need to be rechecked sometime. Seems to work.
-
- pos = int(self.fps*t)+1
+
+ # I use that horrible '+0.00001' hack because sometimes due to numerical
+ # imprecisions a 3.0 can become a 2.99999999... which makes the int()
+ # go to the previous integer. This makes the fetching more robust in the
+ # case where you get the nth frame by writing get_frame(n/fps).
+
+ pos = int(self.fps*t + 0.00001)+1
if pos == self.pos:
return self.lastread
else:
if(pos < self.pos) or (pos > self.pos+100):
self.initialize(t)
+ self.pos = pos
else:
self.skip_frames(pos-self.pos-1)
result = self.read_frame()
diff --git a/moviepy/video/tools/cuts.py b/moviepy/video/tools/cuts.py
index 8f1b5822..4844a59f 100644
--- a/moviepy/video/tools/cuts.py
+++ b/moviepy/video/tools/cuts.py
@@ -173,7 +173,8 @@ class FramesMatches(list):
- def select_scenes(self, match_thr, min_time_span, nomatch_thr=None):
+ def select_scenes(self, match_thr, min_time_span, nomatch_thr=None,
+ time_distance=0):
"""
match_thr
@@ -199,8 +200,12 @@ class FramesMatches(list):
starts_ends = sorted(dict_starts.items(), key = lambda k: k[0])
result = []
-
+ min_start= 0
for start, ends_distances in starts_ends:
+
+ if start < min_start:
+ continue
+
ends = [end for (end, distance) in ends_distances]
great_matches = [end for (end,dist) in ends_distances
if dist<match_thr]
@@ -223,6 +228,7 @@ class FramesMatches(list):
end = max(great_long_matches)
result.append(FramesMatch(start, end, match_thr))
+ min_start = start + time_distance
return FramesMatches( result )