5

I am making a game using pygame and I wanted to add cut scenes to it. The pygame movie module however doesn’t work anymore so I had to resort to using moviepy. Moviepy isn’t that well documented from what I can see so I’m having some trouble figuring it out. I got it to work using this block of code but all I need now is to full screen it (desired window screen is 640x400). So how would I go about doing so? Thank you in advance.

from moviepy.editor import *
from pygame import *# Window display
WIN_WIDTH = 640
WIN_HEIGHT = 400
HALF_WIDTH = int(WIN_WIDTH / 2)
HALF_HEIGHT = int(WIN_HEIGHT / 2)
DISPLAY = (WIN_WIDTH, WIN_HEIGHT)
DEPTH = 32
FLAGS = FULLSCREEN

#display.set_mode(DISPLAY, FLAGS, DEPTH)  #define screen values
display.set_caption("I'm Working!")
Credits = 'Untitled.mp4'
def playVid(video):
    clip = VideoFileClip(video)
    clip.resize(DISPLAY).preview()
    return


playVid(Credits)
Moe
  • 191
  • 7
  • [This question](https://stackoverflow.com/questions/42190332/moviepy-fullscreen) might help you. – Jerrybibo Apr 20 '18 at 13:17
  • @Jerrybibo it’s a class project, it needs to work on multiple machines so editing the library isn’t practical. – Moe Apr 20 '18 at 13:19
  • @Moe. I’m a collaborator on moviepy, so if you can find an edit to the library that works for you, I can get it merged in as an option :) – Tom Burrows Apr 20 '18 at 16:33
  • @tburrows13 I did what the linked question did and 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 it worked perfectly. Thank you :) – Moe Apr 20 '18 at 19:16
  • Ok, this looks like a super simple feature to add. When do you need it done by? I'll just make another parameter for `clip.preview` which, when set, calls `pg.display.setmode` with the full screen option. – Tom Burrows Apr 20 '18 at 22:09
  • @tburrows13 that’s perfect thank you so much, my assignment is due on Monday so if it’s possible to do that by then that would be great! – Moe Apr 20 '18 at 22:33
  • Ok, that should be doable. Have you used Github before? Don’t worry if not. – Tom Burrows Apr 21 '18 at 06:20
  • 1
    Would you mind checking out be feature [here](https://github.com/Zulko/moviepy/pull/773)? If it works for you, I’ll merge it. – Tom Burrows Apr 21 '18 at 08:10
  • @tburrows13 I mentioned all the comments I had at https://stackoverflow.com/questions/49964841/moviepy-plays-videos-out-of-sync – Moe Apr 22 '18 at 10:19
  • @Moe, I've saw the question that you've now deleted, and I've update the pull request so that it should hopefully work now. As soon as you let me know that it works, I can merge it. – Tom Burrows Apr 22 '18 at 16:57
  • @tburrows13 works perfectly, please merge it. Thank you! :) – Moe Apr 22 '18 at 17:09
  • Ok, would you like it pushed to PyPI as well so that you can pip install it? – Tom Burrows Apr 22 '18 at 17:43
  • @tburrows13 I install my modules through pycharm, I think it updates automatically. – Moe Apr 22 '18 at 17:44
  • @Moe it will be getting them from the PyPI servers then :) I'll push a PyPI update now. – Tom Burrows Apr 22 '18 at 18:04

1 Answers1

5

As of moviepy version 0.2.3.4, you can call clip.preview(fullscreen=True) to make your preview fullscreen. Press Esc or the quit button to quit. See the pull request for further info.

Run pip install moviepy --upgrade to update moviepy to the latest version.

Tom Burrows
  • 2,225
  • 2
  • 29
  • 46
  • I was also wondering if you could edit the 67th line. fps=15. Change it to just fps so we can input the video fps manually for each video? – Moe Apr 22 '18 at 18:24
  • You can specify the fps with `clip.preview(fps=30, fullscreen=True)`. The `fps=15` is just a default value, for if you don't pass `fps` as an argument. – Tom Burrows Apr 22 '18 at 18:27