首页 > 解决方案 > 使用 pygame 或 moviepy 控制视频的播放

问题描述

我通过带有点击功能的 matplotlib 进行交互式绘图。目前,点击功能给了我时间t。现在,使用moviepy和pygame,我正在播放我直接跳到那个时间实例的视频。但是在玩的过程中,我无法控制。我想要一个暂停和滚动条来向前或向后播放视频。类似于 windows 媒体播放器。当按下键盘按钮时,是否有一些与剪辑相关的功能可以暂停视频?

    print('Playing video from time :', (t - 5, "to :", t + 5)
    clip = VideoFileClip(self.videofile).subclip(int(t) - 5, int(t) + 5)
    clip.preview()
    pygame.quit() # currently it is called at the end of the my plot 
    function

我想暂停功能。我寻找了一些像 clip.show() 这样的函数,但没有帮助我。

标签: pythonpygamemoviepy

解决方案


推荐阅读