Captions and Subtitles

Transform has extensive support for captions and subtitles. Captions and subtitles both represent timed text but differ in the following way:

  • Captions are carried as metadata attached to the samples in a video stream.
  • Subtitles are carried in a separate stream independent of the video or audio.

Subtitle Formats

Transform supports the following subtitle Format identifiers:

FormatDescription
c890Cavena 890 Subtitle Format
dvbsDVB Subtitles
dvbtDVB Teletext
idcpInterop DCP Subtitle Format
lamsLambda CAP Subtitle Format
mccMacCaption VANC Format
pacsScreen PAC Subtitle Format
sccScenarist Closed Captions
sdcpSMPTE DCP Subtitle Format
spruSpruce STL Subtitle Format
stlEBU Subtitle Exchange Format (STL)
srtSubRip File Format (SRT)
ttmlW3C Timed Text Format (TTML, ISMC, SMPTE-TT, EBU-TT)
ttxtEBU Teletext
tx3g3GPP Timed Text
vttWeb Video Text Track (WebVTT)

Subtitle Conversion

Use the Format property to convert a subtitle stream to a different format. For example the following composition converts the input subtitles to WebVTT format:

---
input:
  container:
  - name: input1
    subtitle:
    - name: s1
    video: []
    audio: []
output:
  container:
  - name: output1
    type: 'vtt '
    subtitle:
    - route:
        name: s1
      properties:
        Format: vtt
    video: []
    audio: []
{
  "input": {
    "container": [
      {
        "name": "input1",
        "subtitle": [
          {
            "name": "s1"
          }
        ],
        "video": [],
        "audio": []
      }
    ]
  },
  "output": {
    "container": [
      {
        "name": "output1",
        "type": "vtt ",
        "subtitle": [
          {
            "route": {
              "name": "s1"
            },
            "properties": {
              "Format": "vtt"
            }
          }
        ],
        "video": [],
        "audio": []
      }
    ]
  }
}

Subtitle Overlay

Use the overlay operator to overlay (or burn-in) subtitles on the video stream. For example the following composition overlays the input subtitles:

---
input:
  container:
  - name: input1
    video:
    - name: v1
    audio:
    - name: a1
    subtitle:
    - name: s1
output:
  container:
  - name: output1
    type: 'mov '
    video:
    - overlay:
      - name: v1
      - name: s1
        properties:
          Kind: subtitle
          FontFamily: Arial
      properties:
        Format: avci_100_720p30
    audio:
    - route:
        name: a1
      properties:
        Format: pcm_24int_little
{
  "input": {
    "container": [
      {
        "name": "input1",
        "video": [
          {
            "name": "v1"
          }
        ],
        "audio": [
          {
            "name": "a1"
          }
        ],
        "subtitle": [
          {
            "name": "s1"
          }
        ]
      }
    ]
  },
  "output": {
    "container": [
      {
        "name": "output1",
        "type": "mov ",
        "video": [
          {
            "overlay": [
              {
                "name": "v1"
              },
              {
                "name": "s1",
                "properties": {
                  "Kind": "subtitle",
                  "FontFamily": "Arial"
                }
              }
            ],
            "properties": {
              "Format": "avci_100_720p30"
            }
          }
        ],
        "audio": [
          {
            "route": {
              "name": "a1"
            },
            "properties": {
              "Format": "pcm_24int_little"
            }
          }
        ]
      }
    ]
  }
}

The following properties can be applied to a subtitle overlay:

PropertyTypeDescription
FontFamilystringSpecifies the font family name for subtitle text.
StringForegroundColorstringSpecifies the text foreground color as a TTML color value:
#rrggbb
#rrggbbaa
rgb(r,g,b)
rgba(r,g,b,a)
<namedcolor>
StringBackgroundColorstringSpecifies the text background color as a TTML color value.
RegionBackgroundColorstringSpecifies the region background color as a TTML color value.

Caption Formats

Transform supports the following caption Format identifiers:

FormatDescription
a53ATSC A/53
a72ATSC A/72
scte20SCTE-20
c608CEA-608 Closed Captions (Field 1 or 2)
c618CEA-608 Closed Captions (Field 1)
c628CEA-608 Closed Captions (Field 2)
c708CEA-708 Closed Captions

Caption Extraction

Use the route operator to extract closed caption or teletext metadata from a video stream. For example the following composition extracts CEA-608 captions from the input stream and produces a sidecar SCC output:

