1

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...

  • Have you tried grabbing the actual screen size from somewhere, then resizing the pygame display to fit? – Tom Burrows Feb 14 '17 at 12:27
  • Yeah. Can't remember the code exactly, but I did try quite a few of those stuff. It would just resize again to its original size. –  Feb 14 '17 at 17:18
  • Ok then, use `clip.resize(height=screenheight)` or something along those lines. Presumably you want there to be a black strip along the bottom+top/sides if the screen aspect ratio isn't the same as the video's? – Tom Burrows Feb 15 '17 at 12:23
  • See answer [here](https://stackoverflow.com/questions/49941881/how-to-resize-moviepy-to-fullscreen/49969286#49969286) – Tom Burrows Apr 22 '18 at 18:23

1 Answers1

2

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.