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:

Format

Description

c890

Cavena 890 Subtitle Format

dvbs

DVB Subtitles

dvbt

DVB Teletext

idcp

Interop DCP Subtitle Format

lams

Lambda CAP Subtitle Format

mcc

MacCaption VANC Format

pacs

Screen PAC Subtitle Format

scc

Scenarist Closed Captions

sdcp

SMPTE DCP Subtitle Format

spru

Spruce STL Subtitle Format

stl

EBU Subtitle Exchange Format (STL)

srt

SubRip File Format (SRT)

ttml

W3C Timed Text Format (TTML, ISMC, SMPTE-TT, EBU-TT)

ttxt

EBU Teletext

tx3g

3GPP Timed Text

vtt

Web 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:

Property

Type

Description

FontFamily

string

Specifies the font family name for subtitle text.

StringForegroundColor

string

Specifies the text foreground color as a TTML color value:
#rrggbb
#rrggbbaa
rgb(r,g,b)
rgba(r,g,b,a)
<namedcolor>

StringBackgroundColor

string

Specifies the text background color as a TTML color value.

RegionBackgroundColor

string

Specifies the region background color as a TTML color value.

Caption Formats

Transform supports the following caption Format identifiers:

Format

Description

a53

ATSC A/53

a72

ATSC A/72

scte20

SCTE-20

c608

CEA-608 Closed Captions (Field 1 or 2)

c618

CEA-608 Closed Captions (Field 1)

c628

CEA-608 Closed Captions (Field 2)

c708

CEA-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:

Property

Type

Description

CaptionChannel

integer

Specifies 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":[]
         }
      ]
   }
}

Did this page help you?