Skip to main content

Processing Video Files

Process a Single Video#

To run Stream on a video file (e.g. mp4), specify the video filename.

  1. Make sure that the video file is stored within the Stream folder.
  2. For example, with the Stream directory c:\stream and the file c:\stream\Videos\my_video.mp4
  3. Use url = /user-data/Videos/my_video.mp4

File Upload API#

To turn it on, use url = file-upload. Run the container with -p 8081:80. Now you can send a video with curl -F '[email protected]/path/to/car.avi' http://localhost:8081.

The endpoint accepts an optional mask_id parameter. It can be used to override the detection zone mask. By default, Stream looks for a detection zone named camera_id. When mask_id is present, Stream looks for a detection zone named mask_id.

Here's an example. In config.ini I have a camera-1 with url = file-upload. By default the detection zone camera-1 will be used. If I want to use camera-2 instead, I do curl -F '[email protected]/path/to/car.avi' -F mask_id=camera-2 http://localhost:8081. Before starting Stream, your Stream folder should have zone-camera-2.png in it. That file can be created and downloaded from Detection Zones.

Process an Entire Folder of Videos#

The API above can be used to process all the videos in a folder. This Python script takes as input a folder and processes all the files in it. Windows users can also use this executable.

 python -f /path/to/folder -s http://localhost:8081