In this article, we outline the functionality of the Cinegy Subtitling Service when operating in insertion mode. This mode is used when the Cinegy Playout engine generates an IP stream without any subtitle data. The Cinegy Subtitling Service encodes subtitle data taken from the subtitle file and events received from Cinegy Event Manager. Subsequently, it remuxes the incoming stream, embedding the subtitle data into it.

The following scheme illustrates which components are required to set up the subtitle insertion workflow:

insert_mode_scheme

Cinegy Subtitling Service Configuration

Following is an example of an appsettings.json file for the simple configuration of Teletext subtitles. Edit this file according to your workflow configuration:

{
  "ApplicationUrls": [
    "http://localhost:8501"
  ],
  "Logging": {
    "LogLevel": {
      "Default": "Trace",
      "Microsoft": "Warning",
      "Microsoft.Hosting.Lifetime": "Warning"
    }
  },
  "Telemetry": {
    "Enabled": false,
    "OrgId": "sandpit",
    "Tags": "dev, testchannel",
    "TelemetryServer": "https://telemetry.cinegy.com"
  },
  "Globals": {
    "LiveId": "LIVE",
    "SyncOffsetBase": 280
  },
  "SubtitleChannels": [
    {
      "Id": 0,
      "ClearInterval": 500,
      "Repositories": [
        {
          "Id": 0,
          "Language": "ENG",
          "FileSource": {
            "FileSearchPolicy": "Auto",
            "Directory": "D:\\Subtitles1"
          },
          "LiveSource": {
            "Enabled": true,
            "EndPoint": "127.0.0.1:50125",
            "VerbosityEnabled": false
          }
        }
      ],
      "Streams": [
        {
          "InputUrl": "rtp://@239.1.1.2:1234",
          "InputAdapter": "0.0.0.0",
          "InputSrtLatency": -1,
          "InputSrtPassphrase": null,
          "OutputUrl": "rtp://239.1.1.3:1234",
          "OutputAdapter": "0.0.0.0",
          "OutputBackupAdapter": null,
          "OutputSrtPassphrase": null,
          "OutputTTL": 1,
          "FrameRate": "25",
          "VideoPid": 0,
          "Encoders": [
            {
              "Type": "Teletext",
              "RepositoryId": 0,
              "SubtitlePid": 4098,
              "SyncOffset": 0,
              "Magazine": 8,
              "Page": 1
            },
          ],
          "Multiplexer": {
            "Type": "Video",
            "Mode": "Insert",
            "SyncDelayFrames": 7,
            "SyncToleranceFrames": 0
          }
        }
      ]
    }
  ]
}

Workflow Configuration

  1. Prepare the subtitles repository with SRT files. In our example, it is D:\\Subtitles1 – please ensure that your directory name includes a unique number. In the appsettings.json file it is defined in the following section:

          "Repositories": [
            {
              "Id": 0,
              "Language": "ENG",
              "FileSource": {
                "FileSearchPolicy": "Auto",
                "Directory": "D:\\Subtitles1"
              },

    Here also specify the subtitles language in the "Language" parameter.

    SRT files should have the corresponding Subtitle ID string as a part of their file name.

  2. Create a playlist and add the corresponding Subtitle ID for the items.

    Note
    The "Subtitle ID" field can only be edited if the "Metadata editing" option is enabled in the Cinegy Air Configurator. The Subtitle ID can contain alphanumerical characters.
    playlist_subtitleid
    Note
    Make sure the initial timecodes of playlist items correspond to the timecodes within subtitle files.
  3. Configure the Cinegy Playout engine. In this example, the RTP output is used:

    playout_rtp.gif

    In the appsettings.json file, input and output streams are defined in the following section:

          "Streams": [
            {
              "InputUrl": "rtp://@239.1.1.2:1234",
              "InputAdapter": "0.0.0.0",
              "InputSrtLatency": -1,
              "InputSrtPassphrase": null,
              "OutputUrl": "rtp://239.1.1.3:1234",
              "OutputAdapter": "0.0.0.0",
              "OutputBackupAdapter": null,
              "OutputSrtPassphrase": null,
              "OutputTTL": 1,
              "FrameRate": "25",
              "VideoPid": 0,
              "Encoders": [

    Then on the "Subtitle events" tab configure the events:

    subtitle_events

    The channel ID in the "Op1" field should correspond to the value defined in the following section of an appsettings.json file:

      "SubtitleChannels": [
        {
          "Id": 0,
          "ClearInterval": 500,
  4. Cinegy Event Manager needs to be configured and activated. The Cinegy Subtitling API address defines the server where the Cinegy Subtitling Service is running.

    subtitling_event_handler
  5. (Optional) Configure the viewer for the stream with subtitles; in this example, it will be Cinegy Multiviewer. In the "Input settings" tab set the MPEG-TS player mode. In the "URL" field specify the address defined in the "OutputUrl" parameter within the appsettings.json file. The "Captioning mode" parameter should be set to "Teletext":

    Multiviewer_Configurator

    In the "Output settings" tab add and enable Window Output.

    Apply the settings and launch the Cinegy Multiviewer application. The configured streams with subtitles will be displayed in the Cinegy Multiviewer window:

    Multiviewer_output