Skip to content

m3u8_edit:add_subtitles

m3u8_edit:add_subtitles

Enables adding subtitle media playlist entries to an HLS master playlist.

Generates an EXT-X-MEDIA entry with the specified GROUP-ID, then adds this GROUP-ID as the value for SUBTITLES for all the EXT-X-STREAM-INF entries in the HLS playlist.

Only supports master playlists which don't yet include any subtitles.

Input parameters description:

  • name used as the value for NAME

  • uri used as the value for URI

  • language used as the value for LANGUAGE

  • autoselect if true, AUTOSELECT is set to YES. Implicitly set if DEFAULT is true

  • default if true, DEFAULT is set to YES

  • forced if true, FORCED is set to YES

  • closed_captions mark the entry as closed captions. By setting this to true, this entry will have the following Uniform Type Identifiers [UTI] set in the CHARACTERISTICS:

    public.accessibility.transcribes-spoken-dialog public.accessibility.describes-music-and-sound

  • characteristics a list of strings - Uniform Type Identifiers [UTI] - to specify in the CHARACTERISTICS they are de-duplicated before written to the file. If closed_captions set to true, this will include two pre-set UTIs

Example:

{
  "tool": "m3u8_edit:add_subtitles",
  "parameters": {
    "input_master_playlist": "index.m3u8",
    "output_master_playlist": "index_new.m3u8",
    "group_id": "subtitles",
    "inputs": [
        {
            "name": "fr-FR",
            "uri": "subs-01.m3u8",
            "language": "fr-FR",
            "autoselect": true,
            "default": true,
            "forced": false,
            "closed_captions": true,
            "characteristics": [
                "my.custom.uti.01",
                "my.custom.uti.02"
            ]
        },
        {
            "name": "es-ES",
            "uri": "subs-01.m3u8",
            "language": "es-ES",
            "autoselect": true,
            "default": false,
            "forced": false,
            "closed_captions": false,
            "characteristics": [
                "my.custom.uti.01",
                "my.custom.uti.02"
            ]
        }
    }
  }
}
Parameter Properties Default Type Choice Description
input_master_playlist required Input master playlist to edit.
inputs required [list value] dict Parameters of subtitle playlists to add
output_master_playlist optional Output master playlist. If not specified, defaults to overwriting the input.
group_id optional subtitles str GROUP-ID parameter of the added playlist. Defaults to "subtitles"