Docs @ Psychtoolbox Wiki : VideoRecordingDemo

Search PTB Function help:
homepsychtoolbox.orgpage updateslogin

VideoRecordingDemo

PsychtoolboxPsychDemos

VideoRecordingDemo(moviename [, codec=0] [, withsound=1] [, showit=1] [, windowed=1])

Demonstrates simple video capture and recording to a movie file.

Currently uses Quicktime on OS/X and GStreamer on Linux and Windows.

The demo starts the videocapture engine, recording video from the default
video source and (optionally) sound from the default audio source. It
encodes the video+audio data with the selected 'codec' and writes it to the
'moviename' movie file. Optionally it previews the recorded
video onscreen (often at a much lower framerate to keep system load low
enough for reliable recording). Recording ends if any key is pressed on
the keyboard.

Arguments and their meaning:


'moviename' name of output movie file. The file must not exist at start
of recording, otherwise it is overwritten.

'codec' an (optional) number, indicating the type of video codec you want to use.
Defaults to "whatever the system default is". Valid settings are between
0 and 10 on OS/X. Some codecs are very fast, i.e., high framerates and low system
load, others provide high compression rates, i.e., small video files at
good quality. Usually there's a tradeoff between encoding speed, quality
and compression ratio, so you'll have to try out different ones to find
one suitable for your purpose. Some codecs only work at specific
framerates or for specific image sizes. If you set the level of verbosity
of PTB on OS/X to at least 4, it will print out a list of supported codecs on
your system (Screen('Preference', 'Verbosity', 4)).
Without Quicktime-Pro on OS/X, you'll usually only have a very limited set of
codecs available - often only the default codec, so purchase of a
Quicktime-Pro license key is a good investment if you want to do serious
recording work. Or you use the GStreamer video capture engine on Windows or
Linux for free access to many codecs.

Codecs supported by this demo on OS/X: 0 = Default, 1 = H.264, 2 = Apple Pixlet,
3 = MPEG-4, 4 = Component video, 5 = DV-PAL, 6 = DVCPRO-NTSC, 7 =
DVCPRO-PAL, 8 = DVCPRO50-NTSC, 9 = DVCPRO50-PAL, 10 = H.263

The supported codecs and settings for Linux and Windows with GStreamer
can be found in the code and are explained in 'help VideoRecording'.

Empirically, the MPEG-4 codec (codec=3) seems to provide a good tradeoff
between quality, compression, speed and cpu load. It allows to reliably
record drop-free sound and video with a resolution of 640x480 pixels at
30 frames per second. Quality is good enough for most purposes, and cpu
load on a MacBookPro is only about 33% without preview and 50% with
preview.

H.264 has better quality and higher compression, but is able to nearly
saturate a MacBookPro, so reliable recording at 30 fps may be difficult
to achieve or needs more powerful machines.

Some of the other codecs may provide the highest image quality and lowest
cpu load, but they also produce huge files, e.g., all the DVxxx codecs
for PAL and NTSC video capture, as well as the component video codecs.

'withsound' If set to non-zero, sound will be recorded as well. This is
the default.

'showit' If non-zero, video will be shown onscreen during recording
(default: Show it). Not showing the video during recording will
significantly reduce system load, so this may help to sustain a skip free
recording on lower end machines.

'windowed' If set to non-zero, show captured video in a window located at
the top-left corner of the screen, instead of fullscreen. Windowed
display is the default.





Path   Retrieve current version of VideoRecordingDemo.m from berliOS: beta | view WebSVN changelog of trunk branch
Psychtoolbox/PsychDemos/VideoRecordingDemo.m


Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki
Page was generated in 0.0825 seconds