-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Misc. changes. Added use_clip_fps_by_default. Changed ImageSequenceClip
- Loading branch information
Showing
19 changed files
with
278 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Quick recipes | ||
=============== | ||
|
||
|
||
|
||
Add a title before a video | ||
--------------------------- | ||
|
||
|
||
|
||
Videos | ||
|
||
|
||
|
||
Make gifs that loop well | ||
-------------------------- | ||
|
||
clip.fx( vfx.time_symmetrize) | ||
|
||
|
||
# find a subclip | ||
T = clip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,9 +9,11 @@ | |
|
||
def try_cmd(cmd): | ||
try: | ||
popen_params = {"stdout": sp.PIPE, | ||
"stderr": sp.PIPE, | ||
"stdin": DEVNULL} | ||
popen_params = { "stdout": sp.PIPE, | ||
"stderr": sp.PIPE, | ||
"stdin": DEVNULL | ||
} | ||
|
||
|
||
# This was added so that no extra unwanted window opens on windows | ||
# when the child process is created | ||
|
@@ -35,9 +37,10 @@ def try_cmd(cmd): | |
else: | ||
FFMPEG_BINARY = 'unset' | ||
else: | ||
success, err = try_cmd(cmd) | ||
success, err = try_cmd([FFMPEG_BINARY]) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
tankorsmash
via email
|
||
if not success: | ||
raise err | ||
raise IOError(err.message + | ||
"The path specified for the ffmpeg binary might be wrong") | ||
|
||
if IMAGEMAGICK_BINARY=='auto-detect': | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
def f_accel_decel(t, old_d, new_d, abruptness=1, soonness=1.0): | ||
""" | ||
abruptness | ||
negative abruptness (>-1): speed up down up | ||
zero abruptness : no effect | ||
positive abruptness: speed down up down | ||
soonness | ||
for positive abruptness, determines how soon the | ||
speedup occurs (0<soonness < inf) | ||
""" | ||
|
||
a = 1.0+abruptness | ||
def _f(t): | ||
f1 = lambda t: (0.5)**(1-a)*(t**a) | ||
f2 = lambda t: (1-f1(1-t)) | ||
return (t<.5)*f1(t) + (t>=.5)*f2(t) | ||
|
||
return old_d*_f((t/new_d)**soonness) | ||
|
||
|
||
def accel_decel(clip, new_duration=None, abruptness=1.0, soonness=1.0): | ||
""" | ||
new_duration | ||
If None, will be that of the current clip. | ||
abruptness | ||
negative abruptness (>-1): speed up down up | ||
zero abruptness : no effect | ||
positive abruptness: speed down up down | ||
soonness | ||
for positive abruptness, determines how soon the | ||
speedup occurs (0<soonness < inf) | ||
""" | ||
|
||
if new_duration is None: | ||
new_duration = clip.duration | ||
|
||
fl = lambda t : f_accel_decel(t, clip.duration, new_duration, | ||
abruptness, soonness) | ||
|
||
return clip.fl_time(fl).set_duration(new_duration) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,24 @@ | ||
|
||
def fadein(clip, duration): | ||
""" Makes the clip fade to black progressively, over ``duration`` | ||
seconds. For more advanced fading, see | ||
``moviepy.video.composition.crossfadein`` """ | ||
import numpy as np | ||
|
||
def fadein(clip, duration, initial_color=None): | ||
""" | ||
Makes the clip progressively appear from some color (black by default), | ||
over ``duration`` seconds at the beginning of the clip. Can be used for | ||
masks too, where the initial color must be a number between 0 and 1. | ||
For cross-fading (progressive appearance or disappearance of a clip | ||
over another clip, see ``composition.crossfade`` | ||
""" | ||
|
||
if initial_color is None: | ||
initial_color = 0 if clip.ismask else [0,0,0] | ||
|
||
return clip.fl(lambda gf, t: min(1.0 * t / duration, 1) * gf(t)) | ||
initial_color = np.array(initial_color) | ||
|
||
def fl(gf, t): | ||
if t>=duration: | ||
return gf(t) | ||
else: | ||
fading = (1.0*t/duration) | ||
return fading*gf(t) + (1-fading)*initial_color | ||
|
||
return clip.fl(fl) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
I don't know much about pip, but the one on pip for python27x32 doesn't have this change in it yet. Manually fixed it and came here to commit it. It's less than a month old fix, so it's probably just an issue of pip not being updated.