Startup Configuration

Startup configuration for configuring ew-vod2cbm

When starting the ew-vod2cbm service, a configuration file may be provided. This file enables starting ew-vod2cbm with predefined assets, channels and schedules. These items can also be added and updated via the REST API when the service is running.

If a path to a cached configuration is set, any change of the configuration via the REST API results in that the complete configuration of asset paths, channels and their schedules are written to a file at that path. On restart, an existing file at this path is used to restore the last dynamic configuration, while any static configuration of these settings is skipped.

However, if a path to a cached configuration is set, either via a command line parameter -cachedcfg or the corresponding environment variable, such a file will be used to restore the last dynamic configuration of asset paths and channels. The static configuration of these entities will then be ignored, unless the parsing of the cache configuration fails.

JSON Schema for configuration file

The JSON snippet below provides a description of the schema and the parameters that applies to configuration file for ew-vod2cbm.

The masterAssetID will be deprecated in a future release.

{
    "defaultMaxBitratePercentAbove": {
        "description": "When matching a variant, this sets the maximum upper boundary in percent for the bitrate",
        "type": "integer",
        "minimum": 0,
    },
    "defaultMaxBitratePercentBelow": {
        "description": "When matching a variant, this sets the maximum lower boundary in percent for the bitrate",
        "type": "integer",
        "minimum": 0,
        "maximum": 100,
    },
    "defaultMaxLiveWindowS": {
        "description": "The maximum length of the live window in seconds",
        "type": "integer",
        "minimum": 10,
        "maximum": 36000,
    },
    "assets": {
        "description": "list of assets",
        "type": "array",
        "items": {
            "type": "object",
            "required": [
                "id",
                "path"
            ],
            "properties": {
                "id": {
                    "type": "string"
                },
                "path": {
                    "type": "string"
                }
            }
        }
    },
    "channels": {
        "description": "Channels for ew-vod2cbm at startup",
        "type": "array",
        "items": {
            "type": "object",
            "required": [
                "gopDurMS",
                "name",
                "nrGopsPerSegment",
                "schedule"
            ],
            "properties": {
                "doLoop": {
                    "description": "Loop schedule or not",
                    "type": "boolean"
                },
                "gopDurMS": {
                    "description": "Exact millisecond duration of all video GoPs in all assets",
                    "type": "integer",
                    "minimum": 320,
                    "example": 2000
                }
                "contentTemplatePath": {
                    "description": "Path to the content template file. If this is used, masterAssetID should not be specified.",
                     "type": "string"
                 },
                 "masterAssetID": {
                     "description": "ID of the asset to use as a content template. If this is used, contentTemplatePath should not be specified.",
                    "type": "string"
                },
                "maxBitratePercentAbove": {
                    "description": "Percent diff above for when matching a track from the content template",
                    "type": "integer"
                },
                "maxBitratePercentBelow": {
                    "description": "Percent diff below for when matching a track from the content template",
                    "type": "integer"
                },
                "name": {
                    "description": "Unique name",
                    "type": "string",
                    "minLength": 2,
                    "example": "Channel 1"
                },
                "nrGopsPerSegment": {
                    "description": "How many GoPs to include in an average output segment",
                    "type": "integer",
                    "minimum": 1,
                    "example": 3
                },
                "schedule": {
                    "description": "The current scedule of the channel",
                    "type": "object",
                    "required": [
                        "entries"
                    ],
                    "properties": {
                        "entries": {
                            "description": "list of programs or other entries",
                            "type": "array",
                            "items": {
                                "type": "object",
                                "required": [
                                    "assetID",
                                    "length",
                                    "name"
                                ],
                                "properties": {
                                    "assetID": {
                                        "description": "Asset identifier",
                                        "type": "string",
                                        "minLength": 2,
                                        "example": "asset1234568-22"
                                    },
                                    "length": {
                                        "description": "How many GoPs to play in asset. 0 is until end of asset. Beyond end results in wrap to start",
                                        "type": "integer",
                                        "example": 2400
                                    },
                                    "name": {
                                        "description": "Name to include in EPG",
                                        "type": "string",
                                        "minLength": 2,
                                        "example": "The Shark"
                                    },
                                    "offset": {
                                        "description": "Zero-based GoP nr to start in asset. Negative value means from end",
                                        "type": "integer"
                                    },
                                    "scteEventID": {
                                        "description": "SCTE-35 Event ID in SCTE message. A non-zero value signals an ad. If scteEventID is set to -1, a unique event ID corresponding to the GoP number where the ad break starts will be inserted in the output.",
                                        "type": "integer",
                                        "minimum": -1
                                    }
                                }
                            }
                        },
                        "gopNrAfterLastAd": {
                            "type": "integer"
                        },
                        "gopNrAtScheduleStart": {
                            "type": "integer"
                        }
                    }
                },
                "startTimeS": {
                    "description": "Start time relative epoch (1970-01-01) in seconds",
                    "type": "integer",
                    "minimum": 0
                }
            }
        }
    }
}

