threefive3 3.0.43__tar.gz → 3.0.45__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {threefive3-3.0.43 → threefive3-3.0.45}/PKG-INFO +112 -58
- {threefive3-3.0.43 → threefive3-3.0.45}/README.md +111 -57
- {threefive3-3.0.43 → threefive3-3.0.45}/threefive3/__init__.py +6 -1
- {threefive3-3.0.43 → threefive3-3.0.45}/threefive3/bitn.py +2 -1
- {threefive3-3.0.43 → threefive3-3.0.45}/threefive3/commands.py +5 -5
- {threefive3-3.0.43 → threefive3-3.0.45}/threefive3/crc.py +1 -2
- {threefive3-3.0.43 → threefive3-3.0.45}/threefive3/cue.py +48 -26
- {threefive3-3.0.43 → threefive3-3.0.45}/threefive3/descriptors.py +7 -8
- {threefive3-3.0.43 → threefive3-3.0.45}/threefive3/gums.py +5 -7
- {threefive3-3.0.43 → threefive3-3.0.45}/threefive3/hls.py +34 -22
- {threefive3-3.0.43 → threefive3-3.0.45}/threefive3/hlstags.py +2 -14
- {threefive3-3.0.43 → threefive3-3.0.45}/threefive3/pmt.py +33 -5
- {threefive3-3.0.43 → threefive3-3.0.45}/threefive3/section.py +1 -1
- {threefive3-3.0.43 → threefive3-3.0.45}/threefive3/sixfix.py +4 -1
- {threefive3-3.0.43 → threefive3-3.0.45}/threefive3/stream.py +5 -5
- {threefive3-3.0.43 → threefive3-3.0.45}/threefive3/stuff.py +59 -7
- threefive3-3.0.45/threefive3/uxp.py +368 -0
- {threefive3-3.0.43 → threefive3-3.0.45}/threefive3/version.py +1 -1
- {threefive3-3.0.43 → threefive3-3.0.45}/threefive3/xml.py +172 -96
- {threefive3-3.0.43 → threefive3-3.0.45}/threefive3.egg-info/PKG-INFO +112 -58
- threefive3-3.0.43/threefive3/uxp.py +0 -337
- {threefive3-3.0.43 → threefive3-3.0.45}/LICENSE +0 -0
- {threefive3-3.0.43 → threefive3-3.0.45}/bin/threefive3 +0 -0
- {threefive3-3.0.43 → threefive3-3.0.45}/setup.cfg +0 -0
- {threefive3-3.0.43 → threefive3-3.0.45}/setup.py +0 -0
- {threefive3-3.0.43 → threefive3-3.0.45}/threefive3/aac.py +0 -0
- {threefive3-3.0.43 → threefive3-3.0.45}/threefive3/base.py +0 -0
- {threefive3-3.0.43 → threefive3-3.0.45}/threefive3/encode.py +0 -0
- {threefive3-3.0.43 → threefive3-3.0.45}/threefive3/iframes.py +0 -0
- {threefive3-3.0.43 → threefive3-3.0.45}/threefive3/new_reader.py +0 -0
- {threefive3-3.0.43 → threefive3-3.0.45}/threefive3/packetdata.py +0 -0
- {threefive3-3.0.43 → threefive3-3.0.45}/threefive3/segment.py +0 -0
- {threefive3-3.0.43 → threefive3-3.0.45}/threefive3/segmentation.py +0 -0
- {threefive3-3.0.43 → threefive3-3.0.45}/threefive3/streamtypes.py +0 -0
- {threefive3-3.0.43 → threefive3-3.0.45}/threefive3/superkabuki.py +0 -0
- {threefive3-3.0.43 → threefive3-3.0.45}/threefive3/upids.py +0 -0
- {threefive3-3.0.43 → threefive3-3.0.45}/threefive3/words.py +0 -0
- {threefive3-3.0.43 → threefive3-3.0.45}/threefive3.egg-info/SOURCES.txt +0 -0
- {threefive3-3.0.43 → threefive3-3.0.45}/threefive3.egg-info/dependency_links.txt +0 -0
- {threefive3-3.0.43 → threefive3-3.0.45}/threefive3.egg-info/requires.txt +0 -0
- {threefive3-3.0.43 → threefive3-3.0.45}/threefive3.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: threefive3
|
|
3
|
-
Version: 3.0.
|
|
3
|
+
Version: 3.0.45
|
|
4
4
|
Summary: SCTE-35 decoder and encoder with MPEGTS and HLS and XML support.
|
|
5
5
|
Home-page: https://github.com/superkabuki/threefive3
|
|
6
6
|
Author: Adrian of Doom
|
|
@@ -19,62 +19,108 @@ Requires-Python: >=3.6
|
|
|
19
19
|
Description-Content-Type: text/markdown
|
|
20
20
|
License-File: LICENSE
|
|
21
21
|
|
|
22
|
-
[__Install__](#install) |[__SCTE-35 Cli__](#the-cli-tool) | [__SCTE-35 HLS__](https://github.com/superkabuki/threefive3/blob/main/hls.md) | [__Cue__ Class](https://github.com/superkabuki/threefive3/blob/main/cue.md) | [__Stream__ Class](https://github.com/superkabuki/threefive3/blob/main/stream.md) | [__Online SCTE-35 Parser__](https://iodisco.com/scte35) | [__Encode SCTE-35__](https://github.com/superkabuki/threefive3/blob/main/encode.md) | [__SCTE-35 Examples__](https://github.com/superkabuki/threefive3/tree/main/examples)
|
|
23
|
-
| [__SCTE-35 XML__](https://github.com/superkabuki/SCTE-35/blob/main/xml.md)
|
|
24
22
|
|
|
25
23
|
|
|
24
|
+
I've spent the last five years doing nothing but SCTE-35, a lot of people consider me a subject matter expert, other people describe me with adjectives. ~Adrian
|
|
26
25
|
|
|
27
|
-
# threefive3 is ready.
|
|
28
|
-
✅ SCTE-35 __Parser__ ✅ SCTE-35 __Encoder__ ✅ SCTE-35 __HLS__ ✅ SCTE-35 __Xml+binary__ ✅ SCTE-35 __Cli__ ✅ SCTE-35 __library__
|
|
29
26
|
|
|
30
27
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
# Heads up, I'm about to push v3.0.43
|
|
38
|
-
<pre>
|
|
39
|
-
Q.
|
|
40
|
-
Why the release?
|
|
41
|
-
|
|
42
|
-
A.
|
|
43
|
-
I made a mistake with the xml method in the Cue class. I intended it to return a node instance,
|
|
44
|
-
but instead I had it return just the xml output of a Node instance, not a big deal really,
|
|
45
|
-
but everything else returns a node instance from their xml() method, Cue should too..
|
|
46
|
-
I don't want people getting used to it not return a Node instance.
|
|
47
|
-
v3.0.43 fixes Cue.xml() to return a Node instance.
|
|
48
|
-
I also added more autodetection of SCTE-35 Formats to the Cue class,
|
|
49
|
-
no other SCTE-35 software can do even half of these.
|
|
50
|
-
Base64,
|
|
51
|
-
Bytes,
|
|
52
|
-
Dicts,
|
|
53
|
-
MPEGTS SCTE-35 packets,
|
|
54
|
-
Hex (literal and string),
|
|
55
|
-
Integers (literal, bytestring,and string),
|
|
56
|
-
JSON(strings and bytestrings),
|
|
57
|
-
XML(string and bytestring)
|
|
58
|
-
XML+Binary(string and bytestring)
|
|
59
|
-
|
|
60
|
-
I brought in the PMT module,that really cleans SixFix and SuperKabuki up a lot.
|
|
61
|
-
SuperKabuki is now a subclass of SixFix instead of the Stream class, that gets rid of a lot
|
|
62
|
-
of redundant code.
|
|
63
|
-
|
|
64
|
-
The Super Kabuki MPEGTS SCTE-35 Packet Injection Engine is working really really well.
|
|
65
|
-
I've tested the SuperKabuki output with ffmpeg and tsduck and everything works.
|
|
66
|
-
It's workinng perfectly for me, so I want to get it out there and see if y'all break it. :)
|
|
67
|
-
</pre>
|
|
28
|
+
# threefive3 is SCTE-35.
|
|
29
|
+
## The Most Advanced SCTE-35 Parser on the Planet.
|
|
30
|
+
### If you're working with SCTE-35, this is the tool you want.
|
|
31
|
+
|
|
32
|
+
[__Install__](#install) |[__SCTE-35 Cli__](#the-cli-tool) | [__SCTE-35 HLS__](https://github.com/superkabuki/threefive3/blob/main/hls.md) | [__Cue__ Class](https://github.com/superkabuki/threefive3/blob/main/cue.md) | [__Stream__ Class](https://github.com/superkabuki/threefive3/blob/main/stream.md) | [__Online SCTE-35 Parser__](https://iodisco.com/scte35) | [__Encode SCTE-35__](https://github.com/superkabuki/threefive3/blob/main/encode.md) | [__SCTE-35 Examples__](https://github.com/superkabuki/threefive3/tree/main/examples)
|
|
33
|
+
| [__SCTE-35 XML__ updated 05/01/2025](https://github.com/superkabuki/SCTE-35/blob/main/xml.md) | [__threefive3 runs Four Times Faster on pypy3__](https://pypy.org/)
|
|
68
34
|
|
|
35
|
+
✅ SCTE-35 __Parser__ <br>
|
|
36
|
+
✅ SCTE-35 __Decoder__ <br>
|
|
37
|
+
✅ SCTE-35 __Encoder__ <br>
|
|
38
|
+
✅ SCTE-35 __HLS__ ( All SCTE-35 HLS tag formats) <br>
|
|
39
|
+
✅ SCTE-35 __DASH__ ( All SCTE-35 Xml formats) <br>
|
|
40
|
+
✅ SCTE-35 __XML__ <br>
|
|
41
|
+
✅ SCTE-35 __Cli__ <br>
|
|
42
|
+
✅ SCTE-35 __library__ <br>
|
|
43
|
+
|
|
44
|
+
* Parses __SCTE-35__ from MPEGTS, HLS, XML, MPD, XML+Binary, Base64, Bytes, Hex, Integers, or JSON.
|
|
45
|
+
* Encode __SCTE-35__ to Base64, Bytes, Hex, Int, JSON,XML, or Xml+binary.
|
|
46
|
+
* __All HLS SCTE-35 Tags__ are Supported.
|
|
47
|
+
* __Automatic AES decryption__ for HLS.
|
|
48
|
+
* Built-in __Multicast Sender and Receiver__ _hell yes!_
|
|
49
|
+
* The __SuperKabuki SCTE-35 MPEGTS Packet Injection Engine__ was added to __threefive3__ v3.0.39
|
|
69
50
|
|
|
70
|
-
|
|
71
|
-
_Released Thursday April 18th, 2025
|
|
72
|
-
* just 4300 lines of code.
|
|
73
|
-
* cyclomatic complexity __2.05__
|
|
74
|
-
> Stay up to date, only the latest release is supported.
|
|
51
|
+
#### `Q.` What is SCTE-35?
|
|
75
52
|
|
|
53
|
+
#### `A.` SCTE-35 is just encoded binary data, that decodes into about 100 different vars. This blob of data is used to signal when to splice in Ad Breaks with commercials and such. The variables are used to facillitate this action and to help determine the type and length of commercials. As with most things related to streaming video, it's way more complicated than it needs to be, and there are way too many options.
|
|
76
54
|
|
|
77
55
|
|
|
56
|
+
<br>
|
|
57
|
+
|
|
58
|
+
### Heads up, v3.0.45 is ready to roll.
|
|
59
|
+
* I'm trying to break anything that will break tonight, so I can fix it later today.
|
|
60
|
+
* if you have an issue, post it.
|
|
61
|
+
* I spent last night tricking out the Node class.
|
|
62
|
+
### [Super Cool new xml stuff in threefive v3.0.45](node.md)
|
|
63
|
+
### The new xml stuff is really sweet, you can even pass an DASH MPD directly to a Cue instance, and it will parse the first EVent with SCTE-35 it finds. Let me show you.
|
|
64
|
+
```py3
|
|
65
|
+
a@fu:~/threefive3$ pypy3
|
|
66
|
+
|
|
67
|
+
Python 3.9.16 (7.3.11+dfsg-2+deb12u3, Dec 30 2024, 22:36:23)
|
|
68
|
+
[PyPy 7.3.11 with GCC 12.2.0] on linux
|
|
69
|
+
Type "help", "copyright", "credits" or "license" for more information.
|
|
70
|
+
>>>>
|
|
71
|
+
>>>> from threefive3 import Cue,reader
|
|
72
|
+
>>>> data = reader('https://demo.unified-streaming.com/k8s/live/stable/scte35-n\
|
|
73
|
+
o-splicing.isml/.mpd').read().strip().decode() # use reader to pull the mpd over a network.
|
|
74
|
+
>>>> cue=Cue(data) # pass in to a Cue instance
|
|
75
|
+
>>>> cue.show()
|
|
76
|
+
{
|
|
77
|
+
"info_section": {
|
|
78
|
+
"table_id": "0xfc",
|
|
79
|
+
"section_syntax_indicator": false,
|
|
80
|
+
"private": false,
|
|
81
|
+
"sap_type": "0x03",
|
|
82
|
+
"sap_details": "No Sap Type",
|
|
83
|
+
"section_length": 32,
|
|
84
|
+
"protocol_version": 0,
|
|
85
|
+
"encrypted_packet": false,
|
|
86
|
+
"encryption_algorithm": 0,
|
|
87
|
+
"pts_adjustment": 0.0,
|
|
88
|
+
"cw_index": "0x00",
|
|
89
|
+
"tier": "0x0fff",
|
|
90
|
+
"splice_command_length": 15,
|
|
91
|
+
"splice_command_type": 5,
|
|
92
|
+
"descriptor_loop_length": 0,
|
|
93
|
+
"crc": "0xe4612424"
|
|
94
|
+
},
|
|
95
|
+
"command": {
|
|
96
|
+
"command_length": 15,
|
|
97
|
+
"command_type": 5,
|
|
98
|
+
"name": "Splice Insert",
|
|
99
|
+
"break_auto_return": true,
|
|
100
|
+
"break_duration": 38.4,
|
|
101
|
+
"splice_event_id": 14432855,
|
|
102
|
+
"splice_event_cancel_indicator": false,
|
|
103
|
+
"out_of_network_indicator": true,
|
|
104
|
+
"program_splice_flag": true,
|
|
105
|
+
"duration_flag": true,
|
|
106
|
+
"splice_immediate_flag": true,
|
|
107
|
+
"event_id_compliance_flag": true,
|
|
108
|
+
"unique_program_id": 49152,
|
|
109
|
+
"avail_num": 0,
|
|
110
|
+
"avails_expected": 0
|
|
111
|
+
},
|
|
112
|
+
"descriptors": []
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
# Latest release is v3.0.45
|
|
116
|
+
|
|
117
|
+
* cyclomatic complexity __2.01__ ,__That's a kickass score.__
|
|
118
|
+
|
|
119
|
+
* pylint score is __9.65/10__, _this needs a liitle work_.
|
|
120
|
+
|
|
121
|
+
> Stay up to date, only the latest release is supported.
|
|
122
|
+
>
|
|
123
|
+
|
|
78
124
|
## MPEGTS streams can be parsed for SCTE-35 with three lines of code.
|
|
79
125
|
|
|
80
126
|
```py3
|
|
@@ -85,30 +131,37 @@ a@fu:~/build5/scte35/scte35$ pypy3
|
|
|
85
131
|
>>>> strm.decode()
|
|
86
132
|
```
|
|
87
133
|
|
|
134
|
+
### `Q.` Come on man, python is a damn scripting language, how fast can it be parsing MPEGTS?
|
|
135
|
+
|
|
136
|
+
### `A.` 3.7GB in 2.7 Seconds runnng on pypy3, it's almost as fast as tsduck written in C++
|
|
137
|
+
|
|
138
|
+
## Here's a test of tsduck, the old threefive, threefive3, and SuperKarate DeathCar.
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+

|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
88
145
|
# Checkout the Super Cool SCTE-35 [__Examples__](https://github.com/superkabuki/threefive3/tree/main/examples)
|
|
89
146
|
<br>
|
|
90
147
|
|
|
91
|
-
# threefive3 v3.0.39 is ready
|
|
92
148
|
|
|
93
149
|
* Xml is back and better than ever. __The new Ultra Xml Parser Supreme__ replaces the Super Xml Parser.
|
|
94
150
|
|
|
95
151
|
|
|
96
152
|
# `Documentation`
|
|
97
|
-
|
|
153
|
+
### Install
|
|
98
154
|
* [Install](#install)
|
|
99
155
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
156
|
+
### Examples
|
|
157
|
+
* [__Examples__](https://github.com/superkabuki/threefive3/tree/main/examples)
|
|
158
|
+
### XML
|
|
159
|
+
* [XML](https://github.com/superkabuki/SCTE-35/blob/main/xml.md) __New__! _updated 05/01/2025_
|
|
103
160
|
### Cli
|
|
104
|
-
|
|
105
161
|
* [SCTE-35 Cli Super Tool](#the-cli-tool) Encodes, Decodes, and Recodes. This is pretty cool, it does SCTE-35 seven different ways.
|
|
106
162
|
* The cli tool comes with builtin documentation just type `threefive3 help`
|
|
107
|
-
|
|
108
163
|
### HLS
|
|
109
164
|
* [Advanced Parsing of SCTE-35 in HLS with threefive3](https://github.com/superkabuki/threefive3/blob/main/hls.md) All HLS SCTE-35 tags, Sidecar Files, AAC ID3 Header Timestamps, SCTE-35 filters... Who loves you baby?
|
|
110
|
-
|
|
111
|
-
|
|
112
165
|
### `Classes`
|
|
113
166
|
* The python built in help is always the most up to date docs for the library.
|
|
114
167
|
|
|
@@ -590,5 +643,6 @@ a@fu:~$
|
|
|
590
643
|
|
|
591
644
|
|
|
592
645
|
___
|
|
593
|
-
|
|
594
|
-
|
|
646
|
+
[__Install__](#install) |[__SCTE-35 Cli__](#the-cli-tool) | [__SCTE-35 HLS__](https://github.com/superkabuki/threefive3/blob/main/hls.md) | [__Cue__ Class](https://github.com/superkabuki/threefive3/blob/main/cue.md) | [__Stream__ Class](https://github.com/superkabuki/threefive3/blob/main/stream.md) | [__Online SCTE-35 Parser__](https://iodisco.com/scte35) | [__Encode SCTE-35__](https://github.com/superkabuki/threefive3/blob/main/encode.md) | [__SCTE-35 Examples__](https://github.com/superkabuki/threefive3/tree/main/examples)
|
|
647
|
+
| [__SCTE-35 XML__ updated 04/24/2025](https://github.com/superkabuki/SCTE-35/blob/main/xml.md) | [__threefive3 runs Four Times Faster on pypy3__](https://pypy.org/)
|
|
648
|
+
|
|
@@ -1,59 +1,105 @@
|
|
|
1
|
-
[__Install__](#install) |[__SCTE-35 Cli__](#the-cli-tool) | [__SCTE-35 HLS__](https://github.com/superkabuki/threefive3/blob/main/hls.md) | [__Cue__ Class](https://github.com/superkabuki/threefive3/blob/main/cue.md) | [__Stream__ Class](https://github.com/superkabuki/threefive3/blob/main/stream.md) | [__Online SCTE-35 Parser__](https://iodisco.com/scte35) | [__Encode SCTE-35__](https://github.com/superkabuki/threefive3/blob/main/encode.md) | [__SCTE-35 Examples__](https://github.com/superkabuki/threefive3/tree/main/examples)
|
|
2
|
-
| [__SCTE-35 XML__](https://github.com/superkabuki/SCTE-35/blob/main/xml.md)
|
|
3
1
|
|
|
4
2
|
|
|
3
|
+
I've spent the last five years doing nothing but SCTE-35, a lot of people consider me a subject matter expert, other people describe me with adjectives. ~Adrian
|
|
5
4
|
|
|
6
|
-
# threefive3 is ready.
|
|
7
|
-
✅ SCTE-35 __Parser__ ✅ SCTE-35 __Encoder__ ✅ SCTE-35 __HLS__ ✅ SCTE-35 __Xml+binary__ ✅ SCTE-35 __Cli__ ✅ SCTE-35 __library__
|
|
8
5
|
|
|
9
6
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
# Heads up, I'm about to push v3.0.43
|
|
17
|
-
<pre>
|
|
18
|
-
Q.
|
|
19
|
-
Why the release?
|
|
20
|
-
|
|
21
|
-
A.
|
|
22
|
-
I made a mistake with the xml method in the Cue class. I intended it to return a node instance,
|
|
23
|
-
but instead I had it return just the xml output of a Node instance, not a big deal really,
|
|
24
|
-
but everything else returns a node instance from their xml() method, Cue should too..
|
|
25
|
-
I don't want people getting used to it not return a Node instance.
|
|
26
|
-
v3.0.43 fixes Cue.xml() to return a Node instance.
|
|
27
|
-
I also added more autodetection of SCTE-35 Formats to the Cue class,
|
|
28
|
-
no other SCTE-35 software can do even half of these.
|
|
29
|
-
Base64,
|
|
30
|
-
Bytes,
|
|
31
|
-
Dicts,
|
|
32
|
-
MPEGTS SCTE-35 packets,
|
|
33
|
-
Hex (literal and string),
|
|
34
|
-
Integers (literal, bytestring,and string),
|
|
35
|
-
JSON(strings and bytestrings),
|
|
36
|
-
XML(string and bytestring)
|
|
37
|
-
XML+Binary(string and bytestring)
|
|
38
|
-
|
|
39
|
-
I brought in the PMT module,that really cleans SixFix and SuperKabuki up a lot.
|
|
40
|
-
SuperKabuki is now a subclass of SixFix instead of the Stream class, that gets rid of a lot
|
|
41
|
-
of redundant code.
|
|
42
|
-
|
|
43
|
-
The Super Kabuki MPEGTS SCTE-35 Packet Injection Engine is working really really well.
|
|
44
|
-
I've tested the SuperKabuki output with ffmpeg and tsduck and everything works.
|
|
45
|
-
It's workinng perfectly for me, so I want to get it out there and see if y'all break it. :)
|
|
46
|
-
</pre>
|
|
7
|
+
# threefive3 is SCTE-35.
|
|
8
|
+
## The Most Advanced SCTE-35 Parser on the Planet.
|
|
9
|
+
### If you're working with SCTE-35, this is the tool you want.
|
|
10
|
+
|
|
11
|
+
[__Install__](#install) |[__SCTE-35 Cli__](#the-cli-tool) | [__SCTE-35 HLS__](https://github.com/superkabuki/threefive3/blob/main/hls.md) | [__Cue__ Class](https://github.com/superkabuki/threefive3/blob/main/cue.md) | [__Stream__ Class](https://github.com/superkabuki/threefive3/blob/main/stream.md) | [__Online SCTE-35 Parser__](https://iodisco.com/scte35) | [__Encode SCTE-35__](https://github.com/superkabuki/threefive3/blob/main/encode.md) | [__SCTE-35 Examples__](https://github.com/superkabuki/threefive3/tree/main/examples)
|
|
12
|
+
| [__SCTE-35 XML__ updated 05/01/2025](https://github.com/superkabuki/SCTE-35/blob/main/xml.md) | [__threefive3 runs Four Times Faster on pypy3__](https://pypy.org/)
|
|
47
13
|
|
|
14
|
+
✅ SCTE-35 __Parser__ <br>
|
|
15
|
+
✅ SCTE-35 __Decoder__ <br>
|
|
16
|
+
✅ SCTE-35 __Encoder__ <br>
|
|
17
|
+
✅ SCTE-35 __HLS__ ( All SCTE-35 HLS tag formats) <br>
|
|
18
|
+
✅ SCTE-35 __DASH__ ( All SCTE-35 Xml formats) <br>
|
|
19
|
+
✅ SCTE-35 __XML__ <br>
|
|
20
|
+
✅ SCTE-35 __Cli__ <br>
|
|
21
|
+
✅ SCTE-35 __library__ <br>
|
|
22
|
+
|
|
23
|
+
* Parses __SCTE-35__ from MPEGTS, HLS, XML, MPD, XML+Binary, Base64, Bytes, Hex, Integers, or JSON.
|
|
24
|
+
* Encode __SCTE-35__ to Base64, Bytes, Hex, Int, JSON,XML, or Xml+binary.
|
|
25
|
+
* __All HLS SCTE-35 Tags__ are Supported.
|
|
26
|
+
* __Automatic AES decryption__ for HLS.
|
|
27
|
+
* Built-in __Multicast Sender and Receiver__ _hell yes!_
|
|
28
|
+
* The __SuperKabuki SCTE-35 MPEGTS Packet Injection Engine__ was added to __threefive3__ v3.0.39
|
|
48
29
|
|
|
49
|
-
|
|
50
|
-
_Released Thursday April 18th, 2025
|
|
51
|
-
* just 4300 lines of code.
|
|
52
|
-
* cyclomatic complexity __2.05__
|
|
53
|
-
> Stay up to date, only the latest release is supported.
|
|
30
|
+
#### `Q.` What is SCTE-35?
|
|
54
31
|
|
|
32
|
+
#### `A.` SCTE-35 is just encoded binary data, that decodes into about 100 different vars. This blob of data is used to signal when to splice in Ad Breaks with commercials and such. The variables are used to facillitate this action and to help determine the type and length of commercials. As with most things related to streaming video, it's way more complicated than it needs to be, and there are way too many options.
|
|
55
33
|
|
|
56
34
|
|
|
35
|
+
<br>
|
|
36
|
+
|
|
37
|
+
### Heads up, v3.0.45 is ready to roll.
|
|
38
|
+
* I'm trying to break anything that will break tonight, so I can fix it later today.
|
|
39
|
+
* if you have an issue, post it.
|
|
40
|
+
* I spent last night tricking out the Node class.
|
|
41
|
+
### [Super Cool new xml stuff in threefive v3.0.45](node.md)
|
|
42
|
+
### The new xml stuff is really sweet, you can even pass an DASH MPD directly to a Cue instance, and it will parse the first EVent with SCTE-35 it finds. Let me show you.
|
|
43
|
+
```py3
|
|
44
|
+
a@fu:~/threefive3$ pypy3
|
|
45
|
+
|
|
46
|
+
Python 3.9.16 (7.3.11+dfsg-2+deb12u3, Dec 30 2024, 22:36:23)
|
|
47
|
+
[PyPy 7.3.11 with GCC 12.2.0] on linux
|
|
48
|
+
Type "help", "copyright", "credits" or "license" for more information.
|
|
49
|
+
>>>>
|
|
50
|
+
>>>> from threefive3 import Cue,reader
|
|
51
|
+
>>>> data = reader('https://demo.unified-streaming.com/k8s/live/stable/scte35-n\
|
|
52
|
+
o-splicing.isml/.mpd').read().strip().decode() # use reader to pull the mpd over a network.
|
|
53
|
+
>>>> cue=Cue(data) # pass in to a Cue instance
|
|
54
|
+
>>>> cue.show()
|
|
55
|
+
{
|
|
56
|
+
"info_section": {
|
|
57
|
+
"table_id": "0xfc",
|
|
58
|
+
"section_syntax_indicator": false,
|
|
59
|
+
"private": false,
|
|
60
|
+
"sap_type": "0x03",
|
|
61
|
+
"sap_details": "No Sap Type",
|
|
62
|
+
"section_length": 32,
|
|
63
|
+
"protocol_version": 0,
|
|
64
|
+
"encrypted_packet": false,
|
|
65
|
+
"encryption_algorithm": 0,
|
|
66
|
+
"pts_adjustment": 0.0,
|
|
67
|
+
"cw_index": "0x00",
|
|
68
|
+
"tier": "0x0fff",
|
|
69
|
+
"splice_command_length": 15,
|
|
70
|
+
"splice_command_type": 5,
|
|
71
|
+
"descriptor_loop_length": 0,
|
|
72
|
+
"crc": "0xe4612424"
|
|
73
|
+
},
|
|
74
|
+
"command": {
|
|
75
|
+
"command_length": 15,
|
|
76
|
+
"command_type": 5,
|
|
77
|
+
"name": "Splice Insert",
|
|
78
|
+
"break_auto_return": true,
|
|
79
|
+
"break_duration": 38.4,
|
|
80
|
+
"splice_event_id": 14432855,
|
|
81
|
+
"splice_event_cancel_indicator": false,
|
|
82
|
+
"out_of_network_indicator": true,
|
|
83
|
+
"program_splice_flag": true,
|
|
84
|
+
"duration_flag": true,
|
|
85
|
+
"splice_immediate_flag": true,
|
|
86
|
+
"event_id_compliance_flag": true,
|
|
87
|
+
"unique_program_id": 49152,
|
|
88
|
+
"avail_num": 0,
|
|
89
|
+
"avails_expected": 0
|
|
90
|
+
},
|
|
91
|
+
"descriptors": []
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
# Latest release is v3.0.45
|
|
95
|
+
|
|
96
|
+
* cyclomatic complexity __2.01__ ,__That's a kickass score.__
|
|
97
|
+
|
|
98
|
+
* pylint score is __9.65/10__, _this needs a liitle work_.
|
|
99
|
+
|
|
100
|
+
> Stay up to date, only the latest release is supported.
|
|
101
|
+
>
|
|
102
|
+
|
|
57
103
|
## MPEGTS streams can be parsed for SCTE-35 with three lines of code.
|
|
58
104
|
|
|
59
105
|
```py3
|
|
@@ -64,30 +110,37 @@ a@fu:~/build5/scte35/scte35$ pypy3
|
|
|
64
110
|
>>>> strm.decode()
|
|
65
111
|
```
|
|
66
112
|
|
|
113
|
+
### `Q.` Come on man, python is a damn scripting language, how fast can it be parsing MPEGTS?
|
|
114
|
+
|
|
115
|
+
### `A.` 3.7GB in 2.7 Seconds runnng on pypy3, it's almost as fast as tsduck written in C++
|
|
116
|
+
|
|
117
|
+
## Here's a test of tsduck, the old threefive, threefive3, and SuperKarate DeathCar.
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+

|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
67
124
|
# Checkout the Super Cool SCTE-35 [__Examples__](https://github.com/superkabuki/threefive3/tree/main/examples)
|
|
68
125
|
<br>
|
|
69
126
|
|
|
70
|
-
# threefive3 v3.0.39 is ready
|
|
71
127
|
|
|
72
128
|
* Xml is back and better than ever. __The new Ultra Xml Parser Supreme__ replaces the Super Xml Parser.
|
|
73
129
|
|
|
74
130
|
|
|
75
131
|
# `Documentation`
|
|
76
|
-
|
|
132
|
+
### Install
|
|
77
133
|
* [Install](#install)
|
|
78
134
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
135
|
+
### Examples
|
|
136
|
+
* [__Examples__](https://github.com/superkabuki/threefive3/tree/main/examples)
|
|
137
|
+
### XML
|
|
138
|
+
* [XML](https://github.com/superkabuki/SCTE-35/blob/main/xml.md) __New__! _updated 05/01/2025_
|
|
82
139
|
### Cli
|
|
83
|
-
|
|
84
140
|
* [SCTE-35 Cli Super Tool](#the-cli-tool) Encodes, Decodes, and Recodes. This is pretty cool, it does SCTE-35 seven different ways.
|
|
85
141
|
* The cli tool comes with builtin documentation just type `threefive3 help`
|
|
86
|
-
|
|
87
142
|
### HLS
|
|
88
143
|
* [Advanced Parsing of SCTE-35 in HLS with threefive3](https://github.com/superkabuki/threefive3/blob/main/hls.md) All HLS SCTE-35 tags, Sidecar Files, AAC ID3 Header Timestamps, SCTE-35 filters... Who loves you baby?
|
|
89
|
-
|
|
90
|
-
|
|
91
144
|
### `Classes`
|
|
92
145
|
* The python built in help is always the most up to date docs for the library.
|
|
93
146
|
|
|
@@ -569,5 +622,6 @@ a@fu:~$
|
|
|
569
622
|
|
|
570
623
|
|
|
571
624
|
___
|
|
572
|
-
|
|
573
|
-
|
|
625
|
+
[__Install__](#install) |[__SCTE-35 Cli__](#the-cli-tool) | [__SCTE-35 HLS__](https://github.com/superkabuki/threefive3/blob/main/hls.md) | [__Cue__ Class](https://github.com/superkabuki/threefive3/blob/main/cue.md) | [__Stream__ Class](https://github.com/superkabuki/threefive3/blob/main/stream.md) | [__Online SCTE-35 Parser__](https://iodisco.com/scte35) | [__Encode SCTE-35__](https://github.com/superkabuki/threefive3/blob/main/encode.md) | [__SCTE-35 Examples__](https://github.com/superkabuki/threefive3/tree/main/examples)
|
|
626
|
+
| [__SCTE-35 XML__ updated 04/24/2025](https://github.com/superkabuki/SCTE-35/blob/main/xml.md) | [__threefive3 runs Four Times Faster on pypy3__](https://pypy.org/)
|
|
627
|
+
|
|
@@ -11,9 +11,14 @@ from .iframes import IFramer
|
|
|
11
11
|
from .new_reader import reader
|
|
12
12
|
from .section import SpliceInfoSection
|
|
13
13
|
from .segment import Segment
|
|
14
|
+
from .sixfix import SixFix
|
|
14
15
|
from .stream import Stream
|
|
15
|
-
from .stuff import print2, iso8601, atohif, red, blue, ERR
|
|
16
|
+
from .stuff import print2, iso8601, atohif, red, blue, ERR, clean, rmap
|
|
17
|
+
from .superkabuki import SuperKabuki
|
|
18
|
+
from .upids import AirId, Atsc, Eidr, Isan, Mid, Mpu, NoUpid, Umid, Upid, upid_map
|
|
19
|
+
from .uxp import UltraXmlParser
|
|
16
20
|
from .version import version
|
|
21
|
+
from .xml import Node
|
|
17
22
|
|
|
18
23
|
from .commands import (
|
|
19
24
|
SpliceCommand,
|
|
@@ -17,6 +17,7 @@ class Bitn:
|
|
|
17
17
|
self.bitsize = self.idx = len(bites) << 3
|
|
18
18
|
self.bits = int.from_bytes(bites, byteorder="big")
|
|
19
19
|
|
|
20
|
+
|
|
20
21
|
def __repr__(self):
|
|
21
22
|
return str(vars(self))
|
|
22
23
|
|
|
@@ -159,7 +160,7 @@ class NBin:
|
|
|
159
160
|
else:
|
|
160
161
|
dehexed = hex_str
|
|
161
162
|
self.add_int(dehexed, bit_len)
|
|
162
|
-
|
|
163
|
+
|
|
163
164
|
def add_flag(self, flg, bit_len=1):
|
|
164
165
|
"""
|
|
165
166
|
add_flag takes a boolean
|
|
@@ -92,7 +92,7 @@ class PrivateCommand(SpliceCommand):
|
|
|
92
92
|
"""
|
|
93
93
|
attrs = {"identifier": self.identifier}
|
|
94
94
|
pc = Node("PrivateCommand", attrs=attrs)
|
|
95
|
-
pc.
|
|
95
|
+
pc.addchild(Node("PrivateBytes", value=self.private_bytes.hex(), ns=ns))
|
|
96
96
|
return pc
|
|
97
97
|
|
|
98
98
|
|
|
@@ -183,7 +183,7 @@ class TimeSignal(SpliceCommand):
|
|
|
183
183
|
attrs={"pts_time": self.as_ticks(self.pts_time)},
|
|
184
184
|
ns=ns,
|
|
185
185
|
)
|
|
186
|
-
ts.
|
|
186
|
+
ts.addchild(st)
|
|
187
187
|
return ts
|
|
188
188
|
|
|
189
189
|
|
|
@@ -301,15 +301,15 @@ class SpliceInsert(TimeSignal):
|
|
|
301
301
|
st = Node(
|
|
302
302
|
"SpliceTime", attrs={"ptsTime": self.as_ticks(self.pts_time)}, ns=ns
|
|
303
303
|
)
|
|
304
|
-
prgm.
|
|
305
|
-
si.
|
|
304
|
+
prgm.addchild(st)
|
|
305
|
+
si.addchild(prgm)
|
|
306
306
|
if self.break_duration:
|
|
307
307
|
bd_attrs = {
|
|
308
308
|
"auto_return": self.break_auto_return,
|
|
309
309
|
"duration": self.as_ticks(self.break_duration),
|
|
310
310
|
}
|
|
311
311
|
bd = Node("BreakDuration", attrs=bd_attrs, ns=ns)
|
|
312
|
-
si.
|
|
312
|
+
si.addchild(bd)
|
|
313
313
|
return si
|
|
314
314
|
|
|
315
315
|
|
|
@@ -4,12 +4,11 @@ crc.py crc32 function for encoding.
|
|
|
4
4
|
|
|
5
5
|
from .words import zero, one, eight, twentyfour, twofiftyfive, twofiftysix
|
|
6
6
|
|
|
7
|
-
BC_MASK
|
|
7
|
+
BC_MASK= 0x80000000
|
|
8
8
|
POLY = 0x104C11DB7
|
|
9
9
|
INIT_VALUE = 0xFFFFFFFF
|
|
10
10
|
GONZO = INIT_VALUE - 0xFF
|
|
11
11
|
|
|
12
|
-
|
|
13
12
|
def _bytecrc(crc, poly):
|
|
14
13
|
i = eight
|
|
15
14
|
while i:
|
|
@@ -25,6 +25,7 @@ from .words import (
|
|
|
25
25
|
sixteen,
|
|
26
26
|
equalsign,
|
|
27
27
|
)
|
|
28
|
+
from .xml import Node
|
|
28
29
|
from .uxp import xml2cue
|
|
29
30
|
|
|
30
31
|
|
|
@@ -169,11 +170,11 @@ class Cue(SCTE35Base):
|
|
|
169
170
|
return red("Bad Base64")
|
|
170
171
|
|
|
171
172
|
def _str_bits(self, data):
|
|
172
|
-
if ishex(data):
|
|
173
|
-
return self._hex_bits(clean(data))
|
|
174
173
|
if isxml(data) or isjson(data):
|
|
175
174
|
self.load(data)
|
|
176
175
|
return self.bites
|
|
176
|
+
if ishex(data):
|
|
177
|
+
return self._hex_bits(clean(data))
|
|
177
178
|
data = data.strip()
|
|
178
179
|
if data.isdigit():
|
|
179
180
|
return self._int_bits(int(data))
|
|
@@ -188,29 +189,50 @@ class Cue(SCTE35Base):
|
|
|
188
189
|
return data
|
|
189
190
|
|
|
190
191
|
def _byte_bits(self, data):
|
|
191
|
-
data
|
|
192
|
-
|
|
192
|
+
if isxml(data) or isjson(data):
|
|
193
|
+
self.load(data)
|
|
194
|
+
else:
|
|
195
|
+
data = self._pkt_bits(data)
|
|
196
|
+
self.bites = self.idxsplit(data, b"\xfc")
|
|
197
|
+
return self.bites
|
|
198
|
+
|
|
199
|
+
def _node_bits(self, data):
|
|
200
|
+
data = data.mk()
|
|
201
|
+
self._from_xml(data)
|
|
202
|
+
return self.bites
|
|
203
|
+
|
|
204
|
+
def _dict_bits(self, data):
|
|
205
|
+
self.load(data)
|
|
193
206
|
return self.bites
|
|
194
207
|
|
|
195
208
|
def _mk_bits(self, data):
|
|
196
209
|
"""
|
|
197
|
-
cue._mk_bits
|
|
198
|
-
|
|
199
|
-
"""
|
|
200
|
-
|
|
201
|
-
self.
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
210
|
+
cue._mk_bits converts
|
|
211
|
+
several SCTE-35 formats into bytes.
|
|
212
|
+
"""
|
|
213
|
+
type_map = {
|
|
214
|
+
Node: self._node_bits,
|
|
215
|
+
dict: self._dict_bits,
|
|
216
|
+
str: self._str_bits,
|
|
217
|
+
bytes: self._byte_bits,
|
|
218
|
+
int: self._int_bits,
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
td = type(data)
|
|
222
|
+
if td in type_map.keys():
|
|
223
|
+
return type_map[td](data)
|
|
224
|
+
|
|
225
|
+
## if isinstance(data,Node):
|
|
226
|
+
## return self._node_bits(data)
|
|
227
|
+
## if isinstance(data, dict):
|
|
228
|
+
## return self.dict_bits(data)
|
|
229
|
+
## if isinstance(data, str):
|
|
230
|
+
## return self._str_bits(data)
|
|
231
|
+
## if isinstance(data, bytes):
|
|
232
|
+
## return self._byte_bits(data)
|
|
233
|
+
## if isinstance(data, int):
|
|
234
|
+
## return self._int_bits(data)
|
|
235
|
+
## return self.bites
|
|
214
236
|
|
|
215
237
|
def _mk_descriptors(self, bites):
|
|
216
238
|
"""
|
|
@@ -418,8 +440,8 @@ class Cue(SCTE35Base):
|
|
|
418
440
|
be loaded by a Cue instance.
|
|
419
441
|
"""
|
|
420
442
|
gonzo = clean(gonzo)
|
|
421
|
-
if "
|
|
422
|
-
dat = gonzo.split("
|
|
443
|
+
if "Binary" in gonzo:
|
|
444
|
+
dat = gonzo.split("Binary>", 1)[1].split("<", 1)[0]
|
|
423
445
|
self.bites = self._mk_bits(dat)
|
|
424
446
|
self.decode()
|
|
425
447
|
elif "SpliceInfoSection" in gonzo:
|
|
@@ -435,7 +457,7 @@ class Cue(SCTE35Base):
|
|
|
435
457
|
comment = (
|
|
436
458
|
f"Segmentation type id {dscptr.segmentation_type_id} is not in table 22"
|
|
437
459
|
)
|
|
438
|
-
sis.
|
|
460
|
+
sis.addcomment(comment)
|
|
439
461
|
|
|
440
462
|
def _xml_mk_descriptor(self, sis, ns):
|
|
441
463
|
"""
|
|
@@ -444,7 +466,7 @@ class Cue(SCTE35Base):
|
|
|
444
466
|
for dscptr in self.descriptors:
|
|
445
467
|
if dscptr.has("segmentation_type_id"):
|
|
446
468
|
self._xml_segmentation_comment(dscptr, sis)
|
|
447
|
-
sis.
|
|
469
|
+
sis.addchild(dscptr.xml(ns=ns))
|
|
448
470
|
return sis
|
|
449
471
|
|
|
450
472
|
def xml(self, ns="scte35"):
|
|
@@ -455,7 +477,7 @@ class Cue(SCTE35Base):
|
|
|
455
477
|
"""
|
|
456
478
|
sis = self.info_section.xml(ns=ns)
|
|
457
479
|
cmd = self.command.xml(ns=ns)
|
|
458
|
-
sis.
|
|
480
|
+
sis.addchild(cmd)
|
|
459
481
|
sis = self._xml_mk_descriptor(sis, ns)
|
|
460
482
|
return sis # xml retuns a Node instance. now
|
|
461
483
|
|