Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: concatenate - duration of the result #796

Merged
merged 2 commits into from
May 14, 2020

Conversation

knezi
Copy link
Contributor

@knezi knezi commented May 11, 2018

see #753
second part of the bad PR.

@coveralls
Copy link

coveralls commented May 11, 2018

Coverage Status

Coverage increased (+0.03%) to 64.767% when pulling 7c08351 on knezi:fix_concatenate into 103b2aa on Zulko:master.

@tburrows13
Copy link
Collaborator

Would you mind giving an example piece of code that only works correctly with this code please? Thanks

@tburrows13 tburrows13 added the bug-fix For PRs and issues solving bugs. label May 14, 2018
@knezi
Copy link
Contributor Author

knezi commented May 15, 2018

Well, just this:

a=VideoFileClip('something')
b=VideoFileClip('something')
concatenate_videoclips([a,b]).write_videofile('something')

Or do you mean into the code?

@tburrows13
Copy link
Collaborator

What I mean is a piece of code that doesn't do what it should unless this patch has been applied. I've looked into this one, and I agree that there is a bug. Here are 2 pieces of code that demonstrate the bug:

from moviepy.editor import *
a = ColorClip((500, 750), color=(0, 255, 0)).set_fps(24).set_duration(10)
b = ColorClip((750, 500), color=(255, 255, 0)).set_fps(24).set_duration(10)
c = concatenate_videoclips([a, b], method="compose", padding=3)
d.write_videofile("padding3.mp4")

d should have a duration of 23 (10 + 3 + 23), but without this fix applied, it has a duration of 26, as the blank gap in the middle lasts for 6 seconds.

from moviepy.editor import *
a = ColorClip((500, 750), color=(0, 255, 0)).set_fps(24).set_duration(10)
b = ColorClip((750, 500), color=(255, 255, 0)).set_fps(24).set_duration(10)
c = ColorClip((600, 600), color=(0, 255, 255)).set_fps(24).set_duration(10)
d = concatenate_videoclips([a, b, c], method="compose", padding=3)
d.write_videofile("padding3.mp4")

With 3 clips, it is even stranger. It should have a duration of 36 (10 + 3 + 10 + 3 + 10) but it has 39 instead; there is an extra 3 seconds of black at the end.

Well done for spotting this, and as far as I can tell, your fix does work.

@knezi
Copy link
Contributor Author

knezi commented May 17, 2018

@tburrows13 O, I see. Thanks for providing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-fix For PRs and issues solving bugs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants