Moviepy: concatenate_videoclips([clip1,clip2]) results in a clip where the second clip is skewed and has severe lines

Created on 1 Apr 2017  路  7Comments  路  Source: Zulko/moviepy

When running the following code:

`>>> from moviepy.editor import *

clip1 = VideoFileClip('clip1.MOV')
clip2 = VideoFileClip('clip2.mp4')
render = concatenate_videoclips([clip1,clip2])
render.write_videofile('render.mp4', codec='libx264')`

The resulting video file is messed up. It has lines all through the screen and there are about 4 copies of the clip tiled across the screen horizontally and vertically.

Most helpful comment

that is most certainly because your clips are not the same size, therefore you must add method='compose' to concatenate_videoclip

All 7 comments

that is most certainly because your clips are not the same size, therefore you must add method='compose' to concatenate_videoclip

Should we output a warning if the sizes are not equal and the method is not compose?

@evanthemann .. did @Zulko 's advice solve the problem?

In fact, why not make "compose" the default? I can't see why most people would want to use "chain"... @Zulko, is there any reason the default is "chain"?

Yes it did! Realized I was trying to combine a 1280x720 clip with a 1920x1080 clip. Thanks!

Do you have a method to resize the video's size?
If you do, can you show me?

here is a method I wrote by myself. I don't think this is very good
def resizeAllClip(clips):
max = 0
for clip in clips:
if clip.size[1] > max:
max = clip.size[1]
clip_t = []
for clip in clips:
wid = int((max / clip.size[1]) * clip.size[0])
print(wid)
clip = clip.resize(width=wid, height=max)
clip_t.append(clip)
return clip_t

@Zulko Thanks for your solution. is there any other useful params to remind us?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

RahulPrasad picture RahulPrasad  路  4Comments

xjcl picture xjcl  路  3Comments

bilel picture bilel  路  4Comments

tburrows13 picture tburrows13  路  3Comments

Netherdrake picture Netherdrake  路  5Comments