Cannot launch a movie under expyriment
Hello,
I want to display an .mp4 movie during the presentation of my stimuli but I am unable to do so using Expyriment. I believe this is because the pygame.movie module has been deprecated. I am using expyriment 0.0.7. and pygame 1.9.3.
Could you help me with this?
Thank you very much in advance.
Ana Luísa Pinho
P.S. I am writing below the full log of the error message for sake of clarity.
In [1]: run movie_protocol.py
Expyriment 0.7.0 (Revision 55a4e7e; Python 2.7.12)
File: movie_protocol.py (7f2624)
ALSA lib conf.c:3009:(snd_config_update_r) Cannot access file /etc/alsa/alsa.conf
ALSA lib seq.c:935:(snd_seq_open_noupdate) Unknown SEQ default
*** DEVELOP MODE ***
Warning: OpenGL does not support window mode. OpenGL will be deactivated!
Standard output and error logging is switched off under IPython.
Warning: Mixer is still initialized, cannot play audio! Call expyriment.control.stop_audiosystem() before preloading the video.
/usr/lib/python2.7/dist-packages/expyriment/stimuli/_video.py:163: RuntimeWarning: use movie: No module named movie
(ImportError: No module named movie)
self._file = pygame.movie.Movie(unicode2str(self._filename,
NotImplementedError Traceback (most recent call last)
/volatile/mygit_repos/ibc_ghub/cognitive_protocols/Movie_protocol/movie_protocol.py in ()
154 t_start = t0.time
155 # Present stimulus for one second
--> 156 stimulus.present()
157 exp.clock.wait(1000)
158 # Calculate duration of condition
/usr/lib/python2.7/dist-packages/expyriment/stimuli/_video.pyc in present(self)
250 """
251
--> 252 self.play()
253 while not self._file.get_frame() > self._frame:
254 pass
/usr/lib/python2.7/dist-packages/expyriment/stimuli/_video.pyc in play(self)
198
199 if not self._is_preloaded:
--> 200 self.preload()
201 if self._logging:
202 expyriment._active_exp._event_file_log(
/usr/lib/python2.7/dist-packages/expyriment/stimuli/_video.pyc in preload(self)
161
162 if not self._is_preloaded:
--> 163 self._file = pygame.movie.Movie(unicode2str(self._filename,
164 fse=True))
165 screen_size = expyriment._active_exp.screen.surface.get_size()
/home/analu/.local/lib/python2.7/site-packages/pygame/init.pyc in getattr(self, var)
103 if self.reason:
104 MissingPygameModule += "\n(%s)" % self.reason
--> 105 raise NotImplementedError(MissingPygameModule)
106
107 def nonzero(self):
NotImplementedError: movie module not available
(ImportError: No module named movie)
/home/analu/.local/lib/python2.7/site-packages/pygame/init.py(105)getattr()
103 if self.reason:
104 MissingPygameModule += "\n(%s)" % self.reason
--> 105 raise NotImplementedError(MissingPygameModule)
106
107 def nonzero(self):
Comments
Hi,
the new version of Expyriment (0.9.0) has a new Video stimulus. If you install it in the following way:
This should allow for mp4 videos to be played.
Please also check the documentation at http://docs.expyriment.org/Video.html.
Hi,
Do I need to install Expyriment 0.9.0 and run it using python3? I am asking this because I have several protocols running in Expyriment 0.7.0.
Thank you.
Ana Luísa
You will need to install Expyriment 0.9.0, yes. But this version runs also under Python 2.7, so there is no need to install Python 3 if you do not want to.
Hello again,
Thank you very much for your answer. It is working now. Nonetheless, I have another question. I want to change the size of the window that displays the video. It is currently very small. I am not sure whether this relates to the resolution because when I display it outside of expyriment (e.g. vlc) I can manage to have the full screen.
Thank you once again.
Ana Luísa
Hi Ana Luísa,
it does indeed relate to the resolution of the video. Expyriment does not perform any form of up or down scaling.
Best,
Florian