Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decode signal SCTE-35 <binary> strings with threefive #62

Open
futzu opened this issue Mar 11, 2024 · 1 comment
Open

Decode signal SCTE-35 <binary> strings with threefive #62

futzu opened this issue Mar 11, 2024 · 1 comment

Comments

@futzu
Copy link

futzu commented Mar 11, 2024

I've been wanting to add DASH support to threefive,
but it seems like it makes more sense to add SCTE-35 support to a DASH parser.

if you want to pull the SCTE-35 values from  a <binary> tag  base64 string  in a signal 
       <Signal
          xmlns="http://www.scte.org/schemas/35/2016">
          <Binary>/DAgAAAAAAAAAP/wDwUA15FRf//+ADS8AMAAAAAAAORhJCQ=</Binary>
        </Signal>

You can use threefive like this

from threefive import Cue

b64 ="/DAgAAAAAAAAAP/wDwUA15FRf//+ADS8AMAAAAAAAORhJCQ="
cue = Cue(b64)
cue.decode()

after calling decode all the SCTE-35 vars can be accessed via dot notation

>>>> cue.command.break_duration
38.4

cue.show() prints thje cue in json

>>>> cue.show()
{
    "info_section": {
        "table_id": "0xfc",
        "section_syntax_indicator": false,
        "private": false,
        "sap_type": "0x03",
        "sap_details": "No Sap Type",
        "section_length": 32,
        "protocol_version": 0,
        "encrypted_packet": false,
        "encryption_algorithm": 0,
        "pts_adjustment_ticks": 0,
        "pts_adjustment": 0.0,
        "cw_index": "0x00",
        "tier": "0x0fff",
        "splice_command_length": 15,
        "splice_command_type": 5,
        "descriptor_loop_length": 0,
        "crc": "0xe4612424"
    },
    "command": {
        "command_length": 15,
        "command_type": 5,
        "name": "Splice Insert",
        "break_auto_return": true,
        "break_duration": 38.4,
        "break_duration_ticks": 3456000,
        "splice_event_id": 14127441,
        "splice_event_cancel_indicator": false,
        "out_of_network_indicator": true,
        "program_splice_flag": true,
        "duration_flag": true,
        "splice_immediate_flag": true,
        "event_id_compliance_flag": true,
        "unique_program_id": 49152,
        "avail_num": 0,
        "avail_expected": 0
    },
    "descriptors": []
}
@davemevans
Copy link
Collaborator

Related: #23

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants