Macro Builder

Script builder for time lapse recording.

Scripting


Macro Builder for programming complex recording sessions.

More examples below.

Scripting in StreamPix can be as simple or complex as you want. Understanding how it works will grant you an almost infinite flexibility in your recording session. So what is this scripting thing? Well, scripting is the description of the behavior of StreamPix during a recording. It is useful when you don't want to capture at full frame rate for the entire recording length. If you only want to capture at full frame rate, simply disable scripting using the check box at the top of the window.

A script can be formed of one or more script actions that will be read and interpreted sequentially. There are four script actions : GrabFrame, SkipFrame, GrabTime and SleepTime. Each action accepts only a single parameter. (By the way, each action must have an ";" appended to it as a separator).

  • GrabFrame(X); will tell StreamPix to grab the next X frames to come from the camera.
  • SkipFrame(X); will tell StreamPix to ignore the next X frames to come from the camera.
  • GrabTime(X); will tell StreamPix to grab all frames coming from the camera for the next X ms.
  • SleepTime(X); will tell StreamPix to ignore all frames coming from the camera for the next X ms.

Here is an example. Suppose the current script is:

GrabTime(1000);
SleepTime(2000);
GrabTime(2000);
SkipFrame(10);
GrabFrame(5);

Here is what would be done :

  • For the first second of the recording, every frame received would be saved.
  • Then, for the next 2 seconds, nothing would be done. Frames received would be displayed then discarded without saving them.
  • Once the 2 seconds of inactivity are done with, we will save every frame received for the next 2 seconds.
  • We would then wait for 10 frames to have been sent by the camera. Those 10 frames will be displayed, then discarded without saving them.
  • Finally, 5 frames would be received and saved, then the script would end.

Now that we have seen what a script is made of, let's see how we can use it. The script can be used in three different ways. The first, and most common, is to loop the script continuously as long as we are recording. So when the last action of the script is done, the script will be restarted and the first action will be launched. A good example is when you want to capture at half the frame rate (only save 1 frame every 2).

Your script would be:

GrabFrame(1);
SkipFrame(1);

and because the control mode is set to continuous, StreamPix would do:

GrabFrame(1);
SkipFrame(1);
GrabFrame(1);
SkipFrame(1);
GrabFrame(1);
SkipFrame(1);
...

for the duration of the recording. In fact, when you disable recording, a script is still used without your knowledge. The script is GrabFrame(1); and the control mode is set to continuous.

Now on to something completely different. Let's say you want to capture one minute every hour. How would you do it? You would use the second control method (time controlled).

So your script would be: GrabTime(60000); (60 sec * 1000 ms/sec)

And, you would set a control time of 01:00:00.00. So each hour, the script would be restarted and one minute worth of images would be saved. In this mode (as opposed to the continuous mode), the script is not automatically looped when it reaches its end. It will simply sit there, waiting to be restarted. By the way, if the previous script has not finished it's execution when the time limit is reached, it is aborted and restarted immediately.

Finally, the last control mode (frame controlled), works the same way as the second mode except that it is based on the number of frames to be received from the camera instead of a length of time. So go ahead and experiment. If you have a particularly complex script to build or need help on scripting, send your hardest questions to .

More Examples:
  1. Continued recording mode followed by interval. User wants to specify number of frames to be recorded followed by no of frames of no recording.
    • Go to StreamPix settings, scripting tab, click "Enable Scripting".
    • Write

      GrabFrame(3);
      SkipFrame(4);
    • You can use the GrabFrame(X) and SkipFrame(X) buttons or type the commands as they appear in this note. Don't forget to insert the ";" at the end of each line.
    • In the Scipt control section, select "Loop the script continuously".
    • End result of this script would be : Grab-Grab-Grab-Skip-Skip-Skip-Skip-Grab-Grab-Grab-Skip-Skip-Skip-Skip-Grab-etc...
    • You may change the GrabFrame and SkipFrame numbers to fit your needs.
  2. In this example, we want to grab the first 1000 frames, then wait 500 ms, then grab 2000 frames, then skip the next 150 incoming frames and finally grab all frames for 1000ms.

    The script would be.

    GrabFrame (1000);
    SleepTime (500);
    GrabFrame (2000);
    SkipFrame (250);
    GrabTime (1000);

For further information or a quote: