Record screen video while running script

조회 수: 40 (최근 30일)
Lea Bächlin
Lea Bächlin 2023년 1월 27일
댓글: Lea Bächlin 2024년 7월 1일
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
Eleonora
Eleonora 2024년 7월 1일
Hi Lea, how did you solve this problem?
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