-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Tee Jung
committed
Mar 28, 2018
1 parent
6856d19
commit f26c4a6
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import pygame | ||
from PyDemux import Video | ||
|
||
import time | ||
|
||
|
||
def main(): | ||
width, height = -1, -1 | ||
screen = None | ||
|
||
pygame.init() | ||
|
||
video = Video.open('/Users/tee/Downloads/interview.mp4') | ||
|
||
while 1: | ||
im = video.get_frame() | ||
if im is None: | ||
break | ||
|
||
if im.size != (width, height): | ||
width, height = im.size | ||
|
||
pygame.display.set_mode((width, height)) | ||
screen = pygame.display.get_surface() | ||
|
||
image = pygame.image.frombuffer(im.tobytes(), im.size, "RGB") | ||
screen.blit(image, (0, 0)) | ||
pygame.display.flip() | ||
|
||
pygame.event.get() | ||
time.sleep(1) | ||
|
||
|
||
main() |