Allocate video-worker to Video Stream Source

In a distributed architecture, it is often necessary that video streams be processed in situ, without being redistributed across remote video-worker instances by the principal server.

Note

Among typical use cases are hotel chains, chain stores, several security checkpoints in the same building, etc.

In this case, allocate the local video-worker to the video stream source.

There are two ways to specify allocation labels:

  • by video-worker.yaml configuration file

  • by environment variable or flag.

Note

Use the same name of labels in the video-worker configuration file and in the video processing job, otherwise video stream source will not process.

Do the following:

  1. Open the /opt/ffserver/configs/video-worker.yaml configuration file and specify the allocation labels in the dictionary format (label district in the example below).

    sudo vi /opt/ffserver/configs/video-worker.yaml
    
    labels: {"district": "SVAO"}
    
  2. As an alternative way, you can use environment variable CFG_LABELS or --labels flag when running video-worker with docker run command:

    CFG_LABELS=district=SVAO
    
  3. Create a video processing job with labels.

    "labels": {
          "district": "SVAO"
        },
    

Note

If a video stream source is assigned an allocation label, its video stream can be processed by a video-worker instance with the same label, as well as by all unlabeled video-worker instances.

Warning

If a labeled video stream source is processed by an unlabeled video-worker instance and a free similar-labeled instance appears, the video stream source won’t automatically switch to the latter. Restart the similar-labeled video stream source.