Vidinet services

Vidinet services can be registered as resources and then be used directly by Vidispine, if supported natively, or from custom JavaScript steps.

New in version 4.11.

Adding a service

Add a Vidinet service by creating a new vidinet resource. The resource document may differ for different services, so please refer to the vidinet dashboard for more information on how the service should be defined.

POST /resource/
Content-Type: application/xml

<?xml version="1.0"?>
<ResourceDocument xmlns="http://xml.vidispine.com/schema/vidispine">
  <vidinet>
    <url>http://transcoder.example.com:8888/</url>
    <endpoint>http://transcoder.example.com:8888/</endpoint>
    <type>TRANSCODER</type>
  </vidinet>
</ResourceDocument>

Vidispine checks the status of services continuously in the background. As such, if the configuration is correct you will see that the transcoder shows up as ONLINE in a few seconds.

GET /resource/VX-8
<?xml version="1.0"?>
<ResourceDocument xmlns="http://xml.vidispine.com/schema/vidispine">
  <id>VX-8</id>
  <vidinet>
    <url>http://transcoder.example.com:8888/</url>
    <endpoint>http://transcoder.example.com:8888/</endpoint>
    <type>TRANSCODER</type>
    <state>UNAUTHORIZED</state>
  </vidinet>
</ResourceDocument>

Transcoding using Vidinet

If a Vidinet TRANSCODER resource is specified when initiating an item transcode, then the transcode will be performed using that Vidinet service. For example:

POST /item/VX-74/transcode?tag=__mp4&resourceId=VX-8

The transcode job will execute as normal, but the transcode will be handed off to Vidinet instead of being sent to a local transcoder. Once this happens the state of the job will change to VIDINET_JOB, and no longer occupy a job slot, until Vidinet has completed the transcode.

Cost estimation

To retrieve the estimated cost of performing the above transcode using Vidinet, the cost API can be used. Simply prefix the path with cost/ and execute the request:

POST /cost/item/VX-74/transcode?tag=__mp4&resourceId=VX-8
<CostEstimateDocument xmlns="http://xml.vidispine.com/schema/vidispine">
  <id>dGVzdA==</id>
  <url>http://localhost:8080/API/cost/estimate/dGVzdA==</url>
</CostEstimateDocument>

The estimate may not be immediately available, in which case the estimate will be shown as pending.

GET http://localhost:8080/API/cost/estimate/dGVzdA==
<CostEstimateDocument xmlns="http://xml.vidispine.com/schema/vidispine">
  <id>dGVzdA==</id>
  <url>http://localhost:8080/API/cost/estimate/dGVzdA==</url>
  <state>PENDING</state>
  <service>
    <resource>VX-8</resource>
    <type>TRANSCODER</type>
    <state>ONLINE</state>
  </service>
</CostEstimateDocument>

Once the cost has been estimated:

GET http://localhost:8080/API/cost/estimate/dGVzdA==
<CostEstimateDocument xmlns="http://xml.vidispine.com/schema/vidispine">
  <id>dGVzdA==</id>
  <url>http://localhost:8080/API/cost/estimate/dGVzdA==</url>
  <state>FINISHED</state>
  <service>
    <resource>VX-8</resource>
    <type>TRANSCODER</type>
    <state>ONLINE</state>
    <cost unit="USD">1.2</cost>
  </service>
</CostEstimateDocument>

Quality control using Vidinet

Quality control using Vidinet services can be performed by specifying a Vidinet QC resource when starting a shape analysis job.

POST /item/VX-74/shape/VX-79/analyze?resourceId=VX-3&jobmetadata=auroraTemplate%3DQuality%20Test
Content-Type: application/xml

<AnalyzeJobDocument xmlns="http://xml.vidispine.com/schema/vidispine"/>
<JobDocument xmlns="http://xml.vidispine.com/schema/vidispine">
  <jobId>VX-345</jobId>
  <user>admin</user>
  <started>2017-09-08T14:59:49.131Z</started>
  <status>READY</status>
  <type>ANALYZE</type>
  <priority>MEDIUM</priority>
</JobDocument>

Once the job has finished, the result of the analysis can be found in the bulky metadata of the shape.

A cost estimate can be retrieved, just like for transcodes, using the cost API.

Using Vidinet services from JavaScript

Vidinet services that are not natively supported can be used from JavaScript, for example by creating a custom job with one or more steps that interact with the Vidinet service using the Vidinet JavaScript functions.

For example:

POST /task-definition/jobtype/MYCOMPANY_CUSTOM_VIDINET_JOB?id=26000
PUT  /task-definition/jobtype/MYCOMPANY_CUSTOM_VIDINET_JOB/step/100
Content-Type: application/xml

<TaskDefinitionDocument xmlns="http://xml.vidispine.com/schema/vidispine">
  <description>A custom JavaScript step</description>
  <script><![CDATA[
var item = ...;
var instruction = "...";

job.vidinetJob("TEST", instruction, {
    item: itemId
});
]]></script>
  <step>100</step>
  <dependency>
    <previous>false</previous>
    <allPrevious>true</allPrevious>
  </dependency>
  <jobType>MYCOMPANY_CUSTOM_VIDINET_JOB</jobType>
  <critical>false</critical>
</TaskDefinitionDocument>

For more information on how to execute jobs for a service in Vidinet, please refer to the Vidinet service documentation.