问题
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")
I'm not sure if this is the best practice in pygame to use for an opening full-screen cinematic...
回答1:
I changed in Python\Python36-32\Lib\site-packages\moviepy\video\io preview.py line 94
screen = pg.display.set_mode(clip.size)
to
screen = pg.display.set_mode(clip.size,pg.FULLSCREEN)
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()
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.
来源:https://stackoverflow.com/questions/42190332/moviepy-fullscreen