Skip to content

Instantly share code, notes, and snippets.

@CathyLou
Created March 18, 2021 16:21
Show Gist options
  • Select an option

  • Save CathyLou/dfbda26708a3e2b3152743ed3fdf732f to your computer and use it in GitHub Desktop.

Select an option

Save CathyLou/dfbda26708a3e2b3152743ed3fdf732f to your computer and use it in GitHub Desktop.
from moviepy.editor import * # !pip install moviepy
import os
from glob import glob
# 定义一个数组
L = []
filelist = glob('/data1/louming/*.mp4')
for filePath in filelist:
video = VideoFileClip(filePath)
# video = video.resize((1920, 1080))
# video = video.resize((540, 960)) #竖屏拍摄
# video = video.resize((2160, 3840)) #竖屏拍摄
video = video.resize((720, 1280)) #竖屏拍摄
L.append(video)
final_clip = concatenate_videoclips(L, method="compose")
final_clip.to_videofile('/data1/louming/output.mp4',
fps=30,
remove_temp=True,audio_codec="aac")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment