Skip to content

Instantly share code, notes, and snippets.

@twobob
Last active April 23, 2018 14:58
Show Gist options
  • Save twobob/365c8b212c307b42e8fcb441fe3379e6 to your computer and use it in GitHub Desktop.
Save twobob/365c8b212c307b42e8fcb441fe3379e6 to your computer and use it in GitHub Desktop.
Merge all MP4's in a directory using MoviePy
import glob
import os.path
from moviepy.editor import *
dir = '.'
files = glob.glob(os.path.join(dir, '*.mp4'))
L=list()
#print (len(files))
for file in files:
L.append(VideoFileClip(file,audio=True))
final_clip = concatenate_videoclips(L,method="compose")
final_clip.write_videofile("merged.mp4")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment