Record screen video while running script

40 visualizaciones (últimos 30 días)
Lea Bächlin
Lea Bächlin el 27 de En. de 2023
Comentada: Lea Bächlin el 1 de Jul. de 2024
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

Respuesta aceptada

Aishwarya Shukla
Aishwarya Shukla el 3 de Mzo. de 2023
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 comentarios
Eleonora
Eleonora el 1 de Jul. de 2024
Hi Lea, how did you solve this problem?
Lea Bächlin
Lea Bächlin el 1 de Jul. de 2024
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.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Image display and manipulation en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by