Stream Files to Indexes
Stream videos into an index to get real-time results
Starting a Stream
To start a stream through the SDK, use the steps below :
Create a Stream Object
Discover Available Sources
Example console output would look like the following:
Select a Source
If no source is set explicitly, index 0 is used by default.
Start Streaming
Once started, the stream will begin capturing video from the selected source functions can be run on the stream from its respective index. For example:
Best Practices
Some best practices for streaming:
- Verify devices first with
ms.sources()
— ID ordering can change between reboots. - Combine live
Stream
sessions with batchupload()
to cover both real-time and historical footage. - Keep streams short when testing (
ms.start(10)
) to conserve local and network resources. - Use
search
orinquire
during a live session to build interactive dashboards or alerts.
Stream() Constructor
Stream() Constructor
Index that receives the live feed.
Must have been created with performance=True
Stream() methods
.sources()
.sources()
Returns List[str]—the display-ready names of cameras or screens detected on your machine.
.set()
.set()
The integer ID shown by .sources()
.start()
.start()
Optional. Duration to stream in seconds.
Omit or pass None
to run until manually stopped.