Reposted, as the original poster wanted all his personal information removed.
Which is kinda ok. However we do ask you to leave your name and affiliation when writing posts (see the "How to use the forum" instructions). Anonymous posts usually reduce at least my motivation to answer at all (especially when i'm busy) to basically zero. It's not fun to spend one's own time writing into a void.
-mario
How do i write captured video data to a movie file on disc?
It goes like this:
% Create a new movie file, image size 512x512, 60 frames per second:
movie = Screen('CreateMovie', windowPtr, 'MyTestMovie.mov', 512, 512,
60);
In your loop you add new frames to the movie:
Screen('AddFrameToMovie', frame);
'frame' can be a Psychtoolbox window handle (for screenshots), an
offscreen window handle or any texture handle, so you're quite flexible.
E.g. above you'd do the following instead of the "figure, imshow(im)":
% Convert 'im' image matrix to ptb texture:
frame = Screen('MakeTexture', windowPtr, im);
% Add texture to movie:
Screen('AddFrameToMovie', frame);
% Dispose texture:
Screen('Close', frame);
At the end you close the file with
Screen('FinalizeMovie', movie);
If you'd use ptb's builtin video capture engine on Windows, you could
directly add video frames as provided by frame = Screen
('GetCapturedImage',...), this would be more efficient.
On OS/X you wouldn't need this at all. You could just directly set
the optional parameters for video recording in the Screen
('OpenVideocapture', ...); command (see its help) and it would
automatically record a movie, optionally with sound.
The whole thing is demonstrated in ImagingStereoDemo if you set the
optional 'writeMovie' flag to 1 and follow the code.
Which is kinda ok. However we do ask you to leave your name and affiliation when writing posts (see the "How to use the forum" instructions). Anonymous posts usually reduce at least my motivation to answer at all (especially when i'm busy) to basically zero. It's not fun to spend one's own time writing into a void.
-mario
How do i write captured video data to a movie file on disc?
It goes like this:
% Create a new movie file, image size 512x512, 60 frames per second:
movie = Screen('CreateMovie', windowPtr, 'MyTestMovie.mov', 512, 512,
60);
In your loop you add new frames to the movie:
Screen('AddFrameToMovie', frame);
'frame' can be a Psychtoolbox window handle (for screenshots), an
offscreen window handle or any texture handle, so you're quite flexible.
E.g. above you'd do the following instead of the "figure, imshow(im)":
% Convert 'im' image matrix to ptb texture:
frame = Screen('MakeTexture', windowPtr, im);
% Add texture to movie:
Screen('AddFrameToMovie', frame);
% Dispose texture:
Screen('Close', frame);
At the end you close the file with
Screen('FinalizeMovie', movie);
If you'd use ptb's builtin video capture engine on Windows, you could
directly add video frames as provided by frame = Screen
('GetCapturedImage',...), this would be more efficient.
On OS/X you wouldn't need this at all. You could just directly set
the optional parameters for video recording in the Screen
('OpenVideocapture', ...); command (see its help) and it would
automatically record a movie, optionally with sound.
The whole thing is demonstrated in ImagingStereoDemo if you set the
optional 'writeMovie' flag to 1 and follow the code.