Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

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)
Comment

PREVIOUS NEXT
Code Example
Python :: python datetime get date one week from today 
Python :: input python 3 
Python :: pandas df to dict 
Python :: python insert parent directory into sys path for import file purpose 
Python :: python convert image to base64 
Python :: merge two columns pandas 
Python :: python join dict 
Python :: insert row at given position in pandas dataframe 
Python :: tensorflow to numpy 
Python :: pd df sample 
Python :: pandas iteration 
Python :: select multiple dict 
Python :: mse python 
Python :: add a button on tkinter 
Python :: read dict from text 
Python :: count nan values 
Python :: remove initial space python 
Python :: python exec script 
Python :: ascending, descending dict 
Python :: views.py django 
Python :: python argv 
Python :: pandas if else 
Python :: itertools .cycle() 
Python :: media pipe install ERROR: Could not find a version that satisfies the requirement mediapipe (from versions: none) 
Python :: python isinstance 
Python :: python string cut last n characters 
Python :: Python "for in" loop to print the last item in the list 
Python :: numpy create array with values in range 
Python :: how to convert numpy array to cv2 image 
Python :: python add comma each 3 digits format 
ADD CONTENT
Topic
Content
Source link
Name
1+6 =