Skip to main content

Create multi-stream videos

With multi-stream videos, Tator allows playback and annotation on multiple videos in an integrated view. This is useful for data acquisition setups like stereoscopic cameras or multiple synchronized IP cameras. This tutorial will demonstrate how to convert two videos into a single multi-stream video using tator-py. To get started, you will need to upload two videos to a project that can be used to create a multi-stream video, which you can do by following the media upload tutorial.

The videos used for screenshots in this tutorial are courtesy of the Mobile Robot Programming Toolkit.

Create multi-stream media type

To create a multi-stream video, a media type must be defined with dtype equal to multi:

import tator
api = tator.get_api(host='https://cloud.tator.io', token=MY_TOKEN)
spec = {'name': 'My Multi-stream Videos',
'description': 'Multi-stream demo videos.',
'dtype': 'multi'}
response = api.create_media_type(PROJECT_ID, media_type_spec=spec)
print(response.message)
multi_type = response.id

Get video IDs

Make sure you have the video IDs of the videos that will be combined into a multi-stream video. This can be found in the annotation view:

Create multi-stream video

Now that we have a multi-stream media type and the ID of each individual video, we can create the multi-stream video using the tator-py utility make_multi_stream. We must provide the layout, media name, and section name. The layout parameter tells the player how to tile the videos.

layout = [2, 1] # How to tile the videos [rows, columns]
name = '2009_09_08_drive_0010'
section = 'Multi videos'
response = tator.util.make_multi_stream(api, multi_type, layout, name,
[VIDEO_ID_1, VIDEO_ID_2], section)
print(response.message)

Now in the project detail view a thumbnail showing the multi-stream video will be displayed. Just like a single stream video, rolling over the media card will display a gif.

Clicking on the media card will show the multi-stream video, ready for synchronized playback and annotation.