Dear Finn,
The new version of Expyriment (which will be released very soon) will have some more information about using video in the documentation.
Here is a quick introduction into the topic:
1) The first thing to understand is that Expyriment only plays MPEG1 videos with MP3 audio right now (and unfortunately, the Pygame backend that is responsible for video playback seems to be very picky on the details of this).
To encode any video into the correct format, you can use ffmpeg (
https://www.ffmpeg.org) and convert in the following way:
ffmpeg -i <inputfile> -vcodec mpeg1video -acodec libmp3lame -intra -qscale 2 <outputfile.mpg>
The -qscale option is the quality setting. It can take values from 1 to 31. 1 is the best quality, but big file size. 31 is the worst quality, but small file size. Play around with this setting to get a good balance between quality and file size.
2) Once you have the video in the correct format, you can create a video object:
my_video = expyriment.stimuli.Video("filename")
3) If the video has sound, too, then you need to (temporarily) stop the audio system (such that the video system can play sound):
expyriment.control.stop_audiosystem()
4) Preload the video into memory, before playing it back:
my_video.preload()
5) Understanding the various methods of the video object:
play() will simply start video playback in the background. This has no effect on the screen, no frames from the video are presented automatically. Use this, if you want to get each frame from the video manually and present them at your liking (using the update() method, see below).
present() will do a bit more. It will start video playback and it will present the very first frame of the video onto the screen for you. Just like present method of other visual stimuli in Expyriment, the method will only return, once the stimulus (in that case the first video frame) has actually been presented on the screen, giving you important information about when the participants are actually starting to see your video.
update() will take the current frame (from a playing video) and present it to the screen. As with present(), the method blocks until the frame is actually visible on the screen.
wait_end() will basically do, what update does, but continuously, for each frame, until the end of the video.
wait_frame() is the same as wait_end, but up to a specified frame only, instead until the end of the video.
Taken together, what you usually want is a combination of present() and wait_end().
Coming back to your example, the code would look something like this:
fixcross = expyriment.stimuli.FixCross()
videos = [expyriment.stimuli.Video("file1"),
expyriment.stimuli.Video("file2"),
...]
expyriment.control.stop_audiosystem()
for v in videos:
v.preload()
for v in videos:
fixcross.present()
exp.clock.wait(1000)
v.present()
v.wait_end()
I hope this little introduction helped. Let me know if you have any further questions.
All the best,
Florian