---
input:
  container:
  - name: input1
    video:
    - name: v1
    audio: []
    subtitle: []
output:
  container:
  - name: output1
    type: 'scc '
    subtitle:
    - route:
        name: v1
        properties:
          Kind: captions
          Format: c608
      properties:
        Format: scc
    video: []
    audio: []
{
  "input": {
    "container": [
      {
        "name": "input1",
        "video": [
          {
            "name": "v1"
          }
        ],
        "audio": [],
        "subtitle": []
      }
    ]
  },
  "output": {
    "container": [
      {
        "name": "output1",
        "type": "scc ",
        "subtitle": [
          {
            "route": {
              "name": "v1",
              "properties": {
                "Kind": "captions",
                "Format": "c608"
              }
            },
            "properties": {
              "Format": "scc"
            }
          }
        ],
        "video": [],
        "audio": []
      }
    ]
  }
}

Caption Overlay

Use the overlay operator to overlay (or burn-in) captions on the video stream. For example the following composition overlays CEA-608 captions. Note that the Kind property configures the overlay operator to display "open" captions:

---
input:
  container:
  - name: input1
    video:
    - name: v1
      detach:
      - properties:
          Format: c608
    audio:
    - name: a1
output:
  container:
  - name: output1
    type: 'mov '
    video:
    - overlay:
      - name: v1
      - name: v1
        properties:
          Kind: captions
          Format: c608
          CaptionChannel: 0
      properties:
        Format: avci_100_720p30
    audio:
    - route:
        name: a1
      properties:
        Format: pcm_24int_little
{
  "input": {
    "container": [
      {
        "name": "input1",
        "video": [
          {
            "name": "v1",
            "detach": [
              {
                "type": "c608"
              }
            ]
          }
        ],
        "audio": [
          {
            "name": "a1"
          }
        ]
      }
    ]
  },
  "output": {
    "container": [
      {
        "name": "output1",
        "type": "mov ",
        "video": [
          {
            "overlay": [
              {
                "name": "v1"
              },
              {
                "name": "v1",
                "properties": {
                  "Kind": "captions",
                  "Format": "c608",
                  "CaptionChannel": 0
                }
              }
            ],
            "properties": {
              "Format": "avci_100_720p30"
            }
          }
        ],
        "audio": [
          {
            "route": {
              "name": "a1"
            },
            "properties": {
              "Format": "pcm_24int_little"
            }
          }
        ]
      }
    ]
  }
}

The following properties can be applied to the caption overlay:

PropertyTypeDescription
CaptionChannelintegerSpecifies the caption decoder channel: 0-3 CEA-608 CC1-CC4, 10-15 CEA-708 Service 1-6.

Caption Insertion

Use the merge operator to insert captions into a video stream. For example the following composition inserts captions from a sidecar SCC input:

---
input:
  reference: media
  container:
  - name: media
    video:
    - name: v1
    audio:
    - name: a1
  - name: SCC
    subtitle:
    - name: s1
output:
  container:
  - type: 'mov '
    name: output1
    video:
    - route:
        name: v1
      merge:
        name: s1
        properties:
          Kind: captions
          Format: a72
      properties:
        Format: avci_100_720p30
    audio:
    - route:
        name: a1
      properties:
        Format: pcm_24int_little
    subtitle: []
{
   "input":{
      "reference":"media",
      "container":[
         {
            "name":"media",
            "video":[
               {
                  "name":"v1"
               }
            ],
            "audio":[
               {
                  "name":"a1"
               }
            ]
         },
         {
            "name":"SCC",
            "subtitle":[
               {
                  "name":"s1"
               }
            ]
         }
      ]
   },
   "output":{
      "container":[
         {
            "type":"mov ",
            "name":"output1",
            "video":[
               {
                  "route":{
                     "name":"v1"
                  },
                  "merge":{
                     "name":"s1",
                     "properties":{
                        "Kind":"captions",
                        "Format":"c708",
                        "Location":"a72c"
                     }
                  },
                  "properties":{
                     "Format":"avci_100_720p30"
                  }
               }
            ],
            "audio":[
               {
                  "route":{
                     "name":"a1"
                  },
                  "properties":{
                     "Format":"pcm_24int_little"
                  }
               }
            ],
            "subtitle":[]
         }
      ]
   }
}