PsychToolboxVideoPlayer()

Description

Plays video stimuli on a second video monitor attached to the Bpod computer using PsychToolbox.

A "Sync Patch" is automatically generated for each video frame. The patch is set to a high pixel intensity on the first frame, and alternates between "off" and high intensity for subsequent frames. This allows an optical sensor mounted on the corner of the screen (i.e. Frame2TTL) to indicate the actual onset time of each video frame to an acquisition system, providing high precision reaction time and visual evidence update measurements.

  • Videos are matrices defined in MATLAB.

    • Each video frame is a matrix of 8-bit pixel values (0-255).

    • Single frames may be a grayscale intensity matrix of dimensions (Y, X) or a color matrix of dimensions (Y, X, 3)

    • The three color layers are intensity matrices for red, green and blue layers respectively.

  • Multiple frames are stacked in an additional dimension to create a video.

    • e.g. a color video is a 4-D matrix: Y x X x 3 x Nframes

  • Videos are loaded to the player and assigned an index (1 - 100).

  • Videos can be played by index, allowing a byte to specify which video to start.

  • Text strings can be loaded by index in place of videos, to display prompts to human subjects

  • By default, playing a video blocks the MATLAB command line.

    • In default mode, a loop loads frames into the video buffer. Frames are presented at regular intervals.

    • In timer mode, a MATLAB timer callback loads each frame into the video buffer. This makes the command line available during playback.

Object

After running Bpod, a PsychToolboxVideoPlayer object is initialized with the following syntax:

V = PsychToolboxVideoPlayer(MonitorID, ViewPortSize, ViewPortOffset, SyncPatchSize, SyncPatchYOffset)

MonitorID = The index of the second monitor attached to the PC. This is usually 2.

ViewPortSize = [X, Y] of the video to display (in pixels). The video width must leave enough room for the sync patch.

ViewPortOffset = [X, Y] offset of the viewport from left screen edge, and bottom screen edge respectively. (units = pixels)

SyncPatchSize = [X, Y] dimensions of the sync patch (units = pixels)

SyncPatchYOffset = distance of sync patch from bottom of the window (in pixels)