Video editing with Python
small changes in cuts.
Zulkocadb56625c0c
diff --git a/docs/ref/videofx.rst b/docs/ref/videofx.rstindex 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_decelblackwhiteblinkcolorxcrop+ even_sizefadeinfadeoutfreeze+ freeze_regiongamma_corrheadblur+ invert_colorslooplum_contrastmake_loopablemargin+ mask_and+ mask_color+ mask_ormirror_xmirror_ypainting@@ -54,6 +61,7 @@ the module ``video.fx`` is loaded as ``vfx`` and you can use ``vfx.colorx``, ``vrotationscrollspeedx+ supersampletime_mirrortime_symmetrizediff --git a/moviepy/video/compositing/concatenate.py b/moviepy/video/compositing/concatenate.pyindex 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 theresulting 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 sameresolution, the final resolution will be such that no clip hasdiff --git a/moviepy/video/io/ffmpeg_reader.py b/moviepy/video/io/ffmpeg_reader.pyindex 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)+1if pos == self.pos:return self.lastreadelse:if(pos < self.pos) or (pos > self.pos+100):self.initialize(t)+ self.pos = poselse:self.skip_frames(pos-self.pos-1)result = self.read_frame()diff --git a/moviepy/video/tools/cuts.py b/moviepy/video/tools/cuts.pyindex 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= 0for 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_distancesif 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_distancereturn FramesMatches( result )