问题描述
我正在创建一个简单的pygame,无法找出如何在全屏模式下制作Moviepy预览剪辑.使用Moviepy打开电影.这是我的代码:
I'm creating a simple pygame, and cannot find out how to make Moviepy preview clip in full screen. Using Moviepy for my opening cinematic. Here is my code:
import moviepy
import os
from moviepy.editor import *
import pygame
pygame.display.set_caption('Game title')
os.environ["SDL_VIDEO_CENTERED"] = "1"
clip = VideoFileClip('qq.mp4')
clip.preview()
execfile("startGame.py")
我不确定这是否是pygame中用于打开全屏电影的最佳做法...
I'm not sure if this is the best practice in pygame to use for an opening full-screen cinematic...
推荐答案
我在Python \ Python36-32 \ Lib \ site-packages \ moviepy \ video \ io Preview.py第94行中进行了更改
I changed in Python\Python36-32\Lib\site-packages\moviepy\video\io preview.py line 94
screen = pg.display.set_mode(clip.size)
到
screen = pg.display.set_mode(clip.size,pg.FULLSCREEN)
,然后将剪辑调整为我的分辨率(1280x800).否则会引发错误.
and resized the clip to be under my resolution (1280x800). Otherwise it throws an error.
import pygame
from moviepy.editor import VideoFileClip
pygame.init ()
clip = VideoFileClip('Intro.mpg')
clipresized = clip.resize (height=700)
clipresized.preview ()
game_loop()
pygame.quit ()
quit()
我使用moviepy的原因与您相同,我的代码看起来与您的代码非常相似(这并不意味着它是正确的).这不是最好的方法,并且将lib固定用于其他用途,但对我有用.
I use moviepy for the same reason as you do and my code looks very much like yours (this does not mean it is right). This is not the best way to do it and screws up the lib for other uses but it worked for me.
这篇关于全屏电影的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!