Skip to content

Commit

Permalink
Merge branch 'master' into audio_delay-fx
Browse files Browse the repository at this point in the history
  • Loading branch information
mondeja committed Jan 23, 2021
2 parents 80dec04 + 736abcc commit eee4581
Show file tree
Hide file tree
Showing 83 changed files with 577 additions and 643 deletions.
15 changes: 7 additions & 8 deletions examples/dancing_knights.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@
Here is what we do:
0- Get the video of a dancing knight, and a (Creative Commons) audio music file.
1- load the audio file and automatically find the tempo
2- load the video and automatically find a segment that loops well
3- extract this segment, slow it down so that it matches the audio tempo,
and make it loop forever.
4- Symmetrize this segment so that we will get two knights instead of one
5- Add a title screen and some credits, write to a file.
0. Get the video of a dancing knight, and a (Creative Commons) audio music file.
1. Load the audio file and automatically find the tempo.
2. Load the video and automatically find a segment that loops well
3. Extract this segment, slow it down so that it matches the audio tempo, and make
it loop forever.
4. Symmetrize this segment so that we will get two knights instead of one
5. Add a title screen and some credits, write to a file.
This example has been originally edited in an IPython Notebook, which makes it
easy to preview and fine-tune each part of the editing.
Expand Down
2 changes: 1 addition & 1 deletion examples/logo.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
duration = 1


def f(t, size, a=np.pi / 3, thickness=20):
def f(t, size, a=np.pi / 3, thickness=20): # noqa D103
w, h = size
v = thickness * np.array([np.cos(a), np.sin(a)])[::-1]
center = [int(t * w / duration), h / 2]
Expand Down
10 changes: 5 additions & 5 deletions examples/moving_letters.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
rotMatrix = lambda a: np.array([[np.cos(a), np.sin(a)], [-np.sin(a), np.cos(a)]])


def vortex(screenpos, i, nletters):
def vortex(screenpos, i, nletters): # noqa D103
d = lambda t: 1.0 / (0.3 + t ** 8) # damping
a = i * np.pi / nletters # angle of the movement
v = rotMatrix(a).dot([-1, 0])
Expand All @@ -28,19 +28,19 @@ def vortex(screenpos, i, nletters):
return lambda t: screenpos + 400 * d(t) * rotMatrix(0.5 * d(t) * a).dot(v)


def cascade(screenpos, i, nletters):
def cascade(screenpos, i, nletters): # noqa D103
v = np.array([0, -1])
d = lambda t: 1 if t < 0 else abs(np.sinc(t) / (1 + t ** 4))
return lambda t: screenpos + v * 400 * d(t - 0.15 * i)


def arrive(screenpos, i, nletters):
def arrive(screenpos, i, nletters): # noqa D103
v = np.array([-1, 0])
d = lambda t: max(0, 3 - 3 * t)
return lambda t: screenpos - 400 * v * d(t - 0.2 * i)


def vortexout(screenpos, i, nletters):
def vortexout(screenpos, i, nletters): # noqa D103
d = lambda t: max(0, t) # damping
a = i * np.pi / nletters # angle of the movement
v = rotMatrix(a).dot([-1, 0])
Expand All @@ -59,7 +59,7 @@ def vortexout(screenpos, i, nletters):
# WE ANIMATE THE LETTERS


def moveLetters(letters, funcpos):
def moveLetters(letters, funcpos): # noqa D103
return [
letter.set_pos(funcpos(letter.screenpos, i, len(letters)))
for i, letter in enumerate(letters)
Expand Down
2 changes: 1 addition & 1 deletion examples/painting_effect.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" requires scikit-image installed (for vfx.painting) """
"""Requires scikit-image installed (for ``vfx.painting``)."""

from moviepy import *

Expand Down
2 changes: 1 addition & 1 deletion examples/soundtrack.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" A simple test script on how to put a soundtrack to a movie """
"""A simple test script on how to put a soundtrack to a movie."""
from moviepy import *


Expand Down
10 changes: 4 additions & 6 deletions examples/star_worms.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
Mimic of Star Wars' opening title. A text with a (false)
perspective effect goes towards the end of space, on a
background made of stars. Slight fading effect on the text.
"""

import numpy as np
Expand Down Expand Up @@ -74,7 +73,7 @@


def trapzWarp(pic, cx, cy, is_mask=False):
""" Complicated function (will be latex packaged as a fx) """
"""Complicated function (will be latex packaged as a fx)."""
Y, X = pic.shape[:2]
src = np.array([[0, 0], [X, 0], [X, Y], [0, Y]])
dst = np.array([[cx * X, cy * Y], [(1 - cx) * X, cy * Y], [X, Y], [0, Y]])
Expand Down Expand Up @@ -124,8 +123,7 @@ def trapzWarp(pic, cx, cy, is_mask=False):


def annotate(clip, txt, txt_color="white", bg_color=(0, 0, 255)):
""" Writes a text at the bottom of the clip. """

"""Writes a text at the bottom of the clip."""
txtclip = TextClip(txt, font_size=20, font="Ubuntu-bold", color=txt_color)

txtclip = txtclip.on_color(
Expand All @@ -137,11 +135,11 @@ def annotate(clip, txt, txt_color="white", bg_color=(0, 0, 255)):
return cvc.with_duration(clip.duration)


def resizeCenter(clip):
def resizeCenter(clip): # noqa D103
return clip.resize(height=h).set_pos("center")


def composeCenter(clip):
def composeCenter(clip): # noqa D103
return CompositeVideoClip([clip.set_pos("center")], size=moviesize)


Expand Down
11 changes: 5 additions & 6 deletions find_latest_imagemagick_version.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
"""Parses url below to extract latest image magick version (major version 6.9),
to feed it into CI system. Not the best way for reproducible builds, but it's
preferred for now over storing imagemagick installer into the GIT repository.
"""

import re
from urllib import request


url = "https://legacy.imagemagick.org/script/index.php"

"""This little script parses url above to extract latest image magick version
(major version 6.9), to feed it into CI system. Not the best way for reproducible
builds, but it's preferred for now over storing imagemagick installer into the
git repository
"""

response = request.urlopen(url)
html = response.read().decode(r"utf-8")
r = re.compile(r"6\.9\.[0-9]+-[0-9]+")
Expand Down
Loading

0 comments on commit eee4581

Please sign in to comment.