This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Integrate ASR output with Cavena STU

How to integrate Automatic Speech Recognition (ASR) output with Cavena STU

    Introduction

    This section will show you how to use Cavena STU as an output in the Automatic Speech Recognition (ASR) service.

    There are 2 modes of integration with Cavena STU.

    Mode 1: If the STU Subtitle Input Protocol of your STU is available on a public IP the ASR service can connect directly to the STU.

    Mode 2: If not you need to install a STU agent together with the STU that connects to the ASR service and proxies the subtitle traffic.

    Setup ASR service to connect to a STU on a public IP

    You need to configure the public IP and port where the ASR service can connect to the STU Subtitle Input Protocol. Those settings are available in our settings API which contains system-wide settings that are not unique for each channel used.

    Access the current settings with

    $ curl -i -u "<username>:<password>" https://<your-id>.asr.agilecontent.com/api/v1/settings
    

    The output have a JSON data structure similar to this

    {
      "srt_passphrase": "<SRT Passphrase>",
      "subtitle_filename": "subtitle.vtt",
      "subtitle_rotation_interval": 4,
      "stu_settings": {
        "hostname": "<Public IP of the STU>",
        "port": 4621,
        "subtitle_type": 0,
        "user_id": "test-0",
        "username": "test",
        "offset": 0,
        "remove_accents": false,
        "server_mode": false
      }
    }
    

    Put the JSON data in a file settings.json and update the following

    • Set stu_settings.hostname to the public IP of your STU
    • Update stu_settings.port if you use a non-default port
    • Update stu_settings.server_mode to false

    Now apply the new settings with the following command

    $ curl -i -u "<username>:<password>" https://<your-id>.asr.agilecontent.com/api/v1/settings -XPUT -H "Content-Type: application/json" -d @settings.json
    

    Continue to Create a channel further down to create a channel with a STU output.

    Setup ASR service to listen for connections from a STU

    Please contact your Agile Content representative for access and instructions on how to setup this mode.

    Create a channel

    To setup a channel first prepare a file mychannel.json with the following, but replace the language with the language code of your audio clip

    {
      "id": "mychannel",
      "name": "My Channel",
      "input":{
        "type":"srt",
        "port":10000
      },
      "language":"en-US",
      "outputs":[
        "stu_ip"
      ]
    }
    

    Then apply the channel configuration to the API

    $ curl -i -u "<username>:<password>" -XPOST -H "Content-Type: application/json" https://<your-id>.asr.agilecontent.com/api/v1/channels -d @mychannel.json
    

    You will receive a 200 OK response with a JSON payload similar to this

    {
      "id": "mychannel",
      "name": "My Channel",
      "enabled": true,
      "engine": "google",
      "input": {
        "type": "srt",
        "port": 10000
      },
      "language": "en-US",
      "outputs": [
        "stu_ip"
      ],
      "segmentation": {
        "rows": 2,
        "chars_per_row": 40,
        "progressive": false
      }
    }
    

    See the Getting Started guide for guidance on how to ingest audio and validate generated subtitles.