threefive 3.0.770b0__tar.gz → 3.1.3__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.
- threefive-3.1.3/PKG-INFO +747 -0
- threefive-3.1.3/README.md +728 -0
- {threefive-3.0.770b0 → threefive-3.1.3}/pyproject.toml +4 -9
- {threefive-3.0.770b0 → threefive-3.1.3}/threefive/__init__.py +3 -13
- {threefive-3.0.770b0 → threefive-3.1.3}/threefive/aac.py +2 -2
- {threefive-3.0.770b0 → threefive-3.1.3}/threefive/base.py +23 -16
- {threefive-3.0.770b0 → threefive-3.1.3}/threefive/bitn.py +45 -21
- threefive-3.1.3/threefive/cli.py +468 -0
- threefive-3.1.3/threefive/crctable.py +34 -0
- {threefive-3.0.770b0 → threefive-3.1.3}/threefive/cue.py +49 -27
- {threefive-3.0.770b0 → threefive-3.1.3}/threefive/descriptors.py +203 -0
- {threefive-3.0.770b0 → threefive-3.1.3}/threefive/encode.py +1 -1
- {threefive-3.0.770b0 → threefive-3.1.3}/threefive/gums.py +12 -15
- {threefive-3.0.770b0 → threefive-3.1.3}/threefive/hls.py +17 -17
- {threefive-3.0.770b0 → threefive-3.1.3}/threefive/hlstags.py +9 -2
- {threefive-3.0.770b0 → threefive-3.1.3}/threefive/new_reader.py +41 -12
- {threefive-3.0.770b0 → threefive-3.1.3}/threefive/segment.py +17 -17
- {threefive-3.0.770b0 → threefive-3.1.3}/threefive/sixfix.py +11 -10
- {threefive-3.0.770b0 → threefive-3.1.3}/threefive/stream.py +193 -231
- {threefive-3.0.770b0 → threefive-3.1.3}/threefive/streamtypes.py +4 -4
- {threefive-3.0.770b0 → threefive-3.1.3}/threefive/stuff.py +6 -6
- {threefive-3.0.770b0 → threefive-3.1.3}/threefive/superkabuki.py +3 -1
- {threefive-3.0.770b0 → threefive-3.1.3}/threefive/throttle.py +34 -13
- {threefive-3.0.770b0 → threefive-3.1.3}/threefive/udp.py +3 -18
- {threefive-3.0.770b0 → threefive-3.1.3}/threefive/upids.py +2 -2
- {threefive-3.0.770b0 → threefive-3.1.3}/threefive/version.py +2 -2
- threefive-3.1.3/threefive.egg-info/PKG-INFO +747 -0
- {threefive-3.0.770b0 → threefive-3.1.3}/threefive.egg-info/SOURCES.txt +0 -2
- {threefive-3.0.770b0 → threefive-3.1.3}/threefive.egg-info/entry_points.txt +0 -1
- threefive-3.0.770b0/PKG-INFO +0 -805
- threefive-3.0.770b0/README.md +0 -782
- threefive-3.0.770b0/threefive/bump.py +0 -236
- threefive-3.0.770b0/threefive/cli.py +0 -519
- threefive-3.0.770b0/threefive/crctable.py +0 -258
- threefive-3.0.770b0/threefive.egg-info/PKG-INFO +0 -805
- threefive-3.0.770b0/threefive.egg-info/requires.txt +0 -2
- {threefive-3.0.770b0 → threefive-3.1.3}/LICENSE +0 -0
- {threefive-3.0.770b0 → threefive-3.1.3}/setup.cfg +0 -0
- {threefive-3.0.770b0 → threefive-3.1.3}/threefive/commands.py +0 -0
- {threefive-3.0.770b0 → threefive-3.1.3}/threefive/crc.py +0 -0
- {threefive-3.0.770b0 → threefive-3.1.3}/threefive/hlsprofile.py +0 -0
- {threefive-3.0.770b0 → threefive-3.1.3}/threefive/iframes.py +0 -0
- {threefive-3.0.770b0 → threefive-3.1.3}/threefive/packetdata.py +0 -0
- {threefive-3.0.770b0 → threefive-3.1.3}/threefive/pmt.py +0 -0
- {threefive-3.0.770b0 → threefive-3.1.3}/threefive/section.py +0 -0
- {threefive-3.0.770b0 → threefive-3.1.3}/threefive/segmentation.py +0 -0
- {threefive-3.0.770b0 → threefive-3.1.3}/threefive/speedo.py +0 -0
- {threefive-3.0.770b0 → threefive-3.1.3}/threefive/uxp.py +0 -0
- {threefive-3.0.770b0 → threefive-3.1.3}/threefive/xml.py +0 -0
- {threefive-3.0.770b0 → threefive-3.1.3}/threefive.egg-info/dependency_links.txt +0 -0
- {threefive-3.0.770b0 → threefive-3.1.3}/threefive.egg-info/top_level.txt +0 -0
threefive-3.1.3/PKG-INFO
ADDED
|
@@ -0,0 +1,747 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: threefive
|
|
3
|
+
Version: 3.1.3
|
|
4
|
+
Summary: The Undisputed Heavyweight Champion of SCTE-35.
|
|
5
|
+
Author-email: AdrianofDoom <spam@iodisco.com>
|
|
6
|
+
License-Expression: Sleepycat
|
|
7
|
+
Project-URL: Homepage, https://github.com/superkabuki/threefive
|
|
8
|
+
Project-URL: Issues, https://github.com/superkabuki/threefive/issues
|
|
9
|
+
Classifier: Environment :: Console
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Classifier: Topic :: Multimedia :: Video
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
13
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
14
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
15
|
+
Requires-Python: >=3.9
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Dynamic: license-file
|
|
19
|
+
|
|
20
|
+
# [ threefive ]
|
|
21
|
+
|
|
22
|
+
* __Decodes SCTE-35__ from `MPEGTS`✔ `Base64`✔ `Bytes`✔ `DASH`✔ `Hex` ✔ `HLS`✔ `Integers`✔ `JSON`✔ `XML`✔ `XML+Binary`✔
|
|
23
|
+
* __Encodes SCTE-35__ to `MPEGTS`✔ `Base64`✔ `Bytes`✔ `Hex`✔ `Integers`✔ `JSON`✔ `XML`✔ `XML+Binary`✔
|
|
24
|
+
___
|
|
25
|
+
|
|
26
|
+
## Hey Google, what`s the best SCTE-35 software?
|
|
27
|
+
<img width="601" height="518" alt="image" src="https://github.com/user-attachments/assets/c3ff3383-8010-45d7-aa4c-94080b3dcb9f" />
|
|
28
|
+
|
|
29
|
+
### _I told you I knew what I was doing._ ~Adrian
|
|
30
|
+
___
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
# [ version ]
|
|
34
|
+
|
|
35
|
+
### latest threefive version is _v3.1.3_
|
|
36
|
+
* Average cyclomatic complexity: __A (1.9886039886039886)__
|
|
37
|
+
___
|
|
38
|
+
|
|
39
|
+
# [ a really really quick start ]
|
|
40
|
+
|
|
41
|
+
* __Install__
|
|
42
|
+
```
|
|
43
|
+
python3 -m pip install threefive`
|
|
44
|
+
```
|
|
45
|
+
* __decoding SCTE-35__
|
|
46
|
+
|
|
47
|
+
```cobol
|
|
48
|
+
threefive '/DAWAAAAAAAAAP/wBQb+AKmKxwAACzuu2Q=='
|
|
49
|
+
```
|
|
50
|
+
* decode __SCTE-35__ as __base64__ and __convert SCTE-35 to hex__
|
|
51
|
+
```cobol
|
|
52
|
+
threefive '/DAWAAAAAAAAAP/wBQb+AKmKxwAACzuu2Q==' hex
|
|
53
|
+
|
|
54
|
+
* decode __SCTE-35__ from __HLS__ ( a rendition or a master.m3u8)
|
|
55
|
+
```cobol
|
|
56
|
+
threefive 'https://demo.unified-streaming.com/k8s/live/scte35.isml/.m3u8'
|
|
57
|
+
```
|
|
58
|
+
* decode __SCTE-35__ from __MPEGTS__
|
|
59
|
+
```cobol
|
|
60
|
+
threefive 'https;//iodisco.com/longb2.ts'
|
|
61
|
+
```
|
|
62
|
+
* decode __SCTE-35__ from __MPEGTS__ and __convert__ __SCTE-35__ to __bytes__
|
|
63
|
+
```cobol
|
|
64
|
+
threefive 'https;//iodisco.com/longb2.ts' bytes
|
|
65
|
+
```
|
|
66
|
+
* __Multicast__
|
|
67
|
+
* decode __SCTE-35__ from __MPEGTS__ over __Multicast__
|
|
68
|
+
```cobol
|
|
69
|
+
threefive udp://@235.3.5.35:3535
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
* __threefive does a lot more__, that was just to get you started.
|
|
73
|
+
___
|
|
74
|
+
|
|
75
|
+
# [ Documentation ]
|
|
76
|
+
|
|
77
|
+
[A Lot of Examples ](https://github.com/superkabuki/threefive_is_scte35/blob/main/examples) | [ Tip of the Week ](totw.md) | [ Cheap Tricks ](cheaptricks.md) |
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
#### Need to inject SCTE-35 into HLS? [X9k3.](https://github.com/superkabuki/x9k3)
|
|
81
|
+
|
|
82
|
+
* [__web based SCTE-35 tools__](#web) - threefive and friends over http.
|
|
83
|
+
|
|
84
|
+
* [__install__](#install)
|
|
85
|
+
|
|
86
|
+
* [__quick start__](quickstart.md)
|
|
87
|
+
|
|
88
|
+
* ___SCTE-35 on the command line___
|
|
89
|
+
* [ __the threefive cli tool__](#-cli-) _If you work with SCTE-35, this is as cool as it gets._
|
|
90
|
+
|
|
91
|
+
* __other included tools__
|
|
92
|
+
* [__scte35fix__](#scte35fix) _ffmpeg changes scte-35 streams into bin data, scte35fix changes them back._
|
|
93
|
+
* [__scte35inject__](scte35inject.md) _scte35inject inject scte-35 into mpegts._
|
|
94
|
+
* [__gums__](#gums) _gums is a multicast sender(server) for video_
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
* __the threefive library__ _cool code for the cool kids_.
|
|
98
|
+
* [__Using the threefive.Cue class__](lib.md)
|
|
99
|
+
* [__Using the threefive library__](#-using-the-library-) _decode SCTE-35 with less than ten lines of code_
|
|
100
|
+
* * [threefive __Classes__](#classes) _threefive is OO, made to subclass_
|
|
101
|
+
* [__Cue__ Class](https://github.com/superkabuki/threefive/blob/main/cue.md) _this class you'll use often_
|
|
102
|
+
* [__Stream__ Class](https://github.com/superkabuki/threefive/blob/main/stream.md) _this is the class for parsing MPEGTS_
|
|
103
|
+
|
|
104
|
+
* [SCTE-35 __Sidecar Files__](https://github.com/superkabuki/SCTE-35_Sidecar_Files) _threefive supports SCTE-35 sidecar files_
|
|
105
|
+
|
|
106
|
+
* [SCTE-35 __HLS__](https://github.com/superkabuki/threefive/blob/main/hls.md) _parse SCTE-35 in HLS in MPEGTS,CMAF, or fmP4__
|
|
107
|
+
|
|
108
|
+
* [SCTE-35 __XML__ ](https://github.com/superkabuki/SCTE-35/blob/main/xml.md) and [More __XML__](node.md) _threefive can parse and encode SCTE-35 xml_
|
|
109
|
+
|
|
110
|
+
* [__Encode__ SCTE-35](https://github.com/superkabuki/threefive/blob/main/encode.md) _threefive can encode SCTE-35 in every SCTE-35 format_
|
|
111
|
+
|
|
112
|
+
* [Make your __threefive__ script an executable with __cython__](cython.md) _threefive is compatible with all python tools_
|
|
113
|
+
</samp>
|
|
114
|
+
|
|
115
|
+
## [Install]
|
|
116
|
+
|
|
117
|
+
* Requires python3 v3.9 or higher.
|
|
118
|
+
|
|
119
|
+
* __python3 via pip__
|
|
120
|
+
```rebol
|
|
121
|
+
python3 -mpip install threefive
|
|
122
|
+
```
|
|
123
|
+
* __pypy3 via pip__
|
|
124
|
+
```rebol
|
|
125
|
+
pypy3 -mpip install threefive
|
|
126
|
+
```
|
|
127
|
+
* __To add SRT support to threefive install srtfu__
|
|
128
|
+
```py3
|
|
129
|
+
python3 -m pip install srtfu
|
|
130
|
+
```
|
|
131
|
+
* __To add Automatic AES decryption (used to decrypted HLS to threefive install pyaes__
|
|
132
|
+
```py3
|
|
133
|
+
python3 -mpip install pyaes
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
* __From the git repo__
|
|
137
|
+
|
|
138
|
+
```rebol
|
|
139
|
+
git clone https://github.com/superkabuki/scte35.git
|
|
140
|
+
cd threefive
|
|
141
|
+
make install
|
|
142
|
+
```
|
|
143
|
+
* I've jazzed up the makefile to make it easier to install for different python versions and pypy3,
|
|
144
|
+
|
|
145
|
+
```rebol
|
|
146
|
+
git clone https://github.com/superkabuki/threefive.git
|
|
147
|
+
cd threefive
|
|
148
|
+
``
|
|
149
|
+
* `python3` is the default for `make install`
|
|
150
|
+
|
|
151
|
+
```
|
|
152
|
+
make install
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
* setting py3 allows you to install for any type of python interpreter.
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
make install py3=pypy3
|
|
159
|
+
```
|
|
160
|
+
* absolute paths can also be used.
|
|
161
|
+
|
|
162
|
+
```
|
|
163
|
+
make install py3=/home/a/pypy3/bin/pypy3
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
# works for any python in your path or use a full path if needed.
|
|
168
|
+
|
|
169
|
+
```
|
|
170
|
+
#### [⇧](#-documentation-)
|
|
171
|
+
___
|
|
172
|
+
|
|
173
|
+
## [ CLI ]
|
|
174
|
+
threefive is designed to be easy to use. I'm not sure that it's served well by a long explaination, so I'm going to try and keep this brief.
|
|
175
|
+
|
|
176
|
+
### The threefive cli tool.
|
|
177
|
+
|
|
178
|
+
the threefive cli tool decodes SCTE-35, formats are auto-detected, and they all work the same way.
|
|
179
|
+
|
|
180
|
+
__threefive__ __[media to parse for SCTE-35]__
|
|
181
|
+
|
|
182
|
+
examples:
|
|
183
|
+
|
|
184
|
+
*
|
|
185
|
+
```sed
|
|
186
|
+
threefive '/DAWAAAAAAAAAP/wBQb+AKmKxwAACzuu2Q=='
|
|
187
|
+
```
|
|
188
|
+
*
|
|
189
|
+
```sed
|
|
190
|
+
threefive 0xfc301600000000000000fff00506fe00a98ac700000b3baed9
|
|
191
|
+
```
|
|
192
|
+
*
|
|
193
|
+
```sed
|
|
194
|
+
threefive 1583008701074197245727019716796221242036302348025116111908569
|
|
195
|
+
```
|
|
196
|
+
*
|
|
197
|
+
```sed
|
|
198
|
+
threefive video.ts
|
|
199
|
+
```
|
|
200
|
+
*
|
|
201
|
+
```sed
|
|
202
|
+
threefive https://demo.unified-streaming.com/k8s/live/scte35.isml/scte35-audio_eng=64000-video=500000.m3u8
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
* Formats like ___XML and JSON__ that may be to large to type on the command line,they can be __redirected or piped__ in to threefive.
|
|
206
|
+
|
|
207
|
+
* redirect
|
|
208
|
+
```sed
|
|
209
|
+
threefive < xml.xml
|
|
210
|
+
```
|
|
211
|
+
* pipe
|
|
212
|
+
```sed
|
|
213
|
+
cat json.json | threefive
|
|
214
|
+
|
|
215
|
+
```
|
|
216
|
+
### cli outputs and encoding SCTE-35 Formats
|
|
217
|
+
|
|
218
|
+
* the __default output format for threefive is json__
|
|
219
|
+
|
|
220
|
+
* The cli tool can convert from one SCTE-35 format to another using keywords.
|
|
221
|
+
* The keywords are __base64,bytes,hex, int,json,xml, and xmlbin__
|
|
222
|
+
|
|
223
|
+
* some converting and encoding examples
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
* SCTE-35 Base64 to SCTE-35 Hex
|
|
227
|
+
```sed
|
|
228
|
+
threefive '/DAWAAAAAAAAAP/wBQb+AKmKxwAACzuu2Q==' hex
|
|
229
|
+
```
|
|
230
|
+
* SCTE-35 Int to SCTE-35 Xml
|
|
231
|
+
```sed
|
|
232
|
+
threefive 1583008701074197245727019716796221242036302348025116111908569 xml
|
|
233
|
+
```
|
|
234
|
+
* SCTE-35 Hex to SCTE-35 xml+binary
|
|
235
|
+
```sed
|
|
236
|
+
threefive 0xfc301600000000000000fff00506fe00a98ac700000b3baed9 xmlbin
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
### threefive cli and MPEGTS
|
|
240
|
+
* threefive can parse MPEGTS from stdin, local files, HTTP(s), Multicast, SRT, and unicast UDP.
|
|
241
|
+
|
|
242
|
+
* some mpegts examples
|
|
243
|
+
|
|
244
|
+
* local
|
|
245
|
+
```sed
|
|
246
|
+
threefive video.ts
|
|
247
|
+
```
|
|
248
|
+
* stdin
|
|
249
|
+
```sed
|
|
250
|
+
cat video.ts | threefive
|
|
251
|
+
```
|
|
252
|
+
* https
|
|
253
|
+
```sed
|
|
254
|
+
threefive https://iodisco.com/longb2.ts
|
|
255
|
+
```
|
|
256
|
+
* multicast
|
|
257
|
+
```sed
|
|
258
|
+
threefive udp://@235.35.3.5:3535
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
### threefive cli MPEGTS outputs
|
|
262
|
+
|
|
263
|
+
* the __default output for MPEGTS is json__
|
|
264
|
+
|
|
265
|
+
* keywords can be used to specify other output formats
|
|
266
|
+
* The keywords are __base64,bytes,hex, int,json,xml, and xmlbin__
|
|
267
|
+
|
|
268
|
+
* An example of mpegts with a keyword
|
|
269
|
+
```
|
|
270
|
+
threefive https://iodisco.com/longb2.ts xml
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
___
|
|
275
|
+
|
|
276
|
+
#### [⇧](#-documentation-)
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
##### Other tools
|
|
280
|
+
|
|
281
|
+
threefive also comes with:
|
|
282
|
+
|
|
283
|
+
##### gums
|
|
284
|
+
* the Grande Udp Multicast Server
|
|
285
|
+
|
|
286
|
+
```js
|
|
287
|
+
$ gums -h
|
|
288
|
+
usage: gums [-h] [-i INPUT] [-a ADDR] [-b BIND_ADDR] [-t TTL]
|
|
289
|
+
|
|
290
|
+
options:
|
|
291
|
+
-h, --help show this help message and exit
|
|
292
|
+
-i INPUT, --input INPUT
|
|
293
|
+
like "/home/a/vid.ts" or "https://futzu.com/xaa.ts"
|
|
294
|
+
[default: sys.stdin.buffer]
|
|
295
|
+
-a ADDR, --addr ADDR Destination IP:Port [default: 235.35.3.5:3535]
|
|
296
|
+
-b BIND_ADDR, --bind_addr BIND_ADDR
|
|
297
|
+
Local IP to bind [default: 0.0.0.0]
|
|
298
|
+
-t TTL, --ttl TTL Multicast TTL (1 - 255) [default: 32]
|
|
299
|
+
|
|
300
|
+
gums is part of threefive.
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
#### [⇧](#-documentation-)
|
|
304
|
+
|
|
305
|
+
#### HLS
|
|
306
|
+
|
|
307
|
+
* parse HLS for SCTE-35. Supports all HLS SCTE-35 tags.
|
|
308
|
+
|
|
309
|
+
```js
|
|
310
|
+
$ threefive hls help
|
|
311
|
+
```
|
|
312
|
+
```smalltalk
|
|
313
|
+
|
|
314
|
+
[ Input ]
|
|
315
|
+
|
|
316
|
+
A m3u8 URI as input.
|
|
317
|
+
|
|
318
|
+
[what is supported]
|
|
319
|
+
|
|
320
|
+
M3U8 formats: master, rendition
|
|
321
|
+
Segment types: AAC, AC3, MPEGTS, CMAF,fMP4
|
|
322
|
+
Video codecs: mpeg2, h.264, h.265
|
|
323
|
+
Audio codecs: mpeg2, aac, ac3, mp3
|
|
324
|
+
Protocols: File, Http(s), Multicast, SRT, Stdin, UDP
|
|
325
|
+
Encryption: AES-128 (automatic)
|
|
326
|
+
|
|
327
|
+
[ SCTE-35 ]
|
|
328
|
+
|
|
329
|
+
SCTE-35 Embedded Cues as well as all SCTE-35 HLS Tags can be parsed.
|
|
330
|
+
|
|
331
|
+
[ Supported HLS Tags ]
|
|
332
|
+
|
|
333
|
+
* #EXT-OATCLS-SCTE35
|
|
334
|
+
* #EXT-X-CUE-OUT-CONT
|
|
335
|
+
* #EXT-X-DATERANGE
|
|
336
|
+
* #EXT-X-SCTE35
|
|
337
|
+
* #EXT-X-CUE-IN
|
|
338
|
+
* #EXT-X-CUE-OUT
|
|
339
|
+
|
|
340
|
+
[ SCTE-35 Parsing Profiles ]
|
|
341
|
+
|
|
342
|
+
SCTE-35 parsing can be fine tuned by setting a parsing profile.
|
|
343
|
+
|
|
344
|
+
running the command: threefive hls profile
|
|
345
|
+
|
|
346
|
+
will generate a default profile and write a file named hls.profile
|
|
347
|
+
in the current working directory.
|
|
348
|
+
|
|
349
|
+
a@fu:~$ cat hls.profile
|
|
350
|
+
|
|
351
|
+
expand_cues = False
|
|
352
|
+
parse_segments = False
|
|
353
|
+
parse_manifests = True
|
|
354
|
+
hls_tags = #EXT-OATCLS-SCTE35,#EXT-X-CUE-OUT-CONT,
|
|
355
|
+
#EXT-X-DATERANGE,#EXT-X-SCTE35,#EXT-X-CUE-IN,#EXT-X-CUE-OUT
|
|
356
|
+
command_types = 0x6,0x5
|
|
357
|
+
descriptor_tags = 0x2
|
|
358
|
+
starts = 0x22,0x30,0x32,0x34,0x36,0x44,0x46
|
|
359
|
+
|
|
360
|
+
( Integers are show in hex (base 16),
|
|
361
|
+
base 10 unsigned integers can also be used in hls.profile )
|
|
362
|
+
|
|
363
|
+
* expand_cues: set to True to show cues fully expanded as JSON
|
|
364
|
+
* parse_segments: set to true to enable parsing SCTE-35 from MPEGTS.
|
|
365
|
+
* parse_manifests: set to true to parse the m3u8 file for SCTE-35 HLS Tags.
|
|
366
|
+
* hls_tags: set which SCTE-35 HLS Tags to parse.
|
|
367
|
+
* command_types: set which Splice Commands to parse.
|
|
368
|
+
* descriptor_tags: set which Splice Descriptor Tags to parse.
|
|
369
|
+
* starts: set which Segmentation Type IDs to use to start breaks.
|
|
370
|
+
|
|
371
|
+
Edit the file as needed and then run threefive.
|
|
372
|
+
|
|
373
|
+
[ Profile Formatting Rules ]
|
|
374
|
+
|
|
375
|
+
* Values do not need to be quoted.
|
|
376
|
+
* Multiple values are separated by a commas.
|
|
377
|
+
* No partial line comments. Comments must be on a separate lines.
|
|
378
|
+
* Comments can be started with a # or //
|
|
379
|
+
* Integers can be base 10 or base 16
|
|
380
|
+
|
|
381
|
+
[ Output Files ]
|
|
382
|
+
scte35 hls creates a few output files.
|
|
383
|
+
|
|
384
|
+
* Profile rules applied to the output:
|
|
385
|
+
|
|
386
|
+
* hls.m3u8 - live playable rewrite of the m3u8 with the profile SCTE-35 rules.
|
|
387
|
+
* hls.sidecar - list of ( pts, HLS SCTE-35 tag ) pairs
|
|
388
|
+
|
|
389
|
+
* Profile rules not applied to the output:
|
|
390
|
+
|
|
391
|
+
* hlsflat.m3u8 - hls live streams are flattened out into a vod playlist.
|
|
392
|
+
When the live m3u8 first loads, every line is written to hlsflat.m3u8
|
|
393
|
+
Wnen a live m3u8 is reloaded, everything except the headers
|
|
394
|
+
is appended to hlsflat.m3u8. This give you a VOD style m3u8
|
|
395
|
+
so you can fast forward or rewind while playing.
|
|
396
|
+
GREAT for debugging SCTE-35 live hls.
|
|
397
|
+
|
|
398
|
+
[ Cool Features ]
|
|
399
|
+
|
|
400
|
+
* threefive can resume when started in the middle of an ad break.
|
|
401
|
+
|
|
402
|
+
2023-10-13T05:59:50.24Z Resuming Ad Break
|
|
403
|
+
2023-10-13T05:59:50.34Z Setting Break Timer to 17.733
|
|
404
|
+
2023-10-13T05:59:50.44Z Setting Break Duration to 60.067
|
|
405
|
+
|
|
406
|
+
[ Example Usage ]
|
|
407
|
+
|
|
408
|
+
* Show this help: threefive hls help
|
|
409
|
+
|
|
410
|
+
* Generate a new hls.profile: threefive hls profile
|
|
411
|
+
|
|
412
|
+
* parse an m3u8: scte35hls https://example.com/out/master.m3u8
|
|
413
|
+
|
|
414
|
+
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
#### [⇧](#-documentation-)
|
|
418
|
+
|
|
419
|
+
#### __scte35fix__
|
|
420
|
+
|
|
421
|
+
* when ffmpeg changes a SCTE-35 stream to bin data stream, scte35fix changes it back.
|
|
422
|
+
|
|
423
|
+
```js
|
|
424
|
+
$ scte35fix -h
|
|
425
|
+
|
|
426
|
+
scte35fix checks MPEGTS for SCTE-35 Streams
|
|
427
|
+
that have been change to bin data (type 0x06)
|
|
428
|
+
and changes them back to SCTE-35 (type 0x86) streams.
|
|
429
|
+
Output files are created in the current directory
|
|
430
|
+
and prefixed with 'sixfix-'.
|
|
431
|
+
Only bin data streams containing SCTE-35 will be converted.
|
|
432
|
+
Multiple files can be specified on the command line.
|
|
433
|
+
Wild cards work too.
|
|
434
|
+
|
|
435
|
+
Example Usage:
|
|
436
|
+
scte35fix video.ts
|
|
437
|
+
scte35fix video1.ts video2.ts
|
|
438
|
+
scte35fix video*.ts
|
|
439
|
+
scte35fix https://example.com/video.ts
|
|
440
|
+
scte35fix srt://10.10.10.13:4201
|
|
441
|
+
scte35fix is part of threefive.
|
|
442
|
+
```
|
|
443
|
+
___
|
|
444
|
+
|
|
445
|
+
#### [⇧](#-documentation-)
|
|
446
|
+
|
|
447
|
+
## [ Using the library ]
|
|
448
|
+
* Let me show you how easy threefive is to use.
|
|
449
|
+
|
|
450
|
+
* reading SCTE-35 xml from a file
|
|
451
|
+
```py3
|
|
452
|
+
a@fu:~/threefive$ pypy3
|
|
453
|
+
Python 3.9.16 (7.3.11+dfsg-2+deb12u3, Dec 30 2024, 22:36:23)
|
|
454
|
+
[PyPy 7.3.11 with GCC 12.2.0] on linux
|
|
455
|
+
Type "help", "copyright", "credits" or "license" for more information.
|
|
456
|
+
>>>> from threefive import reader
|
|
457
|
+
>>>> from threefive import Cue
|
|
458
|
+
>>>> data =reader('/home/a/xml.xml').read()
|
|
459
|
+
```
|
|
460
|
+
* load it into a threefive.Cue instance
|
|
461
|
+
```py3
|
|
462
|
+
>>>> cue = Cue(data)
|
|
463
|
+
```
|
|
464
|
+
* Show the data as JSON
|
|
465
|
+
```py3
|
|
466
|
+
>>>> cue.show()
|
|
467
|
+
{
|
|
468
|
+
"info_section": {
|
|
469
|
+
"table_id": "0xfc",
|
|
470
|
+
"section_syntax_indicator": false,
|
|
471
|
+
"private": false,
|
|
472
|
+
"sap_type": "0x03",
|
|
473
|
+
"sap_details": "No Sap Type",
|
|
474
|
+
"section_length": 92,
|
|
475
|
+
"protocol_version": 0,
|
|
476
|
+
"encrypted_packet": false,
|
|
477
|
+
"encryption_algorithm": 0,
|
|
478
|
+
"pts_adjustment": 0.0,
|
|
479
|
+
"cw_index": "0x00",
|
|
480
|
+
"tier": "0x0fff",
|
|
481
|
+
"splice_command_length": 15,
|
|
482
|
+
"splice_command_type": 5,
|
|
483
|
+
"descriptor_loop_length": 60,
|
|
484
|
+
"crc": "0x7632935"
|
|
485
|
+
},
|
|
486
|
+
"command": {
|
|
487
|
+
"command_length": 15,
|
|
488
|
+
"command_type": 5,
|
|
489
|
+
"name": "Splice Insert",
|
|
490
|
+
"break_auto_return": false,
|
|
491
|
+
"break_duration": 180.0,
|
|
492
|
+
"splice_event_id": 1073743095,
|
|
493
|
+
"splice_event_cancel_indicator": false,
|
|
494
|
+
"out_of_network_indicator": true,
|
|
495
|
+
"program_splice_flag": false,
|
|
496
|
+
"duration_flag": true,
|
|
497
|
+
"splice_immediate_flag": false,
|
|
498
|
+
"event_id_compliance_flag": true,
|
|
499
|
+
"unique_program_id": 1,
|
|
500
|
+
"avail_num": 12,
|
|
501
|
+
"avails_expected": 5
|
|
502
|
+
},
|
|
503
|
+
"descriptors": [
|
|
504
|
+
{
|
|
505
|
+
"tag": 0,
|
|
506
|
+
"identifier": "CUEI",
|
|
507
|
+
"name": "Avail Descriptor",
|
|
508
|
+
"provider_avail_id": 12,
|
|
509
|
+
"descriptor_length": 8
|
|
510
|
+
},
|
|
511
|
+
{
|
|
512
|
+
"tag": 0,
|
|
513
|
+
"identifier": "CUEI",
|
|
514
|
+
"name": "Avail Descriptor",
|
|
515
|
+
"provider_avail_id": 13,
|
|
516
|
+
"descriptor_length": 8
|
|
517
|
+
},
|
|
518
|
+
|
|
519
|
+
|
|
520
|
+
]
|
|
521
|
+
}
|
|
522
|
+
```
|
|
523
|
+
* convert the data back to xml
|
|
524
|
+
```py3
|
|
525
|
+
>>>> print(cue.xml())
|
|
526
|
+
<scte35:SpliceInfoSection xmlns:scte35="https://scte.org/schemas/35" ptsAdjustment="0" protocolVersion="0" sapType="3" tier="4095">
|
|
527
|
+
<scte35:SpliceInsert spliceEventId="1073743095" spliceEventCancelIndicator="false" spliceImmediateFlag="false" eventIdComplianceFlag="true" availNum="12" availsExpected="5" outOfNetworkIndicator="true" uniqueProgramId="1">
|
|
528
|
+
<scte35:BreakDuration autoReturn="false" duration="16200000"/>
|
|
529
|
+
</scte35:SpliceInsert>
|
|
530
|
+
<scte35:AvailDescriptor providerAvailId="12"/>
|
|
531
|
+
<scte35:AvailDescriptor providerAvailId="13"/>
|
|
532
|
+
<scte35:AvailDescriptor providerAvailId="14"/>
|
|
533
|
+
<scte35:AvailDescriptor providerAvailId="15"/>
|
|
534
|
+
<scte35:AvailDescriptor providerAvailId="16"/>
|
|
535
|
+
<scte35:AvailDescriptor providerAvailId="17"/>
|
|
536
|
+
</scte35:SpliceInfoSection>
|
|
537
|
+
```
|
|
538
|
+
* convert to xml+binary
|
|
539
|
+
```py3
|
|
540
|
+
>>>> print(cue.xmlbin())
|
|
541
|
+
<scte35:Signal xmlns:scte35="https://scte.org/schemas/35">
|
|
542
|
+
<scte35:Binary>/DBcAAAAAAAAAP/wDwVAAAT3f69+APcxQAABDAUAPAAIQ1VFSQAAAAwACENVRUkAAAANAAhDVUVJAAAADgAIQ1VFSQAAAA8ACENVRUkAAAAQAAhDVUVJAAAAEQdjKTU=</scte35:Binary>
|
|
543
|
+
</scte35:Signal>
|
|
544
|
+
```
|
|
545
|
+
* convert to base64
|
|
546
|
+
```py3
|
|
547
|
+
>>>> print(cue.base64())
|
|
548
|
+
/DBcAAAAAAAAAP/wDwVAAAT3f69+APcxQAABDAUAPAAIQ1VFSQAAAAwACENVRUkAAAANAAhDVUVJAAAADgAIQ1VFSQAAAA8ACENVRUkAAAAQAAhDVUVJAAAAEQdjKTU=
|
|
549
|
+
```
|
|
550
|
+
* convert to hex
|
|
551
|
+
```py3
|
|
552
|
+
>>>> print(cue.hex())
|
|
553
|
+
0xfc305c00000000000000fff00f05400004f77faf7e00f7314000010c05003c0008435545490000000c0008435545490000000d0008435545490000000e0008435545490000000f000843554549000000100008435545490000001107632935
|
|
554
|
+
```
|
|
555
|
+
* show just the splice command
|
|
556
|
+
```py3
|
|
557
|
+
>>>> cue.command.show()
|
|
558
|
+
{
|
|
559
|
+
"command_length": 15,
|
|
560
|
+
"command_type": 5,
|
|
561
|
+
"name": "Splice Insert",
|
|
562
|
+
"break_auto_return": false,
|
|
563
|
+
"break_duration": 180.0,
|
|
564
|
+
"splice_event_id": 1073743095,
|
|
565
|
+
"splice_event_cancel_indicator": false,
|
|
566
|
+
"out_of_network_indicator": true,
|
|
567
|
+
"program_splice_flag": false,
|
|
568
|
+
"duration_flag": true,
|
|
569
|
+
"splice_immediate_flag": false,
|
|
570
|
+
"event_id_compliance_flag": true,
|
|
571
|
+
"unique_program_id": 1,
|
|
572
|
+
"avail_num": 12,
|
|
573
|
+
"avails_expected": 5
|
|
574
|
+
}
|
|
575
|
+
```
|
|
576
|
+
* edit the break duration
|
|
577
|
+
```py3
|
|
578
|
+
>>>> cue.command.break_duration=30
|
|
579
|
+
>>>> cue.command.show()
|
|
580
|
+
{
|
|
581
|
+
"command_length": 15,
|
|
582
|
+
"command_type": 5,
|
|
583
|
+
"name": "Splice Insert",
|
|
584
|
+
"break_auto_return": false,
|
|
585
|
+
"break_duration": 30,
|
|
586
|
+
"splice_event_id": 1073743095,
|
|
587
|
+
"splice_event_cancel_indicator": false,
|
|
588
|
+
"out_of_network_indicator": true,
|
|
589
|
+
"program_splice_flag": false,
|
|
590
|
+
"duration_flag": true,
|
|
591
|
+
"splice_immediate_flag": false,
|
|
592
|
+
"event_id_compliance_flag": true,
|
|
593
|
+
"unique_program_id": 1,
|
|
594
|
+
"avail_num": 12,
|
|
595
|
+
"avails_expected": 5
|
|
596
|
+
}
|
|
597
|
+
```
|
|
598
|
+
|
|
599
|
+
* re-encode to base64 with the new duration
|
|
600
|
+
```py3
|
|
601
|
+
>>>> cue.base64()
|
|
602
|
+
'/DBcAAAAAAAAAP/wDwVAAAT3f69+ACky4AABDAUAPAAIQ1VFSQAAAAwACENVRUkAAAANAAhDVUVJAAAADgAIQ1VFSQAAAA8ACENVRUkAAAAQAAhDVUVJAAAAEe1FB6g='
|
|
603
|
+
```
|
|
604
|
+
* re-encode to xml with the new duration
|
|
605
|
+
```py3
|
|
606
|
+
>>>> print(cue.xml())
|
|
607
|
+
<scte35:SpliceInfoSection xmlns:scte35="https://scte.org/schemas/35" ptsAdjustment="0" protocolVersion="0" sapType="3" tier="4095">
|
|
608
|
+
<scte35:SpliceInsert spliceEventId="1073743095" spliceEventCancelIndicator="false" spliceImmediateFlag="false" eventIdComplianceFlag="true" availNum="12" availsExpected="5" outOfNetworkIndicator="true" uniqueProgramId="1">
|
|
609
|
+
<scte35:BreakDuration autoReturn="false" duration="2700000"/>
|
|
610
|
+
</scte35:SpliceInsert>
|
|
611
|
+
<scte35:AvailDescriptor providerAvailId="12"/>
|
|
612
|
+
<scte35:AvailDescriptor providerAvailId="13"/>
|
|
613
|
+
<scte35:AvailDescriptor providerAvailId="14"/>
|
|
614
|
+
<scte35:AvailDescriptor providerAvailId="15"/>
|
|
615
|
+
<scte35:AvailDescriptor providerAvailId="16"/>
|
|
616
|
+
<scte35:AvailDescriptor providerAvailId="17"/>
|
|
617
|
+
</scte35:SpliceInfoSection>
|
|
618
|
+
```
|
|
619
|
+
* show just the descriptors
|
|
620
|
+
```py3
|
|
621
|
+
>>>> _ = [d.show() for d in cue.descriptors]
|
|
622
|
+
{
|
|
623
|
+
"tag": 0,
|
|
624
|
+
"identifier": "CUEI",
|
|
625
|
+
"name": "Avail Descriptor",
|
|
626
|
+
"provider_avail_id": 12,
|
|
627
|
+
"descriptor_length": 8
|
|
628
|
+
}
|
|
629
|
+
{
|
|
630
|
+
"tag": 0,
|
|
631
|
+
"identifier": "CUEI",
|
|
632
|
+
"name": "Avail Descriptor",
|
|
633
|
+
"provider_avail_id": 13,
|
|
634
|
+
"descriptor_length": 8
|
|
635
|
+
}
|
|
636
|
+
{
|
|
637
|
+
"tag": 0,
|
|
638
|
+
"identifier": "CUEI",
|
|
639
|
+
"name": "Avail Descriptor",
|
|
640
|
+
"provider_avail_id": 14,
|
|
641
|
+
"descriptor_length": 8
|
|
642
|
+
}
|
|
643
|
+
{
|
|
644
|
+
"tag": 0,
|
|
645
|
+
"identifier": "CUEI",
|
|
646
|
+
"name": "Avail Descriptor",
|
|
647
|
+
"provider_avail_id": 15,
|
|
648
|
+
"descriptor_length": 8
|
|
649
|
+
}
|
|
650
|
+
{
|
|
651
|
+
"tag": 0,
|
|
652
|
+
"identifier": "CUEI",
|
|
653
|
+
"name": "Avail Descriptor",
|
|
654
|
+
"provider_avail_id": 16,
|
|
655
|
+
"descriptor_length": 8
|
|
656
|
+
}
|
|
657
|
+
{
|
|
658
|
+
"tag": 0,
|
|
659
|
+
"identifier": "CUEI",
|
|
660
|
+
"name": "Avail Descriptor",
|
|
661
|
+
"provider_avail_id": 17,
|
|
662
|
+
"descriptor_length": 8
|
|
663
|
+
}
|
|
664
|
+
```
|
|
665
|
+
* pop off the last descriptor and re-encode to xml
|
|
666
|
+
```py3
|
|
667
|
+
|
|
668
|
+
>>>> cue.descriptors.pop()
|
|
669
|
+
{'tag': 0, 'identifier': 'CUEI', 'name': 'Avail Descriptor', 'private_data': None, 'provider_avail_id': 17, 'descriptor_length': 8}
|
|
670
|
+
>>>> print(cue.xml())
|
|
671
|
+
<scte35:SpliceInfoSection xmlns:scte35="https://scte.org/schemas/35" ptsAdjustment="0" protocolVersion="0" sapType="3" tier="4095">
|
|
672
|
+
<scte35:SpliceInsert spliceEventId="1073743095" spliceEventCancelIndicator="false" spliceImmediateFlag="false" eventIdComplianceFlag="true" availNum="12" availsExpected="5" outOfNetworkIndicator="true" uniqueProgramId="1">
|
|
673
|
+
<scte35:BreakDuration autoReturn="false" duration="2700000"/>
|
|
674
|
+
</scte35:SpliceInsert>
|
|
675
|
+
<scte35:AvailDescriptor providerAvailId="12"/>
|
|
676
|
+
<scte35:AvailDescriptor providerAvailId="13"/>
|
|
677
|
+
<scte35:AvailDescriptor providerAvailId="14"/>
|
|
678
|
+
<scte35:AvailDescriptor providerAvailId="15"/>
|
|
679
|
+
<scte35:AvailDescriptor providerAvailId="16"/>
|
|
680
|
+
</scte35:SpliceInfoSection>
|
|
681
|
+
```
|
|
682
|
+
___
|
|
683
|
+
|
|
684
|
+
#### [⇧](#-documentation-)
|
|
685
|
+
|
|
686
|
+
#### [web]
|
|
687
|
+
* [threefive SCTE-35 __Online Parser__](https://iodisco.com/scte35) __hosted on my server iodisco.com__
|
|
688
|
+
* Parse SCTE-35 in MPEGTS over HTTP, in your browser with[ Go, Wasm and Super Karate Death Car](https://bigcorp.ltd/gowasm) __hosted om my server bigcorp.ltd__
|
|
689
|
+
* Parse SCTE-35 in MPEGTS over HTTP, in your browser with[ threefive.js,javascript, and a little sed](https://bigcorp.ltd/bread) just to keep things interesting. __hosted om my server bigcorp.ltd__
|
|
690
|
+
* [ SCTE-35 __Online Parser__ powered by threefive](http://www.domus1938.com/scte35parser) _another online parser powered by threefive_ not hosted on my servers.
|
|
691
|
+
* [SCTE-35 __As a Service__](sassy.md) _if you can make an http request, you can parse SCTE-35, no install needed._
|
|
692
|
+
__hosted on my server iodisco.com__
|
|
693
|
+
___
|
|
694
|
+
|
|
695
|
+
#### [⇧](#-documentation-)
|
|
696
|
+
|
|
697
|
+
#### [XML]
|
|
698
|
+
* [XML](https://github.com/superkabuki/SCTE-35/blob/main/xml.md) __New__! _updated 05/01/2025_
|
|
699
|
+
|
|
700
|
+
#### [HLS]
|
|
701
|
+
* [Advanced Parsing of SCTE-35 in HLS with threefive](https://github.com/superkabuki/threefive/blob/main/hls.md) All HLS SCTE-35 tags, Sidecar Files, AAC ID3 Header Timestamps, SCTE-35 filters... Who loves you baby?
|
|
702
|
+
|
|
703
|
+
#### [⇧](#-documentation-)
|
|
704
|
+
|
|
705
|
+
#### [Classes]
|
|
706
|
+
* The python built in help is always the most up to date docs for the library.
|
|
707
|
+
|
|
708
|
+
```py3
|
|
709
|
+
|
|
710
|
+
a@fu:~/build7/threefive$ pypy3
|
|
711
|
+
|
|
712
|
+
>>>> from threefive import Stream
|
|
713
|
+
>>>> help(Stream)
|
|
714
|
+
|
|
715
|
+
```
|
|
716
|
+
|
|
717
|
+
* [Class Structure](https://github.com/superkabuki/threefive/blob/main/classes.md)
|
|
718
|
+
* [Cue Class](https://github.com/superkabuki/threefive/blob/main/cue.md) Cue is the main SCTE-35 class to use.
|
|
719
|
+
* [Stream Class](https://github.com/superkabuki/threefive/blob/main/stream.md) The Stream class handles MPEGTS SCTE-35 streams local, Http(s), UDP, and Multicast.
|
|
720
|
+
|
|
721
|
+
___
|
|
722
|
+
|
|
723
|
+
#### [⇧](#-documentation-)
|
|
724
|
+
|
|
725
|
+
#### [threefive now supports SRT]
|
|
726
|
+
|
|
727
|
+
* _( You have to unmute the audio )_
|
|
728
|
+
|
|
729
|
+
https://github.com/user-attachments/assets/a323ea90-867f-480f-a55f-e9339263e511
|
|
730
|
+
|
|
731
|
+
<BR>
|
|
732
|
+
|
|
733
|
+
* [more SRT and threefive info](srt.md)
|
|
734
|
+
|
|
735
|
+
|
|
736
|
+
* _checkout [SRTfu](https://github.com/superkabuki/srtfu)_
|
|
737
|
+
|
|
738
|
+
___
|
|
739
|
+
|
|
740
|
+
#### [⇧](#-documentation-)
|
|
741
|
+
|
|
742
|
+
##### [more]
|
|
743
|
+
|
|
744
|
+
* [Encode SCTE-35](https://github.com/superkabuki/threefive/blob/main/encode.md) Some encoding code examples.
|
|
745
|
+
___
|
|
746
|
+
|
|
747
|
+
# [⇧](#-documentation-)
|