Skip to main content

Local transcodes

When videos are uploaded to Tator either through the web interface or through tator-py, an Argo Workflow is created that performs the transcode. This is desirable in cloud environments where developers need high scalability. In some cases, such as very large imports where cloud resources could be expensive, it is preferable to rely on local hardware resources. This is possible using the transcode submodule within tator-py.

Do a local transcode on a file

A local transcode can be performed using a module call as follows:

python3 -m tator.transcode /path/to/video \
--host 'https://cloud.tator.io' \
--token $MY_TOKEN \
--project $PROJECT_ID \
--type $VIDEO_TYPE \
--section "My folder"
caution

Be sure you have installed the optional dependencies for tator-py, including FFmpeg and Bento4, as described in the tutorial!

This will use as many CPUs as are available on the node where it is invoked.

Do a local transcode on a directory

If the path given is a directory, it will be traversed recursively. Use the --extension if non-video files are also present in the directory.

python3 -m tator.transcode /path/to/video/directory \
--extension mov
--host 'https://cloud.tator.io' \
--token $MY_TOKEN \
--project $PROJECT_ID \
--type $VIDEO_TYPE \
--section "My folder"

Specify a working directory

By default the script will use the directory where the files are located as a working area for transcoding before the transcoded files are uploaded to Tator. This may be undesirable; for example, an external hard drive that is full may be storing the files to be transcoded. To specify a separate working directory, use --work_dir:

python3 -m tator.transcode /path/to/video/or/directory \
--host 'https://cloud.tator.io' \
--token $MY_TOKEN \
--project $PROJECT_ID \
--type $VIDEO_TYPE \
--section "My folder" \
--work_dir /path/to/working/directory