threefive3 3.0.45__tar.gz → 3.1.13__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.
Files changed (59) hide show
  1. threefive3-3.1.13/PKG-INFO +778 -0
  2. threefive3-3.1.13/README.md +757 -0
  3. threefive3-3.1.13/pyproject.toml +32 -0
  4. {threefive3-3.0.45/threefive3 → threefive3-3.1.13/threefive}/__init__.py +19 -17
  5. {threefive3-3.0.45/threefive3 → threefive3-3.1.13/threefive}/aac.py +18 -18
  6. threefive3-3.1.13/threefive/base.py +233 -0
  7. {threefive3-3.0.45/threefive3 → threefive3-3.1.13/threefive}/bitn.py +71 -35
  8. threefive3-3.1.13/threefive/cli.py +479 -0
  9. {threefive3-3.0.45/threefive3 → threefive3-3.1.13/threefive}/commands.py +37 -27
  10. threefive3-3.1.13/threefive/crc.py +30 -0
  11. threefive3-3.1.13/threefive/crctable.py +258 -0
  12. threefive3-3.1.13/threefive/cue.py +571 -0
  13. {threefive3-3.0.45/threefive3 → threefive3-3.1.13/threefive}/descriptors.py +267 -62
  14. {threefive3-3.0.45/threefive3 → threefive3-3.1.13/threefive}/encode.py +5 -4
  15. threefive3-3.1.13/threefive/hls.py +921 -0
  16. threefive3-3.1.13/threefive/hlsprofile.py +279 -0
  17. {threefive3-3.0.45/threefive3 → threefive3-3.1.13/threefive}/hlstags.py +45 -26
  18. threefive3-3.1.13/threefive/new_reader.py +134 -0
  19. {threefive3-3.0.45/threefive3 → threefive3-3.1.13/threefive}/pmt.py +69 -48
  20. {threefive3-3.0.45/threefive3 → threefive3-3.1.13/threefive}/section.py +19 -19
  21. {threefive3-3.0.45/threefive3 → threefive3-3.1.13/threefive}/segment.py +38 -46
  22. {threefive3-3.0.45/threefive3 → threefive3-3.1.13/threefive}/sixfix.py +68 -59
  23. {threefive3-3.0.45/threefive3 → threefive3-3.1.13/threefive}/stream.py +352 -253
  24. {threefive3-3.0.45/threefive3 → threefive3-3.1.13/threefive}/streamtypes.py +7 -7
  25. threefive3-3.1.13/threefive/stuff.py +265 -0
  26. {threefive3-3.0.45/threefive3 → threefive3-3.1.13/threefive}/superkabuki.py +37 -25
  27. threefive3-3.1.13/threefive/udp.py +74 -0
  28. {threefive3-3.0.45/threefive3 → threefive3-3.1.13/threefive}/upids.py +110 -25
  29. threefive3-3.1.13/threefive/version.py +10 -0
  30. {threefive3-3.0.45/threefive3 → threefive3-3.1.13/threefive}/xml.py +260 -79
  31. threefive3-3.0.45/threefive3/uxp.py → threefive3-3.1.13/threefive/xml2scte35.py +22 -139
  32. threefive3-3.1.13/threefive3.egg-info/PKG-INFO +778 -0
  33. threefive3-3.1.13/threefive3.egg-info/SOURCES.txt +39 -0
  34. threefive3-3.1.13/threefive3.egg-info/entry_points.txt +4 -0
  35. threefive3-3.1.13/threefive3.egg-info/requires.txt +2 -0
  36. threefive3-3.1.13/threefive3.egg-info/top_level.txt +1 -0
  37. threefive3-3.0.45/PKG-INFO +0 -648
  38. threefive3-3.0.45/README.md +0 -627
  39. threefive3-3.0.45/bin/threefive3 +0 -446
  40. threefive3-3.0.45/setup.py +0 -39
  41. threefive3-3.0.45/threefive3/base.py +0 -190
  42. threefive3-3.0.45/threefive3/crc.py +0 -43
  43. threefive3-3.0.45/threefive3/cue.py +0 -493
  44. threefive3-3.0.45/threefive3/gums.py +0 -195
  45. threefive3-3.0.45/threefive3/hls.py +0 -1226
  46. threefive3-3.0.45/threefive3/iframes.py +0 -161
  47. threefive3-3.0.45/threefive3/new_reader.py +0 -136
  48. threefive3-3.0.45/threefive3/stuff.py +0 -191
  49. threefive3-3.0.45/threefive3/version.py +0 -10
  50. threefive3-3.0.45/threefive3/words.py +0 -60
  51. threefive3-3.0.45/threefive3.egg-info/PKG-INFO +0 -648
  52. threefive3-3.0.45/threefive3.egg-info/SOURCES.txt +0 -38
  53. threefive3-3.0.45/threefive3.egg-info/requires.txt +0 -1
  54. threefive3-3.0.45/threefive3.egg-info/top_level.txt +0 -1
  55. {threefive3-3.0.45 → threefive3-3.1.13}/LICENSE +0 -0
  56. {threefive3-3.0.45 → threefive3-3.1.13}/setup.cfg +0 -0
  57. {threefive3-3.0.45/threefive3 → threefive3-3.1.13/threefive}/packetdata.py +0 -0
  58. {threefive3-3.0.45/threefive3 → threefive3-3.1.13/threefive}/segmentation.py +0 -0
  59. {threefive3-3.0.45 → threefive3-3.1.13}/threefive3.egg-info/dependency_links.txt +0 -0
