You are here

Video recorder example

The first example, called "VidRecord", may be used to capture live video from an all sky camera and periodically save an image or record to a video file. This relatively simple example is developed for GNU C++ on Ubuntu, Visual C++ on Microsoft Windows, and Python which will run on both MS Windows and Ubuntu. On my machine the Python example records video at 15 fps. The C++ versions running on Ubuntu and MS Windows records at 30 fps.

File names of the recorded video or images are created using current date/time in GMT when file is created.

Command line arguments:

-dis=[True|False] : Whether or not to display video frame from device on your computer screen (default is True)
-viddev=n : Select video device (default is 0, usually 0, 1, or 2)
-viddir=XXX: Set directory to store videos (default is the Videos directory in the user's home directory $HOME/Videos )
-vidint=n : Length of a video in seconds (default is 60)
-vidnum=n : Number of videos to be recorded (default is 0)
-codec=XXXX : Video codec to use when recording (default is DIVX)
-imgint=n : Interval for saving image a file in seconds (default is 60)
-imgfmt=[jpg,png,tif] : Image format to save interval image (default is jpg)
-imgdir=XXX: Set directory to store images ( defalt is Pictures direcotry in the user's home directory, $HOME/Pictures)
-imgnum=n : Number of images to be recorded (default is 0)

The user may view current video frames by adding -dis=True to the command line. Video recording is started by clicking on the display frame and pressing the 'r' key. To stop recording press 'r' again. To capture an image press the 'i' key and 'i' again to stop image capture.

Command line examples:
Record videos from video device 1 without a display, each 20 seconds long for 2 hours
VidRecord -dis=False -viddev=1 -vidint=20 vidnum=360

Capture a picure every 30 seconds from video device 2 for 1 hour
VidRecord -viddev=2 imgint=30 imglen=120

Above params may also be set in a config file called ".vidrecordrc" located in you home directory.
One parameter setting per line in the form NAME=VALUE, you may add comments by starting a line with '#'
For example...

# ----------
# Disable display of video frames on the screen
dis=False
# Capture 20 images
imgnum=20
# Capture an image each 30 second time interval
imgint=30
# Save the image in the PNG format
imgfmt=png
# ----------

Command line arguments override those loaded from the config file.