Python SCTE Plugin

Set up a Live Slicer to run a Python SCTE plugin, and the plugin functions it must implement.

Python SCTE Plugin

Use the Python SCTE plugin to process your SCTE-35/104 signal with a custom Python file. Your code should contain specific functions that hook into SCTE processing and control the state of the Live Slicer.

Python

Python and its libraries must be installed in your system's shared library path.

Note: Python 2.7 reached end-of-life in January 2020 and is no longer supported. The Live Slicer previously defaulted to Python 2.7 on older systems such as macOS and Ubuntu 14.04 LTS or lower.

For Live Slicer version 23090500 (https://cms.uplynk.com/static/cms/news.html?tag=slicer) or higher, use Python 3.6 or newer. You can configure the Live Slicer to use Python 3.x by adding the following to your Live Slicer configuration file:

  • Syntax (Python 3.6):

    scte_python_version: 3.6
  • Syntax (Python 3.6 installed with pymalloc support):

    scte_python_version: 3.6m
  • Syntax (Python 3.8)

    scte_python_version: 3.8

Set up a Live Slicer

Set up a Live Slicer to use your Python SCTE plugin by adding the following settings to your Live Slicer configuration file:

scte_type: python
scte_module: my_scte_plugin.py
scte_python_version: 3.x
📘

If you have not installed Python 3.6 with pymalloc support, then you should update the scte_python_version setting with the correct version.

Copy your Python plugin to the plugins subfolder of your Live Slicer's installation directory and replace my_scte_plugin.py with your Python plugin's file name.

Sample Directory Tree

├── home
│   ├── liveslicer
│   │   ├── plugins
│   │   │   ├── my_scte_plugin.py

See information on the SCTE parameters in Live Slicer Configuration File Settings.

Plugin Functions

The most basic plugin, which does nothing, must appear as:

import slicer

def Initialize():
    return slicer.Initialize()

def Notify():
    return int(0)

The Initialize function is necessary to establish proper communication between the plugin and the slicer. The second, optional function is where you perform SCTE logic:

def Process35(slice_info):
    slicer.Blackout(int(0))
    return int(0)

This function receives SCTE-35 packets. Inside it, you may inspect the slice_info object containing the SCTE packet or call slicer module functions to control the slicer. SCTE-104 packets are converted to SCTE-35 and passed to this function for unified handling.


Did this page help you?