There are several ways of capturing videos with the Zantiks units. This tutorial demonstrates how to make a video, 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).
Capture a video
The following line of code is required to make a video.
VIDEO(#,"title_of_video")
The VIDEO(#,"title_of_video") command will start a video and record for the amount of time (in seconds) indicated with the number (#) before the comma. The video file is then saved 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.
VIDEOSTOP()
The VIDEOSTOP() command can be used to stop the video before it has run the full time thats has been set in the VIDEO command. This command is useful particularly when the timings of an experiment are likely to be adjusted or differ based on conditional commands. By putting a DEFINE command as the video length with a long video time and then using the VIDEOSTOP command, negates the need to calculate and adjust the video length each time within the VIDEO command.
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).
Make a timelapse video
For long experiments or to save on memory space within the system. It is possible to make smaller video files using the timelapse feature with the following code.
VIDEOSKIP(#)
The VIDEOSKIP(#) function is written after the VIDEO command. The number in brackets determines the number of frames to skip. For example, if you write VIDEOSKIP(9) it will record every 10th frame. The standard frame rate for recording and tracking is 30fps. VIDEOSKIP(29) will record every 30th frame i.e. 1 frame per second.
Create multiple video files within one script
There are 3 individual VIDEO STREAMS that can be used to make videos 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,#): commands are used in the script just prior to your video recording commands i.e. they are placed before the relevant VIDEO(#,"name_of_video"), VIDEOSKIP, 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 automatically.
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.
Make a video without overlay
While it is possible to turn off tracking markers and track traces within a Zanscript, it is advised to keep the track overlay to quickly scan through experiments to check for errors or to check no tracking errors have developed during an experiment. However, if a video recording without any overlay is required, the following code can be used:
SET(VIDEO_STREAM,3) VIDEO(#,"title_of_video_no_overlay")
The (VIDEO_STREAM,3) will automatically not include any overlay at all. That includes, video labels, target markers and track traces. This feature is useful if you want to use the video in other softwares or to use the Zantiks software to track from video post experiment for re-analysis. This function can be used alongside video streams 0-2.
Commands to capture a picture
PICTURE("name_of_photo")
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)
VIDEO(30,"video_2")
VIDEOSKIP(9)
WAIT(5)
# Start a recording with no overlay
SET(VIDEO_STREAM,3)
VIDEO(15,"video_4_no_overlay")
WAIT(5)
# Stop one of the streams prematurely
SET(VIDEO_STREAM,1)
VIDEOSTOP()
WAIT(20)
COMPLETE
Script explanation
# 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) VIDEO(30,"video_2") VIDEOSKIP(9) 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 a recording with no overlay SET(VIDEO_STREAM,3) VIDEO(15,"video_4_no_overlay") WAIT(5)
Starts recording a video with no overlay. started at the same time, recording through two separate VIDEO_STREAM commands. records a 15 second video named video_4_no_overlay 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,1) VIDEOSTOP() WAIT(20)
The video recording to VIDEO_STREAM,1 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,1) 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.
Script download
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