美丽心灵公益论坛

查看: 1659|回复: 0

MoviePy预览视频

[复制链接]
累计签到:57 天
连续签到:1 天

981

主题

461

回帖

8037

积分

版主

Rank: 7Rank: 7Rank: 7

积分
8037
发表于 2022-4-9 00:39:07| 字数 803 来自手机 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

x
需要PyGame
You must execute VideoFileClip before previewing.

The method askopenfile selects a file.
Execute clip = VideoFileClip(file.name) for creating VideoFileClip object.
Then you can execute clip.without_audio().preview().

For more details see: MoviePy – Previewing a Video Clip.

When executing the code, I was getting an error message:

clip.preview requires Pygame installed

I has to install pygame.

Here is a code sample for selecting and previewing a video file:

from tkinter.filedialog import askopenfile
from moviepy.editor import *
   
file = askopenfile(initialdir = ".", title="choose a video", filetype=[("Video Files","*.mp4")])

if file:
    print("File was loaded")

    # https://www.geeksforgeeks.org/moviepy-previewing-a-video-clip/
    # Loading video file
    clip = VideoFileClip(file.name)
   
    # previewing the clip at fps = 10
    clip.without_audio().preview(fps=10)
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|免责及版权声明|关于|美丽心灵公益论坛

GMT+8, 2025-11-7 06:02 , Processed in 0.054548 second(s), 26 queries .

Powered by Discuz! X3.4

!copyright!

快速回复 返回顶部 返回列表