'Best way to concatenate videos that have different resolution (generally 1080 or 720)

from command line or python would be best. and i am trying to concatenate around 15 clips of 45 seconds. preferably easy to automate with different number of videos and of different length.



Solution 1:[1]

Using MoviePy, which can import videos at a specific resolution:

from moviepy.editor import VideoFileClip, concatenate_videoclips

filenames = ["vid1.mp4", "vid2.mp4"]  # You could generate this from os.listdir or similar
clips = []

for file in filenames:
    clips.append(VideoFileClip(file, target_resolution=(1080, 1920))

final_clip = concatenate_videoclips(clips)  # method="chain" by default. This is fine because all clips are the same size
final_clip.write_videofile("out.mp4")

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Zack Walton