Example configuration

An example configuration file for two channels where all assets have relative paths may look like:

{
    "defaultMaxBitratePercentAbove": 5,
    "defaultMaxBitratePercentBelow": 20,
    "assets": [
        {"id": "bbb", "path": "app/testdata/assets/bbb"},
        {"id": "slates/slate_pre_ad", "path": "app/testdata/assets/slates/slate_pre_ad"},
        {"id": "slates/slate_post_ad", "path": "app/testdata/assets/slates/slate_post_ad"},
        {"id": "slates/slate_black", "path": "app/testdata/assets/slates/slate_black"},
        {"id": "whistler", "path": "app/testdata/assets/whistler"},
        {"id": "ed", "path": "app/testdata/assets/ed"}
    ],
    "channels": [
        {
            "name": "quick",
            "gopDurMS": 1920,
            "nrGopsPerSegment": 2,
            "contentTemplatePath": "location/of/content_template.json"
            "startTimeS": 0,
            "doLoop": true,
            "maxBitratePercentAbove": 10,
            "maxBitratePercentBelow": 30,
            "schedule": {
                "GopNrAtScheduleStart": 0,
                "GopNrAfterLastAd": 0,
                "Entries": [
                    {
                        "name": "Big Buck Bunny",
                        "assetID": "bbb",
                        "offset": -3,
                        "length": 3
                    },
                    {
                        "name": "Ad upcoming",
                        "assetID": "slates/slate_pre_ad",
                        "offset": 0,
                        "length": 1,
                        "scteEventID": 123
                    },
                    {
                        "name": "Whistler ad",
                        "assetID": "whistler",
                        "offset": 0,
                        "length": 4,
                        "scteEventID": 123
                    },
                    {
                        "name": "Ad finished",
                        "assetID": "slates/slate_post_ad",
                        "offset": 0,
                        "length": 1,
                        "scteEventID": 123
                    },
                    {
                        "name": "Elephants dream",
                        "assetID": "ed",
                        "offset": 3,
                        "length": 4
                    }
                ]
            }
        },
        {
            "name": "test",
            "gopDurMS": 1920,
            "nrGopsPerSegment": 3,
            "contentTemplatePath": "location/of/content_template.json"
            "startTimeS": 0,
            "doLoop": true,
            "schedule": {
                "GopNrAtScheduleStart": 0,
                "GopNrAfterLastAd": 0,
                "Entries": [
                    {
                        "name": "Big Buck Bunny",
                        "assetID": "bbb",
                        "length": 0
                    },
                    {
                        "name": "Black 10s",
                        "assetID": "slates/slate_black",
                        "offset": 0,
                        "length": 5
                    },
                    {
                        "name": "Whistler ad",
                        "assetID": "whistler",
                        "length": 0,
                        "scteEventID": 123
                    },
                    {
                        "name": "Elephants dream",
                        "assetID": "ed",
                        "offset": 0,
                        "length": 0
                    }
                ]
            }
        }
    ]
}