There are several ways of capturing videos with the Zantiks units. This tutorial demonstrates how to use the VIDEO_STREAM command to export multiple, separate video files, the VIDEOSKIP command to create time-lapse videos and the VIDEOSTOP command to stop a video before its assigned time. It will also explain how you can capture a still image (picture).
Command to create multiple video files within one script
There are 4 individual VIDEO STREAMS available to use in Zanscript. By assigning and 'calling out' individual VIDEO STREAMS within your script, you can allocate which type and/or portion of your experiment writes to the separate .avi files.
SET(VIDEO_STREAM,0) SET(VIDEO_STREAM,1) SET(VIDEO_STREAM,2) SET(VIDEO_STREAM,3)
SET(VIDEO_STREAM,#): commands are used in the script just prior to your video recording commands (e.g., placed before the relevant VIDEOSKIP, VIDEO(#,"name_of_video"), and VIDEOSTOP() commands). They tell the system that the assigned video stream is now active and that any of the following video commands will be referring to this active video recording file until a new video stream is set.
VIDEO_STREAM,0 is the default video stream. If you are not separating video files, it is not necessary to write this command into your scripts, as the video is recorded to this video stream by default.
If you don’t label the stream for a new video, it will default back to the last used stream.
NOTE: If one video isn’t finished and another starts on the same stream (either by command or one doesn’t set the stream) the next video will overtake the previous video.
Commands to capture video
VIDEO(#,"title_of_video"): records for the amount of time (in seconds) indicated with the number before the comma and saves the file into the Media Directory with a name labelled in the inverted commas (e.g., "title_of_video"). The time and date will follow this label in the file's name. The video file can be found in the Media Directory on the Homepage of the Control Console.
VIDEOSKIP(#): allows timelapse videos to be captured. It tells the systems to 'skip' the number of frames indicated in the parenthesis. For example, if you write VIDEOSKIP(9) it will record every 10th frame. By skipping frames, you can create a fast timelapse video across your entire experiment.
VIDEOSTOP(): this command will stop the video before it has run the full time it has been programmed to run. This command is useful particularly when the timings of an experiment can be adjusted using a DEFINE directive for your video length. You can stop a video without the need to calculate and adjust the video length each time.
NOTE: The Zantiks unit will make a series of 2Gb videos sequentially labelled once one video hits the 2Gb limit. It automatically begins a new video file recording with the same desginated time (e.g., if the video is recorded for 12 hours and video hits the 2Gb limit at 4 hours, it will continue for the next 8 hours saving a series of files). The files are labelled the same name with an added number (e.g., videofile, videofile1, videofile2, etc).
Commands to capture a picture
PICTURE("name_of_photo"): saves a still image with a name labelled in the inverted commas (e.g., "name_of_photo"). The time and date will follow this label in the file's name. The picture file can be found in the Media Directory on the Homepage of the Control Console.
Full example script
ACTION MAIN # Start a normal recording VIDEO(30,"video_1") # Capture a still image file PICTURE("name_of_photo") # Start a timelapse recording on another stream SET(VIDEO_STREAM,1) VIDEOSKIP(9) VIDEO(30,"video_2") WAIT(5) # Start 2 recordings at the same time SET(VIDEO_STREAM,2) VIDEO(30,"video_3") SET(VIDEO_STREAM,3) VIDEO(15,"video_4") WAIT(5) # Stop one of the streams SET(VIDEO_STREAM,2) VIDEOSTOP() WAIT(20) COMPLETE
# Start a normal recording VIDEO(30,"video_1")
Without a VIDEO_STREAM set, these two commands start recording a video to the default stream (VIDEO_STREAM,0). The video will be recorded for 30 seconds and saved to the Media directory under the name video_1.
# Capture a still image file PICTURE("name_of_photo")
A still image will be captured of the current view of the experiment at the point the picture command is placed in the script.
# Start a timelapse recording on another stream SET(VIDEO_STREAM,1) VIDEOSKIP(9) VIDEO(30,"video_2") WAIT(5)
SET(VIDEO_STREAM,1) sets a second video stream to record a timelapse video. This video will record every 10th frame for 30 seconds and is saved to the Media directory under the name video_2. The system then waits 5 seconds before moving on to the next command.
# Start 2 recordings at the same time SET(VIDEO_STREAM,2) VIDEO(30,"video_3") SET(VIDEO_STREAM,3) VIDEO(15,"video_4") WAIT(5)
Two videos are started at the same time, recording through two separate VIDEO_STREAM commands. A 30 second video named video_3 is recorded to VIDEO_STREAM, 2 and a 15 second video named video_4 is recorded to VIDEO_STREAM,3. The system then waits 5 seconds before moving on to the next command.
# Stop one of the streams SET(VIDEO_STREAM,2) VIDEOSTOP() WAIT(20)
The video recording to VIDEO_STREAM,2 is being stopped before reaching the designated time written into the previous VIDEO(30,"video_3") command. The VIDEO_STREAM is called up using the SET(VIDEO_STREAM,2) command and the VIDEOSTOP() command terminates the recording. The script then continues running to another 20 seconds, as set in the WAIT(20) command allowing the other videos to finish. The other videos will stop at the end of the script.
To download the video_picture_files demo script as a .zs file (file type Zantiks software reads), choose the Save File As option in the right-click dialogue box. Clicking on the script name hyperlink will open a read-only version of the script.
Script download: video_picture_files.zs