A screenRecorder element captures/records part or all of the experiment window. Choose one of three options by setting one of properties saveImage (capture to a single image), saveImages (capture to a sequence of images), or saveMovie (capture to a movie) = <cd>true<cd>. Use properties start/end to set when capture starts and ends.

Technical details: Captures from the video draw buffer using Psychtoolbox Screen('CopyWindow') or ('CreateMovie'). Writes files in the inter-trial interval after the trial.

For any trial you define in an experiment script, you can make one or more 


 objects using function 


Object and input them to addTrial.

For any trial you define in an experiment script, you can make one or more 


 objects using function 


Object and input them to addTrial.

Input properties

Adjustable properties

You can allow the subject to adjust the following input properties of an object of this type during the experiment using an adjuster element. If you need to make other properties adjustable, you can copy the element type using newPbType and edit it.





No default

Set one of these = <cd>true<cd> and leave the rest at default <cd>false<cd>. For image(s) you can use a format like .png if you want lossless capture.

saveImage = <cd>true<cd>: Capture the display when the screen recorder starts to a single image file. The screen recorder will then end on its own, so you don't need to set property end.

saveImages = <cd>true<cd>: Capture a dynamic display to a sequence of image files. Note this option is limited by your system's memory since all the images are stored in memory and the files are only written at end of trial. So, if you capture a long duration it's possible to run out of memory.

saveMovie = <cd>true<cd>: Record a dynamic display to a movie file. This doesn't have the same memory limitation as saveImages but all movie formats apply image compression.


No default: fileName
Default: numberFile = automatically number files
Default: minNumDigitsInFileName = 1

fileName is a string setting name of image or movie file(s) to write. If you include a path, it will save there, and make the folder if it doesn't exist. If you don't, it will save in the MATLAB current folder. Specify file format by the extension you give the file name. The file can be any format MATLAB imwrite or Psychtoolbox CreateMovie understands (e.g. .png, .jpeg; .avi, .mov, etc.). For movie files, you can set further codec options in movieOptions below if needed.

numberFile = <cd>true<cd>/<cd>false<cd>: If = <cd>true<cd> (default), PsychBench automatically adds a number to file name starting at 1, then incrementing to not overwrite any existing files. This means if you have multiple screenRecorder elements in an experiment, you can set fileName the same for all of them (e.g. image.png) and they will write different files numbered in the order they run (e.g. image1.png, image2.png, image3.png, ...). NOTE: If you set numberFile = <cd>false<cd> then the element will not add a number and will overwrite any existing file with the specified name. numberFile only affects single image capture and movie recording. For multiple image capture, the screen recorder always numbers the files.

minNumDigitsInFileName sets the minimum number of digits to use for numbering files. e.g. 3 → image001.png, image002.png, image003.png, ...

See also record properties fileName_r, n_file below.


Default: capture whole window

size: A 1×2 vector [width height] setting size of the area on screen to capture (deg). The area will be centered at screen recorder position, which you can set in position (default window center). Or the single number <cd>inf<cd> = whole window.


Default: 30 frames/sec

Frame rate to capture multiple images or a movie at. Note actual frame rate achieved is limited by frame rate during the element, which nominally = screen refresh rate but can be lower if frames are dropped—see Timing precision.


Default: none

For movie recording only: A string that goes to input movieOptions of Psychtoolbox Screen('CreateMovie') setting advanced options. See help text there and help VideoRecording for usage.

Input properties all visual elements have


Input properties all adjuster elements have


Input properties all objects have


Record properties

PsychBench uses record properties to record information during experiments. You can't set record properties but you can see them in experiment results using input property report.


fileName_r is a string recording the file name written to. This includes the number added if numberFile = <cd>true<cd> or capturing multiple images.

n_file records the number added (numeric) if numberFile = <cd>true<cd> or capturing multiple images.

For multiple image capture, these properties record information for the first image written by the screen recorder.