Record screen video while running script

40 次查看(过去 30 天)
Hi!
I would like to record a video of my screen while running a psychtoolbox script (DriftDemo6). Is this possible? I tried with the Mac screen recorder, but it breaks the psychtoolbox script.
Thank you!
Lea

采纳的回答

Aishwarya Shukla
Aishwarya Shukla 2023-3-3
Hi @Lea,
Yes, it is possible to record a video of your screen while running a psychtoolbox script.
One way is to use the built-in screen recording function of Psychtoolbox. You can do this by modifying your script to include the "PsychRecordScreen" function, which will start recording your screen while the script is running. However, keep in mind that this method may impact the performance of the script, especially if you're recording at a high resolution or frame rate.
Here's an example of how to use Psychtoolbox's screen recording function in your script:
% Initialize Psychtoolbox
PsychDefaultSetup(2);
Screen('Preference', 'SkipSyncTests', 1);
% Open a window
[win, winRect] = PsychImaging('OpenWindow', 0, [], [], [], [], 0);
% Start recording the screen
PsychRecordScreen('Start', 0, 'video.mp4');
% Run your script here
DriftDemo6;
% Stop recording
PsychRecordScreen('Stop');
% Close the window
sca;
In this example, the "PsychRecordScreen" function is used to start and stop recording the screen, with the resulting video saved to a file called "video.mp4". You can adjust the parameters of this function, such as the frame rate and compression level, to optimize the recording for your needs.
Another option is to record your screen without interfering with the script is to use a third-party screen recording software, such as OBS Studio or Camtasia. These tools allow you to customize your recording settings, such as the frame rate and resolution, which can help optimize the recording without impacting the script's performance.
  3 个评论
Lea Bächlin
Lea Bächlin 2024-7-1
Hi! I didn't make a video, in the end I chose to directly generate the "video sequence" each time I want to display it.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Image display and manipulation 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by