Answers for "python combine two mp4"

0

merge all mp4 video files into one file python

from moviepy.editor import *
import os
from natsort import natsorted

L =[]

for root, dirs, files in os.walk("/path/to/the/files"):

    #files.sort()
    files = natsorted(files)
    for file in files:
        if os.path.splitext(file)[1] == '.mp4':
            filePath = os.path.join(root, file)
            video = VideoFileClip(filePath)
            L.append(video)

final_clip = concatenate_videoclips(L)
final_clip.to_videofile("output.mp4", fps=24, remove_temp=False)
Posted by: Guest on June-24-2020

Python Answers by Framework

Browse Popular Code Answers by Language