MoviePy - 加载视频文件剪辑
在本文中,我们将了解如何在 MoviePy 中加载视频文件剪辑。 MoviePy 是一个用于视频编辑的Python模块,可用于视频和 GIF 的基本操作。将一系列图像组合成运动图片的视觉多媒体源。视频将信号传输到屏幕并处理应显示屏幕截图的顺序。视频通常具有与屏幕上显示的图片相对应的音频组件。
In order to do this we will use VideoFileClip
method
Syntax : VideoFileClip(“file_name”)
Argument : It takes name or address of the file
Return : It returns VideoFileClip object
下面是实现
# Import everything needed to edit video clips
from moviepy.editor import *
# loading video dsa gfg intro video
clip = VideoFileClip("dsa_geek.webm")
# getting subclip as video is large
clip = clip.subclip(0, 10)
# showing clip
clip.ipython_display(width = 280)
输出 :
Moviepy - Building video __temp__.mp4.
Moviepy - Writing video __temp__.mp4
Moviepy - Done !
Moviepy - video ready __temp__.mp4
另一个例子
# Import everything needed to edit video clips
from moviepy.editor import *
# loading video gfg
clip = VideoFileClip("geeks.mp4")
# showing clip
clip.ipython_display(width = 300)
输出 :
Moviepy - Building video __temp__.mp4.
MoviePy - Writing audio in __temp__TEMP_MPY_wvf_snd.mp3
MoviePy - Done.
Moviepy - Writing video __temp__.mp4
Moviepy - Done !
Moviepy - video ready __temp__.mp4