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