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

Demonstrates simple video capture and recording to a movie file.

Supports [GStreamer](GStreamer) on all systems, and DC1394 engine on Linux and OSX.

Please look at the source code of the demo carefully! Both MacOSX and
MS-Windows often need special treatment in terms of codec and parameter
selection to work reliably (or to be honest: To work at all).

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’ Indicate the type of video codec you want to use.
Defaults to “whatever the system default is”. 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.

The supported codecs and settings with [GStreamer](GStreamer) can be found in the code
and are explained in ‘help VideoRecording’.

Empirically, the MPEG-4 or H264 codecs seem to provide a good tradeoff
between quality, compression, speed and cpu load. They allow to reliably
record drop-free sound and video with a resolution of 640x480 pixels at
30 frames per second.

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 from GitHub | View changelog