Created
March 18, 2021 16:21
-
-
Save CathyLou/dfbda26708a3e2b3152743ed3fdf732f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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