LABSN / expyfun

Experimental paradigm functions.
BSD 3-Clause "New" or "Revised" License
13 stars 21 forks source link

Unable to change window size for video playback #444

Closed JustinTFleming closed 4 days ago

JustinTFleming commented 2 years ago

Using the FFMPEG integration from the latest expyfun release, I am able to play MP4 videos at the size of the example video in simple_video.py: window_size = (720, 480). Playing at a smaller screen size and changing the aspect ratio (e.g. with window_size = (688, 387), which is 16:9) are both fine, but making the video window much larger -- or attempting to play it full screen -- causes problems on the two Windows machines I've tested.

As the screen size is increased to an intermediate level, e.g. (1050, 700) px, playback starts getting choppy, with what looks like dropped frames at the beginning. I can play the included example-video.mp4 up to full screen, but with similar issues. Trying to play other MP4 files at or near full screen leads to crashing, usually on the second ec.flip() call, with the error traceback below.

Curious if anyone has tried increasing the video window size on their machines and encountered similar issues.

-- PC info -- OS: Windows 10 Python version: 3.7 expyfun release: 6c11b8a Running through Spyder (iPython 7.29.0)

Error stack from attempting to play the video with ec argument full_screen = True:

`Traceback (most recent call last):

File "L:\Projects\Recovery_AV\simple_video_test.py", line 90, in fliptime = ec.flip()

File "L:\Projects\Recovery_AV\expyfun_experiment_controller.py", line 1035, in flip function()

File "L:\Projects\Recovery_AV\expyfun\visual_visual.py", line 1308, in draw self._player.update_texture()

File "C:\Users\jtf.conda\envs\videoEnv\lib\site-packages\pyglet\media\player.py", line 461, in update_texture frame_rate = source.video_format.frame_rate

AttributeError: 'NoneType' object has no attribute 'video_format'`