Import hosted media
This tutorial will show you how to import media from a URL using tator-py. Importing hosted media has advantages over uploading local media in that it skips the upload step, saving on time, bandwidth, and backend storage space. We assume you have a project with a video type definition.
Import hosted media
Hosted media can easily be imported using a utility in tator-py called import_media
. The function is similar to uploading from local files using upload_media
, except it immediately returns only a response instead of a generator as there is no upload progress to report. The tutorial on local uploads discusses how to find a media type ID and how to poll for transcode completion.
import tator
api = tator.get_api(host='https://cloud.tator.io', token=MY_TOKEN)
response = tator.util.import_media(api, VIDEO_TYPE_ID, MEDIA_URL)
print(response.message)