@@ -0,0 +1,778 @@
1
+ Metadata-Version: 2.4
2
+ Name: threefive3
3
+ Version: 3.1.13
4
+ Summary: threefive - SCTE-35 for the people.
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
+ Requires-Dist: srtfu>=0.0.11
19
+ Requires-Dist: pyaes
20
+ Dynamic: license-file
21
+
22
+ # `[ threefive ]`
23
+ * Decodes SCTE-35 from MPEGTS✔ Base64✔ Bytes✔ DASH✔ Hex✔ HLS✔ Integer✔ JSON✔ XML✔ XML+Binary✔
24
+ * Encodes SCTE-35 to MPEGTS✔ Base64✔ Bytes✔ Hex✔ Integer✔ JSON ✔ XML✔ XML+Binary✔
25
+
26
+ __***__ _if you need to encode SCTE-35 to HLS, use [x9k3](https://github.com/supeerkabuki/x9k3)._
27
+ ___
28
+ # `[ version ]`
29
+
30
+ ## latest threefive version is _v3.1.13_
31
+ * pylint: __9.82__/10.0
32
+ * cyclomatic complexity: __2.04__
33
+ __HLS Parser__ has been __SUPER tuned up__. Try it, you'll like it.
34
+ * __automatic__ parsing of __ID3__ streams for __SCTE-35__ in __MPEGTS__ streams
35
+ * __Iframer__ has been merged into the __Stream__ class.
36
+ * __piping SCTE-35__ data into the __threefive cli__ tool __now works on Windows too__ the __select call__ has been __removed__.
37
+ * check the [__change log__](changes.md)
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
+
51
+ * decode __SCTE-35__ as __base64__ and __convert SCTE-35 to hex__
52
+ ```cobol
53
+ threefive '/DAWAAAAAAAAAP/wBQb+AKmKxwAACzuu2Q==' hex
54
+ ```
55
+
56
+ * decode __SCTE-35__ from __HLS__ ( a rendition or a master.m3u8)
57
+ ```cobol
58
+ threefive 'https://demo.unified-streaming.com/k8s/live/scte35.isml/.m3u8'
59
+ ```
60
+
61
+ * decode __SCTE-35__ from __MPEGTS__
62
+ ```cobol
63
+ threefive 'https;//iodisco.com/longb2.ts'
64
+ ```
65
+
66
+ * decode __SCTE-35__ from __MPEGTS__ and __convert__ __SCTE-35__ to __bytes__
67
+ ```cobol
68
+ threefive 'https;//iodisco.com/longb2.ts' bytes
69
+ ```
70
+
71
+ * decode __SCTE-35__ from __MPEGTS__ over __Multicast__
72
+ ```cobol
73
+ threefive udp://@235.3.5.35:3535
74
+ ```
75
+
76
+ * __threefive does a lot more__, that was just to get you started.
77
+ ___
78
+
79
+
80
+
81
+ # `[ Documentation ]`
82
+
83
+ [A Lot of Examples ](https://github.com/superkabuki/threefive_is_scte35/blob/main/examples) | [ Tip of the Week ](totw.md) | [ Cheap Tricks ](cheaptricks.md) |
84
+
85
+
86
+ #### Need to inject SCTE-35 into HLS? [X9k3.](https://github.com/superkabuki/x9k3)
87
+
88
+ * [__install__](#install)
89
+
90
+ * [__quick start__](quickstart.md)
91
+
92
+ * ___SCTE-35 on the command line___
93
+ * [ __the threefive cli tool__](#-cli-) _If you work with SCTE-35, this is as cool as it gets._
94
+
95
+ * __the threefive library__ _cool code for the cool kids_.
96
+ * [__Using the threefive library with SCTE-35__](#-using-the-library-) _decode SCTE-35 with less than ten lines of code_
97
+ * [__triggering on SCTE-36 data in MPEGTS streams__](#triggering-on-scte-35)
98
+
99
+ * __other included tools__
100
+ * [__scte35fix__](#scte35fix) _ffmpeg changes scte-35 streams into bin data, scte35fix changes them back._
101
+ * [__scte35inject__](#scte35inject) _scte35inject inject scte-35 into mpegts._
102
+
103
+ * [__web based SCTE-35 tools__](#web) - _threefive and friends over HTTPS_
104
+
105
+ * [SCTE-35 __Sidecar Files__](https://github.com/superkabuki/SCTE-35_Sidecar_Files) _threefive supports SCTE-35 sidecar files_
106
+
107
+ * [SCTE-35 __HLS__](#-threefive-hls-) _parse SCTE-35 in HLS in MPEGTS,CMAF, or fmP4_
108
+
109
+ * [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_
110
+
111
+ * [__Encode__ SCTE-35](https://github.com/superkabuki/threefive/blob/main/encode.md) _threefive can encode SCTE-35 in every SCTE-35 format_
112
+
113
+ * [Make your __threefive__ script an executable with __cython__](cython.md) _threefive is compatible with all python tools_
114
+ </samp>
115
+
116
+ ## [Install]
117
+
118
+ * Requires python3 v3.9 or higher.
119
+
120
+ * __python3 via pip__
121
+ ```rebol
122
+ python3 -mpip install threefive
123
+ ```
124
+ * __pypy3 via pip__
125
+ ```rebol
126
+ pypy3 -mpip install threefive
127
+ ```
128
+ * __To add SRT support to threefive install srtfu__
129
+ ```py3
130
+ python3 -m pip install srtfu
131
+ ```
132
+ * __To add Automatic AES decryption (used to decrypted HLS to threefive install pyaes__
133
+ ```py3
134
+ python3 -mpip install pyaes
135
+ ```
136
+
137
+ * __From the git repo__
138
+
139
+ ```rebol
140
+ git clone https://github.com/superkabuki/scte35.git
141
+ cd threefive
142
+ make install
143
+ ```
144
+ * I've jazzed up the makefile to make it easier to install for different python versions and pypy3,
145
+
146
+ ```rebol
147
+ git clone https://github.com/superkabuki/threefive.git
148
+ cd threefive
149
+ ``
150
+ * `python3` is the default for `make install`
151
+
152
+ ```
153
+ make install
154
+ ```
155
+
156
+ * setting py3 allows you to install for any type of python interpreter.
157
+
158
+ ```
159
+ make install py3=pypy3
160
+ ```
161
+ * absolute paths can also be used.
162
+
163
+ ```
164
+ make install py3=/home/a/pypy3/bin/pypy3
165
+ ```
166
+
167
+
168
+ # works for any python in your path or use a full path if needed.
169
+
170
+ ```
171
+ #### [⇧](#-documentation-)
172
+ ___
173
+
174
+ ## `[ CLI ]`
175
+ 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.
176
+
177
+ ### The threefive cli tool.
178
+
179
+ the threefive cli tool decodes SCTE-35, formats are auto-detected, and they all work the same way.
180
+
181
+ __threefive__ __[media to parse for SCTE-35]__
182
+
183
+ examples:
184
+
185
+ * __base64__
186
+ ```sed
187
+ threefive '/DAWAAAAAAAAAP/wBQb+AKmKxwAACzuu2Q=='
188
+ ```
189
+ * __hex__
190
+ ```sed
191
+ threefive 0xfc301600000000000000fff00506fe00a98ac700000b3baed9
192
+ ```
193
+ * __int__
194
+ ```sed
195
+ threefive 1583008701074197245727019716796221242036302348025116111908569
196
+ ```
197
+ * __mpegts__
198
+ ```sed
199
+ threefive video.ts
200
+ ```
201
+ * __hls__
202
+ ```sed
203
+ threefive https://demo.unified-streaming.com/k8s/live/scte35.isml/scte35-audio_eng=64000-video=500000.m3u8
204
+ ```
205
+
206
+ * 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.
207
+
208
+ * __redirect__
209
+ ```sed
210
+ threefive < xml.xml
211
+ ```
212
+ * __pipe__
213
+ ```sed
214
+ cat json.json | threefive
215
+
216
+ ```
217
+ ### cli outputs and encoding SCTE-35 Formats
218
+
219
+ * the __default output format for threefive is json__
220
+
221
+ * The cli tool can convert from one SCTE-35 format to another using keywords.
222
+ * The keywords are __base64,bytes,hex, int,json,xml, and xmlbin__
223
+
224
+ * some converting and encoding examples
225
+
226
+
227
+ * SCTE-35 Base64 to SCTE-35 Hex
228
+ ```sed
229
+ threefive '/DAWAAAAAAAAAP/wBQb+AKmKxwAACzuu2Q==' hex
230
+ ```
231
+ * SCTE-35 Int to SCTE-35 Xml
232
+ ```sed
233
+ threefive 1583008701074197245727019716796221242036302348025116111908569 xml
234
+ ```
235
+ * SCTE-35 Hex to SCTE-35 xml+binary
236
+ ```sed
237
+ threefive 0xfc301600000000000000fff00506fe00a98ac700000b3baed9 xmlbin
238
+ ```
239
+
240
+ ### threefive cli and MPEGTS
241
+ * threefive can parse MPEGTS from stdin, local files, HTTP(s), Multicast, SRT, and unicast UDP.
242
+
243
+ * some mpegts examples
244
+
245
+ * local
246
+ ```sed
247
+ threefive video.ts
248
+ ```
249
+ * stdin
250
+ ```sed
251
+ cat video.ts | threefive
252
+ ```
253
+ * https
254
+ ```sed
255
+ threefive https://iodisco.com/longb2.ts
256
+ ```
257
+ * multicast
258
+ ```sed
259
+ threefive udp://@235.35.3.5:3535
260
+ ```
261
+
262
+ ### threefive cli MPEGTS outputs
263
+
264
+ * the __default output for MPEGTS is json__
265
+
266
+ * keywords can be used to specify other output formats
267
+ * The keywords are __base64,bytes,hex, int,json,xml, and xmlbin__
268
+
269
+ * An example of mpegts with a keyword
270
+ ```
271
+ threefive https://iodisco.com/longb2.ts xml
272
+ ```
273
+
274
+ ## `[ threefive hls ]`
275
+
276
+ * threefive is also an HLS SCTE-35 parser.
277
+
278
+ * HLS is automatically detected.
279
+
280
+ ```rebol
281
+ threefive https://demo.unified-streaming.com/k8s/live/stable/scte35.isml/.m3u8
282
+ ```
283
+ * The input m3u8 file can be a __rendition or master m3u8.__
284
+ * Automatic __AES decryption__ for segments.
285
+ * Automatic __AAC and AC3 ID3 Tag timestamp header__ parsing for audio only renditions.
286
+ * __SCTE-35__ Can be parsed from MPEGTS segments and from m3u8 files.
287
+ * __All HLS SCTE-35 tags__ are supported.
288
+ * threefive hls also allows you to __filter SCTE-35__ Messages.
289
+
290
+ ##### [ Help ]
291
+
292
+ To display hls help
293
+
294
+ ```rebol
295
+ threefive hls help
296
+ ```
297
+
298
+ ##### [ Input ]
299
+
300
+ * threefive hls takes an m3u8 URI as input.
301
+
302
+ * M3U8 formats supported:
303
+ * master ( When a master.m3u8 used, threefive hls parses the first rendition it finds )
304
+ * rendition
305
+
306
+ * Segment types supported:
307
+ * AAC
308
+ * AC3
309
+ * MPEGTS
310
+ * MP4
311
+ * fMP4
312
+
313
+ * Protocols supported:
314
+ * stdin
315
+ * file
316
+ * HTTP(S)
317
+ * Multicast
318
+ * Secure Reliable Transport
319
+ * UDP Unicast
320
+
321
+ * Encryption supported:
322
+ * AES-128 (segments are automatically decrypted)
323
+
324
+ # [ SCTE-35 ]
325
+
326
+ * threefive parses __SCTE-35__ from:
327
+ * Embedded __MPEGTS__ SCTE-35
328
+ * __ID3 PRIV tags__ in ID3 streams
329
+ * __All SCTE-35 HLS Tags.__
330
+
331
+
332
+ # [ Cool Features ]
333
+
334
+ * threefive hls can resume when started in the middle of an ad break.
335
+ ```rebol
336
+ 2023-10-13T05:59:50.24Z Resuming Ad Break
337
+ 2023-10-13T05:59:50.34Z Setting Break Timer to 17.733
338
+ 2023-10-13T05:59:50.44Z Setting Break Duration to 60.067
339
+ ```
340
+
341
+ ##### [ Example Usage ]
342
+
343
+ * Show this help:
344
+ ```rebol
345
+ threefive hls help
346
+ ```
347
+
348
+ * parse an m3u8:
349
+ ```rebol
350
+ threefive https://demo.unified-streaming.com/k8s/live/stable/scte35.isml/.m3u8
351
+ ```
352
+ ___
353
+ ___
354
+
355
+ #### [⇧](#-documentation-)
356
+
357
+
358
+ ##### Other tools
359
+ #### scte35inject
360
+ * SCTE-35 Packet Injection
361
+
362
+ ```js
363
+
364
+ a@fu:~/threefive$ scte35inject help
365
+ usage: scte35inject [-h] [-i INPUT] [-o OUTPUT] [-s SIDECAR] [-p SCTE35_PID] [-t]
366
+ [-v]
367
+
368
+ optional arguments:
369
+ -h, --help show this help message and exit
370
+ -i INPUT, --input INPUT
371
+ Input source, like "/home/a/vid.ts" or "udp://@235.35.3.5:3535"
372
+ or "https://futzu.com/xaa.ts" [
373
+ default:sys.stdin.buffer ]
374
+ -o OUTPUT, --output OUTPUT
375
+ Output file [ default:sys.stdout.buffer ]
376
+ -s SIDECAR, --sidecar SIDECAR
377
+ Sidecar file for SCTE35 [ default:sidecar.txt ]
378
+ -p SCTE35_PID, --scte35_pid SCTE35_PID
379
+ Pid for SCTE-35 packets [ default:0x86 ]
380
+ -t, --time_signals Flag to insert Time Signal cues at iframes.
381
+ -v, --version Show version
382
+
383
+ scte35inject is part of threefive
384
+ ```
385
+ ##### testing example
386
+ * insert a TimeSignal at every iframe
387
+ ```js
388
+
389
+ a@fu:~/threefive$ touch sidecar.txt
390
+
391
+
392
+ @fu:~/threefive$ scte35inject -t -i ~/mpegts2/mpegts/nmax.ts -p 777 -o injected-nmax.ts
393
+
394
+ ```
395
+
396
+ ___
397
+
398
+ #### [⇧](#-documentation-)
399
+
400
+ #### __scte35fix__
401
+
402
+ * when ffmpeg changes a SCTE-35 stream to bin data stream, scte35fix changes it back.
403
+
404
+ ```js
405
+ $ scte35fix -h
406
+
407
+ scte35fix checks MPEGTS for SCTE-35 Streams
408
+ that have been change to bin data (type 0x06)
409
+ and changes them back to SCTE-35 (type 0x86) streams.
410
+ Output files are created in the current directory
411
+ and prefixed with 'sixfix-'.
412
+ Only bin data streams containing SCTE-35 will be converted.
413
+ Multiple files can be specified on the command line.
414
+ Wild cards work too.
415
+
416
+ Example Usage:
417
+ scte35fix video.ts
418
+ scte35fix video1.ts video2.ts
419
+ scte35fix video*.ts
420
+ scte35fix https://example.com/video.ts
421
+ scte35fix srt://10.10.10.13:4201
422
+ scte35fix is part of threefive.
423
+ ```
424
+ ___
425
+
426
+ #### [⇧](#-documentation-)
427
+
428
+ ## `[ Using the library ]`
429
+ # Writing Code with threefive.
430
+
431
+ * threefive is designed so that you don't have to write a lot of code to parse SCTE-35
432
+ threefive is OO, everything in threefive, except a dozen or so functions, is a class.
433
+
434
+ * The Cue class and the Stream class are the two classes most often used.
435
+
436
+
437
+ ### Cue class
438
+
439
+
440
+ * The Cue class represents a single SCTE-35 Cue.
441
+ * Use the Cue class when you have one SCTE-35 Cue or Message to parse.
442
+ * The Cue class autodetects the format of the SCTE-35.
443
+ * When you create a Cue instance, pass in the SCTE-35 data.
444
+
445
+ ```py3
446
+ >>>> from threefive import Cue
447
+ >>>> cue=Cue('/DBAAAGRZOeYAAAABQb/mSvFcAAqAihDVUVJ/////3//AAFyyeABFG1zbmJjX0VQMDQ0MDc4NzUwMjY4IwEESCpzpg==')
448
+ ```
449
+ * The SCTE-35 Format can be __Base64, Bytes, Hex, Integer, JSON, Raw MPEGTS Packet, XML or XML+Binary.__
450
+
451
+ * Cue will decode the SCTE-35 into __a Splice Info Section__, __a Splice Command__, and __zero or More Splice Descriptors.__
452
+
453
+ ```py3
454
+ >>>> cue.info_section
455
+ {'table_id': '0xfc', 'section_syntax_indicator': False, 'private': False, 'sap_type': '0x03', 'sap_details': 'No Sap Type', 'section_length': 64, 'protocol_version': 0, 'encrypted_packet': False, 'encryption_algorithm': 0, 'pts_adjustment': 74825.294489, 'cw_index': '0x00', 'tier': '0x00', 'splice_command_length': 5, 'splice_command_type': 6, 'descriptor_loop_length': 42, 'crc': '0x482a73a6'}
456
+
457
+ >>>> cue.command
458
+ {'command_length': 5, 'command_type': 6, 'name': 'Time Signal', 'time_specified_flag': True, 'pts_time': 76274.999289}
459
+
460
+
461
+ >>>> cue.descriptors
462
+ [{'tag': 2, 'identifier': 'CUEI', 'name': 'Segmentation Descriptor', 'descriptor_length': 40, 'private_data': None, 'segmentation_event_cancel_indicator': False, 'segmentation_event_id': '0xffffffff', 'segmentation_event_id_compliance_indicator': True, 'program_segmentation_flag': True, 'segmentation_duration_flag': True, 'delivery_not_restricted_flag': True, 'web_delivery_allowed_flag': None, 'no_regional_blackout_flag': None, 'archive_allowed_flag': None, 'device_restrictions': None, 'segmentation_duration': 270.0, 'segmentation_message': 'Break End', 'segmentation_type_id': 35, 'segmentation_upid_length': 20, 'segmentation_upid_type': 1, 'segmentation_upid_type_name': 'Type 0x01 is deprecated, use MPU type 0x0C', 'segmentation_upid': 'msnbc_EP044078750268', 'segment_num': 1, 'segments_expected': 4, 'sub_segment_num': None, 'sub_segments_expected': None}]
463
+ ```
464
+
465
+ * individual __variables can be accessed via dot notation__
466
+ ```py3
467
+ >>>> cue.command.pts_time
468
+ 76274.999289
469
+ ```
470
+
471
+ * __variables can be changed__ the same way
472
+
473
+ ```py3
474
+ >>>> cue.command.pts_time= 1.23456
475
+ >>>> cue.command
476
+ {'command_length': 5, 'command_type': 6, 'name': 'Time Signal', 'time_specified_flag': True, 'pts_time': 1.23456}
477
+ ```
478
+
479
+ * __cue.descriptors is a list__, and descriptors can be acessed by index, like cue.descriptors[0]
480
+
481
+ * since cue.descriptors is a list, so you can append or pop() descriptors
482
+
483
+ ```py3
484
+ >>>> cue.descriptors.pop()
485
+ >>>> cue.descriptors
486
+ []
487
+ ```
488
+
489
+ * after editing, __you can re-encode__
490
+
491
+ * the default is __base64__
492
+
493
+ ```py3
494
+ >>>> cue.encode()
495
+ '/DAWAAGRZOeYAAAABQb+AAGyBgAANqe8lw=='
496
+ ```
497
+ * or you can __encode in a different SCTE-35 format__
498
+
499
+
500
+ * __bytes__
501
+
502
+ ```py3
503
+ >>>> cue.bytes()
504
+ b'\xfc0\x16\x00\x01\x91d\xe7\x98\x00\x00\x00\x05\x06\xfe\x00\x01\xb2\x06\x00\x006\xa7\xbc\x97'
505
+ ```
506
+
507
+ * __hex__
508
+
509
+ ```py3
510
+ >>>> cue.hex()
511
+ '0xfc301600019164e7980000000506fe0001b206000036a7bc97'
512
+ ```
513
+ * __json__
514
+
515
+ ```py3
516
+ >>>> cue.show()
517
+ {
518
+ "info_section": {
519
+ "table_id": "0xfc",
520
+ "section_syntax_indicator": false,
521
+ "private": false,
522
+ "sap_type": "0x03",
523
+ "sap_details": "No Sap Type",
524
+ "section_length": 22,
525
+ "protocol_version": 0,
526
+ "encrypted_packet": false,
527
+ "encryption_algorithm": 0,
528
+ "pts_adjustment": 74825.294489,
529
+ "cw_index": "0x00",
530
+ "tier": "0x00",
531
+ "splice_command_length": 5,
532
+ "splice_command_type": 6,
533
+ "descriptor_loop_length": 0,
534
+ "crc": "0x36a7bc97"
535
+ },
536
+ "command": {
537
+ "command_length": 5,
538
+ "command_type": 6,
539
+ "name": "Time Signal",
540
+ "time_specified_flag": true,
541
+ "pts_time": 1.234556
542
+ },
543
+ "descriptors": []
544
+ }
545
+
546
+ ```
547
+ * __integer__
548
+
549
+ ```py3
550
+ >>>> cue.int()
551
+ 1583008701076488801275299570612875276859137926425502632361111
552
+ ```
553
+
554
+ * __xml__
555
+
556
+ ```py3
557
+ >>>> cue.xml()
558
+ <scte35:SpliceInfoSectionxmlns:scte35="https://scte.org/schemas/35" ptsAdjustment="6734276504" protocolVersion="0" sapType="3" tier="0">
559
+ <scte35:TimeSignal>
560
+ <scte35:SpliceTime ptsTime="111110"/>
561
+ </scte35:TimeSignal>
562
+ </scte35:SpliceInfoSection>
563
+ ```
564
+
565
+ * __xml+bin__
566
+
567
+ ```py3
568
+ >>>> cue.xmlbin()
569
+ <scte35:Signalxmlns:scte35="https://scte.org/schemas/35">
570
+ <scte35:Binary>/DAWAAGRZOeYAAAABQb+AAGyBgAANqe8lw==</scte35:Binary>
571
+ </scte35:Signal>
572
+ ```
573
+
574
+ * for more specifics help is built-in
575
+
576
+ ```py3
577
+
578
+ help(Cue)
579
+ ```
580
+
581
+
582
+ ### Stream class
583
+
584
+ * The __Stream class__ is used for __Parsing SCTE-35 from MPEGTS streams.__
585
+
586
+ * The Stream class can open streams from __stdout, files, HTTP(S), Multicast, SRT, and UDP.__
587
+
588
+ * __Stream.__init____(self, tsdata, show_null=True, headers={})
589
+
590
+ * __tsdata__ is the only required arg, it is the stream
591
+ * __show_null__ is a boolean to show Splice Nulls or not.
592
+ * __headers__ is a dict for HTTP or SRT headers If needed.
593
+
594
+ ```py3
595
+ >>>> from threefive import Stream
596
+
597
+ >>>> st =Stream('https://iodisco.com/longb2.ts')
598
+ ```
599
+
600
+ * __Stream.decode()__ prints SCTE-35 as JSON
601
+
602
+ ```py3
603
+ >>>> st.decode()
604
+ ```
605
+
606
+ ### Triggering on SCTE-35
607
+
608
+ * __Stream.decode_next()__ returns the __next SCTE-35 Cue__ in an __MPEGTS__ stream.
609
+ ```py3
610
+ >>>> from threefive import Stream
611
+ >>>> st=Stream('https://iodisco.com/longb2.ts')
612
+ >>>> while cue := st.decode_next():
613
+ .... cue.show()
614
+ ```
615
+
616
+ * __Stream.decoderator()__ **** is a __python generator__ that __yields a Cue instance__ when SCTE-35 is found in an MPEGTS stream
617
+
618
+ **** _Somebody please give me a better name for this method_
619
+ ```py3
620
+ from threefive import Stream
621
+
622
+ >>>> st =Stream('https://iodisco.com/longb2.ts')
623
+ >>>> for cue in st.decoderator():
624
+ .... cmd = f"Command: {cue.command.name}"
625
+ .... if cue.command.has("pts_time"):
626
+ .... cmd += f"\t pts: {cue.command.pts_time}"
627
+ .... print(cmd)
628
+ ....
629
+ Command: Time Signal pts: 1.433
630
+ Command: Time Signal pts: 6.772
631
+ Command: Time Signal pts: 9.141
632
+ Command: Time Signal pts: 12.11
633
+ Command: Time Signal pts: 17.449
634
+ Command: Time Signal pts: 22.788
635
+ Command: Time Signal pts: 28.126
636
+ Command: Time Signal pts: 33.465
637
+ Command: Time Signal pts: 38.804
638
+ Command: Time Signal pts: 44.142
639
+ Command: Time Signal pts: 49.481
640
+ Command: Time Signal pts: 54.82
641
+ Command: Time Signal pts: 60.158
642
+ Command: Time Signal pts: 65.497
643
+ Command: Time Signal pts: 70.836
644
+ Command: Time Signal pts: 76.174
645
+ Command: Time Signal pts: 81.513
646
+ Command: Time Signal pts: 86.852
647
+ ```
648
+
649
+ ### Other Stream methods
650
+
651
+ * __Stream.show()__ shows details of the MPEGTS stream
652
+
653
+ ```py3
654
+ >>>> st =Stream('https://iodisco.com/longb2.ts')
655
+ >>>> st.show()
656
+
657
+ ---------------------------------------------
658
+ https://iodisco.com/longb2.ts
659
+
660
+ Program: 1
661
+
662
+ PTS Start: 1.433
663
+ Program Pid: 4096
664
+ Pcr Pid: 256
665
+ Streams:
666
+ Pid Type
667
+ 256 [0x100] 0x1b H.264
668
+ 257 [0x101] 0xf ADTS AAC
669
+ 258 [0x102] 0x86 SCTE-35
670
+ ```
671
+
672
+ * __Stream.Proxy()__ parses SCTE-35 and __copies the stream to stdout__ for piping the stream to another program.
673
+
674
+ ```py3
675
+ >>>> st =Stream('https://iodisco.com/longb2.ts')
676
+ >>>> st.proxy()
677
+ ```
678
+
679
+ * __Stream.show_pts()__
680
+
681
+ ```py3
682
+ >>>> st =Stream('https://iodisco.com/longb2.ts')
683
+
684
+ >>>> st.show_pts()
685
+
686
+ Prgm PTS
687
+ 1 1.433
688
+ 1 1.466
689
+ 1 1.533
690
+ 1 1.5
691
+ 1 1.566
692
+ 1 1.633
693
+ 1 1.6
694
+ 1 1.667
695
+ 1 1.7
696
+ 1 1.733
697
+ 1 1.767
698
+ 1 1.8
699
+ 1 1.833
700
+ 1 1.867
701
+ 1 1.9
702
+ 1 1.967
703
+ ```
704
+
705
+ * for more Stream specifics, see the built in docs
706
+
707
+ ```py3
708
+ >>>> from threefive import Stream
709
+ >>>> help(Stream)
710
+ ```
711
+
712
+
713
+ ___
714
+
715
+ #### [⇧](#-documentation-)
716
+
717
+ #### [web]
718
+ * [threefive SCTE-35 __Online Parser__](https://iodisco.com/scte35) __hosted on my server iodisco.com__
719
+ * Parse SCTE-35 in MPEGTS over HTTP, in your browser with[ Go, Wasm and Super Karate Death Car](https://iodisco.com/gowasm) __hosted om my server iodisco.com__
720
+ * Parse SCTE-35 in MPEGTS over HTTP, in your browser with[ threefive.js,javascript, and a little sed](https://iodisco.com/bread) just to keep things interesting. __hosted om my server iodisco.com__
721
+ * [ SCTE-35 __Online Parser__ powered by threefive](http://www.domus1938.com/scte35parser) _another online parser powered by threefive_ not hosted on my servers.
722
+ * [SCTE-35 __As a Service__](sassy.md) _if you can make an http request, you can parse SCTE-35, no install needed._
723
+ __hosted on my server iodisco.com__
724
+ ___
725
+
726
+ #### [⇧](#-documentation-)
727
+
728
+ #### [XML]
729
+ * [XML](https://github.com/superkabuki/SCTE-35/blob/main/xml.md) __New__! _updated 05/01/2025_
730
+
731
+ #### [HLS]
732
+ * [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?
733
+
734
+ #### [⇧](#-documentation-)
735
+
736
+ #### [Classes]
737
+ * The python built in help is always the most up to date docs for the library.
738
+
739
+ ```py3
740
+
741
+ a@fu:~/build7/threefive$ pypy3
742
+
743
+ >>>> from threefive import Stream
744
+ >>>> help(Stream)
745
+
746
+ ```
747
+
748
+ * [Class Structure](https://github.com/superkabuki/threefive/blob/main/classes.md)
749
+ * [Cue Class](https://github.com/superkabuki/threefive/blob/main/cue.md) Cue is the main SCTE-35 class to use.
750
+ * [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.
751
+
752
+ ___
753
+
754
+ #### [⇧](#-documentation-)
755
+
756
+ #### [threefive now supports SRT]
757
+
758
+ * _( You have to unmute the audio )_
759
+
760
+ https://github.com/user-attachments/assets/a323ea90-867f-480f-a55f-e9339263e511
761
+
762
+ <BR>
763
+
764
+ * [more SRT and threefive info](srt.md)
765
+
766
+
767
+ * _checkout [SRTfu](https://github.com/superkabuki/srtfu)_
768
+
769
+ ___
770
+
771
+ #### [⇧](#-documentation-)
772
+
773
+ ##### [more]
774
+
775
+ * [Encode SCTE-35](https://github.com/superkabuki/threefive/blob/main/encode.md) Some encoding code examples.
776
+ ___
777
+
778
+ # [⇧](#-documentation-)