Video picture demo


This demo script demonstrates how you can capture an image (picture) and a video during a model organism behavioural assay run in a Zantiks unit.

You may use the video and picture commands any number of times during your experiment, however there are a few caveats:

  • The maximum length of a video is one hour (3,600 seconds).
  • You can program the unit to take more than one video during an experiment, however bear in mind that there is a limit on how much storage is on the unit so it won't be able to store too many long videos.
  • You can only take one video at a time. If you start a video, you can only begin a second video recording after the first recording has finished.
  • Users who want a video record of their experiment often program multiple videos, for a short period, at different stages throughout it.

Please note that there are some extra features included in software releases post January 2019, if your unit is running a software version that is older than this read the note ** at the end of this webpage.

Top

Video Tutorial

Illustrating what code to include in a zanscript so that your service takes a video recording and a photo during the experiment.

How to write a script which takes a video recording and a photo

Top

Full script

This script demonstrates how you can take a photo and record videos during an experiment.

INCLUDE zsys
DEFINE VIDEO_TIME 10
DEFINE INTERRUPT_TIME 5
DEFINE BETWEEN_VIDEO_TIME 8
 
ACTION MAIN 
 INVOKE(TAKE_A_PHOTO,1)
 INVOKE(VIDEO_EXAMPLES,1) 
COMPLETE
 
ACTION TAKE_A_PHOTO 
 PICTURE("photo_arena") 
COMPLETE
 
ACTION VIDEO_EXAMPLES 
 VIDEO(VIDEO_TIME,"video_long")
 WAIT(VIDEO_TIME)
 WAIT(BETWEEN_VIDEO_TIME)
 
 VIDEO(VIDEO_TIME,"video_short")
 WAIT(INTERRUPT_TIME)
 VideoStop(1)
 WAIT(BETWEEN_VIDEO_TIME)
 
 VIDEO(VIDEO_TIME,"video_ended")
 WAIT(INTERRUPT_TIME)
COMPLETE
Top

Script explanation

You can start a video at any time during a script, it will run for the time set in the VIDEO command, unless the video is stopped by a VideoStop command or the service finishes before its set time has completed.

INCLUDE zsys
DEFINE VIDEO_TIME 10
DEFINE INTERRUPT_TIME 5
DEFINE BETWEEN_VIDEO_TIME 8
  • INCLUDE zsys in every script
  • The three DEFINE commands detail the time in seconds for the terms VIDEO_TIME, INTERRUPT_TIME and BETWEEN_VIDEO_TIME, where they are used later in the script.
ACTION MAIN 
 INVOKE(TAKE_A_PHOTO,1)
 INVOKE(VIDEO_EXAMPLES,1)
COMPLETE
  • ACTION MAIN details the whole experiment's outline - two ACTIONS are invoked, one time each: ACTION TAKE_A_PHOTO followed by ACTION VIDEO_EXAMPLES
ACTION TAKE_A_PHOTO
 PICTURE("photo_arena")
COMPLETE
  • In this Action the camera takes a photo of the arena, which will be called "photo_arena" and will be saved in the unit's Media directory.
ACTION VIDEO_EXAMPLES
 VIDEO(VIDEO_TIME,"video_long")
 WAIT(VIDEO_TIME)
 WAIT(BETWEEN_VIDEO_TIME)
  • At the beginning of the Action the first video is taken which will be the length in seconds as detailed by DEFINE VIDEO_TIME above (i.e. 10 seconds), the unit will wait this time (during which the video will record).
  • The unit will then wait for a further period, the number of seconds as defined above for BETWEEN_VIDEO_TIME.
 VIDEO(VIDEO_TIME,"video_short")
 WAIT(INTERRUPT_TIME)
 VideoStop(1)
 WAIT(BETWEEN_VIDEO_TIME)
  • The second video is set to be taken for 10 seconds (as defined by VIDEO_TIME).
  • The video will be called "video_short" and saved into the unit's Media directory.
  • After a wait time of 5 seconds (as defined by INTERRUPT_TIME) the command VideoStop will stop the video, effectively interrupting the video recording as originally set to run for 10 seconds.
  • The unit will then wait for a period (BETWEEN_VIDEO_TIME).
 VIDEO(VIDEO_TIME,"video_ended")
 WAIT(INTERRUPT_TIME)
COMPLETE
  • The third video will start recording, set to record for 10 seconds (as defined by VIDEO_TIME).
  • The video will be called "video_ended" and saved into the unit's Media directory.
  • The unit will then wait for 5 seconds (as defined by INTERRUPT_TIME), and the Action will complete, and as this is the end of the service, the experiment and the video recording will stop, effectively stopping the video earlier than it was set to run.
Top

Script download

Here you can download the video picture demo. Right click on the download link below and download / save the file as a zanscript file, i.e. in the same format: video_picture_demo.zs .

Script download: video_picture_demo.zs

Top

Run the demo service

Build as a service - Copy and paste the demo script into the unit's Zanscript directory. Once you are happy with the script, click on Build so that you create a service (.zex file) which will automatically save in the Services directory. Go to the Settings page and save the service in one of the 20 slots a service - in this instance write video_picture_demo in a slot and click on Set.

Run the demo service - The experiment can now be operated from the home page. In the following video example the demo script was run with 1 fake fish.


** Please note that there are some extra features included in software releases post January 2019, if your unit is running a software version that is older than this:

  • Make sure that when you record a video, the length of the video (in seconds) is shorter that the time programmed to run after the video command.
  • The VideoStop command will not work.
  • If the script finishes before the video has finished recording, the video will continue to record until programmed, unless you switch the unit off. Please note, this could impact on a new service that you run.
  • Or email info@zantiks.com to ask for a software update so that you can program a video to stop earlier than it is commanded to run (as illustrated in the demo script below).