threefive3 3.0.11__tar.gz → 3.0.15__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.11/threefive3.egg-info → threefive3-3.0.15}/PKG-INFO +77 -79
- {threefive3-3.0.11 → threefive3-3.0.15}/README.md +76 -75
- {threefive3-3.0.11 → threefive3-3.0.15}/bin/threefive3 +4 -3
- {threefive3-3.0.11 → threefive3-3.0.15}/threefive3/base.py +10 -10
- {threefive3-3.0.11 → threefive3-3.0.15}/threefive3/bitn.py +3 -0
- {threefive3-3.0.11 → threefive3-3.0.15}/threefive3/hls.py +9 -7
- {threefive3-3.0.11 → threefive3-3.0.15}/threefive3/iframes.py +1 -1
- {threefive3-3.0.11 → threefive3-3.0.15}/threefive3/segment.py +5 -3
- {threefive3-3.0.11 → threefive3-3.0.15}/threefive3/stream.py +30 -42
- {threefive3-3.0.11 → threefive3-3.0.15}/threefive3/sxp.py +15 -4
- {threefive3-3.0.11 → threefive3-3.0.15}/threefive3/version.py +1 -1
- {threefive3-3.0.11 → threefive3-3.0.15/threefive3.egg-info}/PKG-INFO +77 -79
- {threefive3-3.0.11 → threefive3-3.0.15}/LICENSE +0 -0
- {threefive3-3.0.11 → threefive3-3.0.15}/setup.cfg +0 -0
- {threefive3-3.0.11 → threefive3-3.0.15}/setup.py +0 -0
- {threefive3-3.0.11 → threefive3-3.0.15}/threefive3/__init__.py +0 -0
- {threefive3-3.0.11 → threefive3-3.0.15}/threefive3/commands.py +0 -0
- {threefive3-3.0.11 → threefive3-3.0.15}/threefive3/crc.py +0 -0
- {threefive3-3.0.11 → threefive3-3.0.15}/threefive3/cue.py +0 -0
- {threefive3-3.0.11 → threefive3-3.0.15}/threefive3/descriptors.py +0 -0
- {threefive3-3.0.11 → threefive3-3.0.15}/threefive3/new_reader.py +0 -0
- {threefive3-3.0.11 → threefive3-3.0.15}/threefive3/packetdata.py +0 -0
- {threefive3-3.0.11 → threefive3-3.0.15}/threefive3/section.py +0 -0
- {threefive3-3.0.11 → threefive3-3.0.15}/threefive3/segmentation.py +0 -0
- {threefive3-3.0.11 → threefive3-3.0.15}/threefive3/sixfix.py +0 -0
- {threefive3-3.0.11 → threefive3-3.0.15}/threefive3/spare.py +0 -0
- {threefive3-3.0.11 → threefive3-3.0.15}/threefive3/streamtypes.py +0 -0
- {threefive3-3.0.11 → threefive3-3.0.15}/threefive3/upids.py +0 -0
- {threefive3-3.0.11 → threefive3-3.0.15}/threefive3/x2c.py +0 -0
- {threefive3-3.0.11 → threefive3-3.0.15}/threefive3/xml.py +0 -0
- {threefive3-3.0.11 → threefive3-3.0.15}/threefive3.egg-info/SOURCES.txt +0 -0
- {threefive3-3.0.11 → threefive3-3.0.15}/threefive3.egg-info/dependency_links.txt +0 -0
- {threefive3-3.0.11 → threefive3-3.0.15}/threefive3.egg-info/requires.txt +0 -0
- {threefive3-3.0.11 → threefive3-3.0.15}/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.15
|
|
4
4
|
Summary: threefive continued.
|
|
5
5
|
Home-page: https://github.com/superkabuki/scte35
|
|
6
6
|
Author: Adrian of Doom
|
|
@@ -18,81 +18,38 @@ Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
|
18
18
|
Requires-Python: >=3.6
|
|
19
19
|
Description-Content-Type: text/markdown
|
|
20
20
|
License-File: LICENSE
|
|
21
|
-
Requires-Dist: m3ufu>=0.0.89
|
|
22
|
-
Requires-Dist: sideways>=0.0.23
|
|
23
|
-
Requires-Dist: pyaes
|
|
24
21
|
|
|
25
|
-
[Cue Class
|
|
22
|
+
[Install](#install) |[SCTE-35 Cli](#the-cli-tool) |[SCTE-35 Xml ](https://github.com/superkabuki/threefive3/blob/main/xml.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) [FFmpeg SCTE35](https://github.com/superkabuki/FFmpeg_SCTE35)
|
|
26
23
|
|
|
27
|
-

|
|
28
24
|
|
|
29
|
-
#
|
|
25
|
+
# threefive3 SCTE-35 cli tool and python3 library.
|
|
30
26
|
|
|
31
|
-
|
|
32
|
-
#### Use like this
|
|
33
|
-
```js
|
|
34
|
-
threefive3 hls https://example.com/master.m3u8
|
|
35
|
-
or
|
|
36
|
-
threefive3 hls help
|
|
37
|
-
|
|
38
|
-
```
|
|
27
|
+
✅ SCTE-35 Parser ✅ SCTE-35 Encoder ✅ SCTE-35 HLS ✅ SCTE-35 Xml ✅ SCTE-35 Cli ✅ SCTE-35 library
|
|
39
28
|
|
|
40
|
-
# Why threefive3, why not just threefive?
|
|
41
29
|
|
|
42
|
-
*
|
|
43
|
-
|
|
30
|
+
* Parses SCTE-35 from MPEGTS, HLS, XML, XML+Binary, Base64, Bytes, Hex, and Integers.
|
|
31
|
+
* Built-in network support for http(s), UDP, and Multicast.
|
|
32
|
+
* Automatic AES decryption for HLS.
|
|
33
|
+
* All HLS SCTE-35 Tags are Supported
|
|
34
|
+
___
|
|
44
35
|
|
|
45
|
-
|
|
46
|
-
* <s>I came up with a really cool name, but it wasn't available on pypi.org for a package name.</s>
|
|
36
|
+
## MPEGTS streams can be parsed for SCTE-35 with three lines of code.
|
|
47
37
|
|
|
48
|
-
|
|
49
|
-
|
|
38
|
+
```py3
|
|
39
|
+
a@fu:~/build5/scte35/scte35$ pypy3
|
|
40
|
+
Python 3.9.16 (7.3.11+dfsg-2+deb12u3, Dec 30 2024, 22:36:23)
|
|
41
|
+
[PyPy 7.3.11 with GCC 12.2.0] on linux
|
|
42
|
+
Type "help", "copyright", "credits" or "license" for more information.
|
|
50
43
|
|
|
51
|
-
|
|
52
|
-
* <s>I'll tell you the truth, everything is a lie.</s>
|
|
44
|
+
>>>> from threefive import Stream
|
|
53
45
|
|
|
46
|
+
>>>> strm=Stream('https://futzu.com/xaa.ts')
|
|
54
47
|
|
|
55
|
-
|
|
56
|
-
> Despite making a lot of changes, the api remains. threefive3 is pretty much a drop in replacement for threefive. I used sed to upgrade my code.
|
|
57
|
-
```js
|
|
58
|
-
sed -i 's/threefive/threefive3/g'
|
|
48
|
+
>>>> strm.decode()
|
|
59
49
|
```
|
|
60
|
-
> One thing to note, calling load or decode is no longer necessary for the Cue class, however, the methods are there in case you do call them.
|
|
61
|
-
>
|
|
62
|
-
>
|
|
63
|
-
# Is threefive3 faster than threefive?
|
|
64
|
-
### `threefive` vs. `threefive3` vs. `threefive3 next release`
|
|
65
|
-
#
|
|
66
|
-

|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
* _testing was done on a beatup chrome book reporting 5GB of RAM running Debian Sid and PyPy 7.3.11_
|
|
72
|
-
|
|
73
|
-
---
|
|
74
|
-
|
|
75
|
-
# Now with Super Advanced Error Detection and Stuff.
|
|
76
|
-
* This is super cool.
|
|
77
|
-
* Does not generate Fatal errors, it won't break your process.
|
|
78
|
-
* Displays what is in error and how to correct it.
|
|
79
|
-
* Works in the cli
|
|
80
|
-
* Works in code.
|
|
81
|
-

|
|
82
50
|
|
|
51
|
+
___
|
|
83
52
|
|
|
84
|
-
# Issues and Bugs.
|
|
85
|
-
* If you think you have a bug, I'll quickly fix it, but first I need you to prove it to me. __Show me the entire error message, the code you're running, and if the SCTE-35 is in video, the video stream__. You think your stream has proprietary data, we call those UPIDS. I am not going to spend my time trying to guess what your issue might be because you don't trust me.
|
|
86
|
-
* Why am I being such a dick about this? Because nine out of ten issues opened are not bugs at all or even related to threefive3. Most of them are SCTE-35 questions.
|
|
87
|
-
* I am not here to tutor you on SCTE-35. I do not work for SCTE.
|
|
88
|
-
---
|
|
89
|
-
# Special Request and Contract Work.
|
|
90
|
-
* If need some work done, this is what I do for a living, you can hire me, it's usually a month or two wait before I have an opening.
|
|
91
|
-
* SCTE-35 is not easy to learn, there is over 1000 pages of specs you really need understand. ISO 13818,RFC 4326, SCTE-30,SCTE-35, SCTE-67, SCTE-104, SCTE-214, HLS, DAS and few others.
|
|
92
|
-
* It reminds me of DNS or Sendmail configurations. It's a lot turn learn, but once you get things setup, you can pretty forget about it.
|
|
93
|
-
* I know SCTE-35 really really well. It's all I've for the last five years. I'm probably not the best SCTE-35 guy, but I'm the top ten, if not the top five.
|
|
94
|
-
* If you want to discuss your project open an issue and I'll send you my contact info.
|
|
95
|
-
---
|
|
96
53
|
|
|
97
54
|
# `Install`
|
|
98
55
|
* python3 via pip
|
|
@@ -112,10 +69,9 @@ make install
|
|
|
112
69
|
___
|
|
113
70
|
|
|
114
71
|
# `The Cli tool`
|
|
115
|
-
> The cli audetects data being available on stdin and that allows it to autodetect the SCTE-35 format as well as MPEGTS steams. Now every SCTE-35 data format, except hls, is autodetected on the commandline, as well as stdin.HLS requires the `hls` ketyword.
|
|
116
72
|
|
|
117
|
-
### The cli tool installs automatically with pip or the Makefile.
|
|
118
73
|
|
|
74
|
+
### The cli tool installs automatically with pip or the Makefile.
|
|
119
75
|
|
|
120
76
|
* [__SCTE-35 Inputs__](#inputs)
|
|
121
77
|
* [__SCTE-35 Outputs__](#outputs)
|
|
@@ -125,13 +81,34 @@ ___
|
|
|
125
81
|
* [Display raw __SCTE-35 packets__ from __video streams__](#packets)
|
|
126
82
|
* [__Repair SCTE-35 streams__ changed to __bin data__ by __ffmpeg__](#sixfix)
|
|
127
83
|
|
|
128
|
-
|
|
129
84
|
# `Inputs`
|
|
130
85
|
|
|
131
86
|
* Most __inputs__ are __auto-detected.__
|
|
132
87
|
* __stdin__ is __auto selected__ and __auto detected.__
|
|
133
88
|
* __SCTE-35 data is printed to stderr__
|
|
134
89
|
* __stdout is used when piping video__
|
|
90
|
+
* mpegts can be specified by file name or URI.
|
|
91
|
+
```rebol
|
|
92
|
+
threefive3 udp://@235.2.5.35:3535
|
|
93
|
+
```
|
|
94
|
+
* If a file comtains a SCTE-35 Cue as a string( base64,hex,int,json,xml or xml+bin), redirect the file contents.
|
|
95
|
+
```rebol
|
|
96
|
+
|
|
97
|
+
threefive3 < json.json
|
|
98
|
+
|
|
99
|
+
threefive3 < xml.xml
|
|
100
|
+
|
|
101
|
+
cat xml.xml | threefive3
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
* quoted strings(( base64,hex,int,json,xml or xml+bin), can be passed directly on the command line as well.
|
|
105
|
+
|
|
106
|
+
```awk
|
|
107
|
+
|
|
108
|
+
threefive3 '/DAWAAAAAAAAAP/wBQb+ztd7owAAdIbbmw=='
|
|
109
|
+
|
|
110
|
+
```
|
|
111
|
+
|
|
135
112
|
|
|
136
113
|
| Input Type | Cli Example |
|
|
137
114
|
|------------|-------------------------------------------------------------------------------------------------------------|
|
|
@@ -140,9 +117,9 @@ ___
|
|
|
140
117
|
| __HLS__ |`threefive3 hls https://example.com/master.m3u8` |
|
|
141
118
|
| __JSON__ |`threefive3 < json.json` |
|
|
142
119
|
| __Xml__ | `threefive3 < xml.xml` |
|
|
143
|
-
| __Xmlbin__ | `threefive3 < xmlbin.xml` |
|
|
120
|
+
| __Xmlbin__ | `js threefive3 < xmlbin.xml` |
|
|
144
121
|
|
|
145
|
-
# Streams
|
|
122
|
+
# `Streams`
|
|
146
123
|
|
|
147
124
|
|Protocol | Cli Example |
|
|
148
125
|
|---------------|----------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
@@ -174,56 +151,64 @@ ___
|
|
|
174
151
|
|
|
175
152
|
### `hls`
|
|
176
153
|
* parse hls manifests and segments for SCTE-35
|
|
177
|
-
```
|
|
154
|
+
```smalltalk
|
|
178
155
|
threefive3 hls https://example.com/master.m3u8
|
|
179
156
|
```
|
|
180
157
|
___
|
|
181
158
|
### `Iframes`
|
|
182
159
|
* Show iframes PTS in an MPEGTS video
|
|
183
|
-
|
|
160
|
+
|
|
161
|
+
```smalltalk
|
|
184
162
|
threefive3 iframes https://example.com/video.ts
|
|
185
163
|
```
|
|
186
164
|
___
|
|
187
165
|
### `packets`
|
|
188
166
|
* Print raw SCTE-35 packets from multicast mpegts video
|
|
189
|
-
|
|
167
|
+
|
|
168
|
+
```smalltalk
|
|
190
169
|
threefive3 packets udp://@235.35.3.5:3535
|
|
191
170
|
```
|
|
192
171
|
___
|
|
193
172
|
### `proxy`
|
|
194
173
|
* Parse a https stream and write raw video to stdout
|
|
195
|
-
|
|
174
|
+
|
|
175
|
+
```smalltalk
|
|
196
176
|
threefive3 proxy video.ts
|
|
197
177
|
```
|
|
198
178
|
___
|
|
199
179
|
### `pts`
|
|
200
180
|
* Print PTS from mpegts video
|
|
201
|
-
|
|
202
|
-
|
|
181
|
+
|
|
182
|
+
```smalltalk
|
|
183
|
+
threefive3 pts video.ts
|
|
203
184
|
```
|
|
204
185
|
___
|
|
205
186
|
### `sidecar`
|
|
206
187
|
* Parse a stream, write pts,write SCTE-35 Cues to sidecar.txt
|
|
207
|
-
|
|
208
|
-
|
|
188
|
+
|
|
189
|
+
```smalltalk
|
|
190
|
+
threefive3 sidecar video.ts
|
|
209
191
|
```
|
|
210
192
|
___
|
|
211
193
|
### `sixfix`
|
|
212
194
|
* Fix SCTE-35 data mangled by ffmpeg
|
|
213
|
-
|
|
214
|
-
|
|
195
|
+
|
|
196
|
+
```smalltalk
|
|
197
|
+
threefive3 sixfix video.ts
|
|
215
198
|
```
|
|
216
199
|
___
|
|
217
200
|
### `show`
|
|
218
201
|
|
|
219
202
|
* Probe mpegts video _( kind of like ffprobe )_
|
|
220
|
-
|
|
203
|
+
|
|
204
|
+
```smalltalk
|
|
221
205
|
threefive3 show video.ts
|
|
222
206
|
```
|
|
223
207
|
___
|
|
224
208
|
### `version`
|
|
225
209
|
* Show version
|
|
226
|
-
|
|
210
|
+
|
|
211
|
+
```smalltalk
|
|
227
212
|
threefive3 version
|
|
228
213
|
```
|
|
229
214
|
___
|
|
@@ -232,7 +217,20 @@ ___
|
|
|
232
217
|
```rebol
|
|
233
218
|
threefive3 help
|
|
234
219
|
```
|
|
220
|
+
___
|
|
221
|
+
|
|
222
|
+

|
|
223
|
+
|
|
224
|
+
___
|
|
225
|
+
|
|
235
226
|
## [iodisco.com/scte35](https://iodisco.com/scte35)
|
|
236
227
|

|
|
237
228
|
|
|
238
229
|
|
|
230
|
+
|
|
231
|
+
___
|
|
232
|
+
|
|
233
|
+
[Install](#install) |[SCTE-35 Cli](#the-cli-tool) |[SCTE-35 Xml ](https://github.com/superkabuki/threefive3/blob/main/xml.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) [FFmpeg SCTE35](https://github.com/superkabuki/FFmpeg_SCTE35)
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
|
|
@@ -1,74 +1,34 @@
|
|
|
1
|
-
[Cue Class
|
|
1
|
+
[Install](#install) |[SCTE-35 Cli](#the-cli-tool) |[SCTE-35 Xml ](https://github.com/superkabuki/threefive3/blob/main/xml.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) [FFmpeg SCTE35](https://github.com/superkabuki/FFmpeg_SCTE35)
|
|
2
2
|
|
|
3
|
-

|
|
4
3
|
|
|
5
|
-
#
|
|
4
|
+
# threefive3 SCTE-35 cli tool and python3 library.
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
#### Use like this
|
|
9
|
-
```js
|
|
10
|
-
threefive3 hls https://example.com/master.m3u8
|
|
11
|
-
or
|
|
12
|
-
threefive3 hls help
|
|
13
|
-
|
|
14
|
-
```
|
|
6
|
+
✅ SCTE-35 Parser ✅ SCTE-35 Encoder ✅ SCTE-35 HLS ✅ SCTE-35 Xml ✅ SCTE-35 Cli ✅ SCTE-35 library
|
|
15
7
|
|
|
16
|
-
# Why threefive3, why not just threefive?
|
|
17
8
|
|
|
18
|
-
*
|
|
19
|
-
|
|
9
|
+
* Parses SCTE-35 from MPEGTS, HLS, XML, XML+Binary, Base64, Bytes, Hex, and Integers.
|
|
10
|
+
* Built-in network support for http(s), UDP, and Multicast.
|
|
11
|
+
* Automatic AES decryption for HLS.
|
|
12
|
+
* All HLS SCTE-35 Tags are Supported
|
|
13
|
+
___
|
|
20
14
|
|
|
21
|
-
|
|
22
|
-
* <s>I came up with a really cool name, but it wasn't available on pypi.org for a package name.</s>
|
|
15
|
+
## MPEGTS streams can be parsed for SCTE-35 with three lines of code.
|
|
23
16
|
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
```py3
|
|
18
|
+
a@fu:~/build5/scte35/scte35$ pypy3
|
|
19
|
+
Python 3.9.16 (7.3.11+dfsg-2+deb12u3, Dec 30 2024, 22:36:23)
|
|
20
|
+
[PyPy 7.3.11 with GCC 12.2.0] on linux
|
|
21
|
+
Type "help", "copyright", "credits" or "license" for more information.
|
|
26
22
|
|
|
27
|
-
|
|
28
|
-
* <s>I'll tell you the truth, everything is a lie.</s>
|
|
23
|
+
>>>> from threefive import Stream
|
|
29
24
|
|
|
25
|
+
>>>> strm=Stream('https://futzu.com/xaa.ts')
|
|
30
26
|
|
|
31
|
-
|
|
32
|
-
> Despite making a lot of changes, the api remains. threefive3 is pretty much a drop in replacement for threefive. I used sed to upgrade my code.
|
|
33
|
-
```js
|
|
34
|
-
sed -i 's/threefive/threefive3/g'
|
|
27
|
+
>>>> strm.decode()
|
|
35
28
|
```
|
|
36
|
-
> One thing to note, calling load or decode is no longer necessary for the Cue class, however, the methods are there in case you do call them.
|
|
37
|
-
>
|
|
38
|
-
>
|
|
39
|
-
# Is threefive3 faster than threefive?
|
|
40
|
-
### `threefive` vs. `threefive3` vs. `threefive3 next release`
|
|
41
|
-
#
|
|
42
|
-

|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
* _testing was done on a beatup chrome book reporting 5GB of RAM running Debian Sid and PyPy 7.3.11_
|
|
48
|
-
|
|
49
|
-
---
|
|
50
|
-
|
|
51
|
-
# Now with Super Advanced Error Detection and Stuff.
|
|
52
|
-
* This is super cool.
|
|
53
|
-
* Does not generate Fatal errors, it won't break your process.
|
|
54
|
-
* Displays what is in error and how to correct it.
|
|
55
|
-
* Works in the cli
|
|
56
|
-
* Works in code.
|
|
57
|
-

|
|
58
29
|
|
|
30
|
+
___
|
|
59
31
|
|
|
60
|
-
# Issues and Bugs.
|
|
61
|
-
* If you think you have a bug, I'll quickly fix it, but first I need you to prove it to me. __Show me the entire error message, the code you're running, and if the SCTE-35 is in video, the video stream__. You think your stream has proprietary data, we call those UPIDS. I am not going to spend my time trying to guess what your issue might be because you don't trust me.
|
|
62
|
-
* Why am I being such a dick about this? Because nine out of ten issues opened are not bugs at all or even related to threefive3. Most of them are SCTE-35 questions.
|
|
63
|
-
* I am not here to tutor you on SCTE-35. I do not work for SCTE.
|
|
64
|
-
---
|
|
65
|
-
# Special Request and Contract Work.
|
|
66
|
-
* If need some work done, this is what I do for a living, you can hire me, it's usually a month or two wait before I have an opening.
|
|
67
|
-
* SCTE-35 is not easy to learn, there is over 1000 pages of specs you really need understand. ISO 13818,RFC 4326, SCTE-30,SCTE-35, SCTE-67, SCTE-104, SCTE-214, HLS, DAS and few others.
|
|
68
|
-
* It reminds me of DNS or Sendmail configurations. It's a lot turn learn, but once you get things setup, you can pretty forget about it.
|
|
69
|
-
* I know SCTE-35 really really well. It's all I've for the last five years. I'm probably not the best SCTE-35 guy, but I'm the top ten, if not the top five.
|
|
70
|
-
* If you want to discuss your project open an issue and I'll send you my contact info.
|
|
71
|
-
---
|
|
72
32
|
|
|
73
33
|
# `Install`
|
|
74
34
|
* python3 via pip
|
|
@@ -88,10 +48,9 @@ make install
|
|
|
88
48
|
___
|
|
89
49
|
|
|
90
50
|
# `The Cli tool`
|
|
91
|
-
> The cli audetects data being available on stdin and that allows it to autodetect the SCTE-35 format as well as MPEGTS steams. Now every SCTE-35 data format, except hls, is autodetected on the commandline, as well as stdin.HLS requires the `hls` ketyword.
|
|
92
51
|
|
|
93
|
-
### The cli tool installs automatically with pip or the Makefile.
|
|
94
52
|
|
|
53
|
+
### The cli tool installs automatically with pip or the Makefile.
|
|
95
54
|
|
|
96
55
|
* [__SCTE-35 Inputs__](#inputs)
|
|
97
56
|
* [__SCTE-35 Outputs__](#outputs)
|
|
@@ -101,13 +60,34 @@ ___
|
|
|
101
60
|
* [Display raw __SCTE-35 packets__ from __video streams__](#packets)
|
|
102
61
|
* [__Repair SCTE-35 streams__ changed to __bin data__ by __ffmpeg__](#sixfix)
|
|
103
62
|
|
|
104
|
-
|
|
105
63
|
# `Inputs`
|
|
106
64
|
|
|
107
65
|
* Most __inputs__ are __auto-detected.__
|
|
108
66
|
* __stdin__ is __auto selected__ and __auto detected.__
|
|
109
67
|
* __SCTE-35 data is printed to stderr__
|
|
110
68
|
* __stdout is used when piping video__
|
|
69
|
+
* mpegts can be specified by file name or URI.
|
|
70
|
+
```rebol
|
|
71
|
+
threefive3 udp://@235.2.5.35:3535
|
|
72
|
+
```
|
|
73
|
+
* If a file comtains a SCTE-35 Cue as a string( base64,hex,int,json,xml or xml+bin), redirect the file contents.
|
|
74
|
+
```rebol
|
|
75
|
+
|
|
76
|
+
threefive3 < json.json
|
|
77
|
+
|
|
78
|
+
threefive3 < xml.xml
|
|
79
|
+
|
|
80
|
+
cat xml.xml | threefive3
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
* quoted strings(( base64,hex,int,json,xml or xml+bin), can be passed directly on the command line as well.
|
|
84
|
+
|
|
85
|
+
```awk
|
|
86
|
+
|
|
87
|
+
threefive3 '/DAWAAAAAAAAAP/wBQb+ztd7owAAdIbbmw=='
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
|
|
111
91
|
|
|
112
92
|
| Input Type | Cli Example |
|
|
113
93
|
|------------|-------------------------------------------------------------------------------------------------------------|
|
|
@@ -116,9 +96,9 @@ ___
|
|
|
116
96
|
| __HLS__ |`threefive3 hls https://example.com/master.m3u8` |
|
|
117
97
|
| __JSON__ |`threefive3 < json.json` |
|
|
118
98
|
| __Xml__ | `threefive3 < xml.xml` |
|
|
119
|
-
| __Xmlbin__ | `threefive3 < xmlbin.xml` |
|
|
99
|
+
| __Xmlbin__ | `js threefive3 < xmlbin.xml` |
|
|
120
100
|
|
|
121
|
-
# Streams
|
|
101
|
+
# `Streams`
|
|
122
102
|
|
|
123
103
|
|Protocol | Cli Example |
|
|
124
104
|
|---------------|----------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
@@ -150,56 +130,64 @@ ___
|
|
|
150
130
|
|
|
151
131
|
### `hls`
|
|
152
132
|
* parse hls manifests and segments for SCTE-35
|
|
153
|
-
```
|
|
133
|
+
```smalltalk
|
|
154
134
|
threefive3 hls https://example.com/master.m3u8
|
|
155
135
|
```
|
|
156
136
|
___
|
|
157
137
|
### `Iframes`
|
|
158
138
|
* Show iframes PTS in an MPEGTS video
|
|
159
|
-
|
|
139
|
+
|
|
140
|
+
```smalltalk
|
|
160
141
|
threefive3 iframes https://example.com/video.ts
|
|
161
142
|
```
|
|
162
143
|
___
|
|
163
144
|
### `packets`
|
|
164
145
|
* Print raw SCTE-35 packets from multicast mpegts video
|
|
165
|
-
|
|
146
|
+
|
|
147
|
+
```smalltalk
|
|
166
148
|
threefive3 packets udp://@235.35.3.5:3535
|
|
167
149
|
```
|
|
168
150
|
___
|
|
169
151
|
### `proxy`
|
|
170
152
|
* Parse a https stream and write raw video to stdout
|
|
171
|
-
|
|
153
|
+
|
|
154
|
+
```smalltalk
|
|
172
155
|
threefive3 proxy video.ts
|
|
173
156
|
```
|
|
174
157
|
___
|
|
175
158
|
### `pts`
|
|
176
159
|
* Print PTS from mpegts video
|
|
177
|
-
|
|
178
|
-
|
|
160
|
+
|
|
161
|
+
```smalltalk
|
|
162
|
+
threefive3 pts video.ts
|
|
179
163
|
```
|
|
180
164
|
___
|
|
181
165
|
### `sidecar`
|
|
182
166
|
* Parse a stream, write pts,write SCTE-35 Cues to sidecar.txt
|
|
183
|
-
|
|
184
|
-
|
|
167
|
+
|
|
168
|
+
```smalltalk
|
|
169
|
+
threefive3 sidecar video.ts
|
|
185
170
|
```
|
|
186
171
|
___
|
|
187
172
|
### `sixfix`
|
|
188
173
|
* Fix SCTE-35 data mangled by ffmpeg
|
|
189
|
-
|
|
190
|
-
|
|
174
|
+
|
|
175
|
+
```smalltalk
|
|
176
|
+
threefive3 sixfix video.ts
|
|
191
177
|
```
|
|
192
178
|
___
|
|
193
179
|
### `show`
|
|
194
180
|
|
|
195
181
|
* Probe mpegts video _( kind of like ffprobe )_
|
|
196
|
-
|
|
182
|
+
|
|
183
|
+
```smalltalk
|
|
197
184
|
threefive3 show video.ts
|
|
198
185
|
```
|
|
199
186
|
___
|
|
200
187
|
### `version`
|
|
201
188
|
* Show version
|
|
202
|
-
|
|
189
|
+
|
|
190
|
+
```smalltalk
|
|
203
191
|
threefive3 version
|
|
204
192
|
```
|
|
205
193
|
___
|
|
@@ -208,7 +196,20 @@ ___
|
|
|
208
196
|
```rebol
|
|
209
197
|
threefive3 help
|
|
210
198
|
```
|
|
199
|
+
___
|
|
200
|
+
|
|
201
|
+

|
|
202
|
+
|
|
203
|
+
___
|
|
204
|
+
|
|
211
205
|
## [iodisco.com/scte35](https://iodisco.com/scte35)
|
|
212
206
|

|
|
213
207
|
|
|
214
208
|
|
|
209
|
+
|
|
210
|
+
___
|
|
211
|
+
|
|
212
|
+
[Install](#install) |[SCTE-35 Cli](#the-cli-tool) |[SCTE-35 Xml ](https://github.com/superkabuki/threefive3/blob/main/xml.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) [FFmpeg SCTE35](https://github.com/superkabuki/FFmpeg_SCTE35)
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#!/usr/bin/
|
|
1
|
+
#!/usr/bin/python3
|
|
2
2
|
|
|
3
3
|
"""
|
|
4
4
|
scte35 command line SCTE35 decoder.
|
|
@@ -225,6 +225,7 @@ def chk_mpegts_map():
|
|
|
225
225
|
for key in m_keys:
|
|
226
226
|
if key in sys.argv:
|
|
227
227
|
for arg in args:
|
|
228
|
+
print2(arg)
|
|
228
229
|
mpegts_map[key](arg)
|
|
229
230
|
sys.exit()
|
|
230
231
|
|
|
@@ -320,7 +321,7 @@ def to_funk(this):
|
|
|
320
321
|
try:
|
|
321
322
|
cue = Cue(this)
|
|
322
323
|
except:
|
|
323
|
-
print2("Bad Data")
|
|
324
|
+
print2(f"Bad Data:\n{this}")
|
|
324
325
|
sys.exit()
|
|
325
326
|
if cue:
|
|
326
327
|
funk()(cue) # func works here too.
|
|
@@ -342,7 +343,7 @@ def chk_stdin(args):
|
|
|
342
343
|
strm = Stream(sys.stdin.buffer)
|
|
343
344
|
strm._parse(one + two) # dont drop first packet
|
|
344
345
|
strm.decode(func=funk())
|
|
345
|
-
sys.exit()
|
|
346
|
+
sys.exit() # I keep forgetting why I do
|
|
346
347
|
return args
|
|
347
348
|
|
|
348
349
|
|
|
@@ -27,7 +27,7 @@ class SCTE35Base:
|
|
|
27
27
|
return nbin
|
|
28
28
|
|
|
29
29
|
def _err2(self, var_name, var_value, bit_count, var_type):
|
|
30
|
-
err_mesg = f"\033[1;41m !! \033[0m \033[1;41m {var_name}\033[0m is \033[1;41m {var_value} \033[0m, it should be type {var_type}
|
|
30
|
+
err_mesg = f"\033[1;41m !! \033[0m \033[1;41m {var_name}\033[0m is \033[1;41m {var_value} \033[0m, it should be type {var_type}, {bit_count} bit(s) long.\n "
|
|
31
31
|
print2(err_mesg)
|
|
32
32
|
|
|
33
33
|
def _bool_int(self, var_name, var_value, bit_count, var_type):
|
|
@@ -100,9 +100,10 @@ class SCTE35Base:
|
|
|
100
100
|
def has(self, what):
|
|
101
101
|
"""
|
|
102
102
|
has runs hasattr with self and what
|
|
103
|
+
returns value if set.
|
|
103
104
|
"""
|
|
104
105
|
if hasattr(self, what):
|
|
105
|
-
return
|
|
106
|
+
return vars(self)[what]
|
|
106
107
|
return False
|
|
107
108
|
|
|
108
109
|
def hasis(self, what):
|
|
@@ -151,23 +152,22 @@ class SCTE35Base:
|
|
|
151
152
|
|
|
152
153
|
return {k: b2l(v) for k, v in vars(self).items() if v is not None}
|
|
153
154
|
|
|
154
|
-
def
|
|
155
|
+
def _json2dict(self, gonzo):
|
|
155
156
|
if isinstance(gonzo, str):
|
|
156
157
|
gonzo = json.loads(gonzo)
|
|
157
158
|
return gonzo
|
|
158
159
|
|
|
159
|
-
def
|
|
160
|
-
if k in
|
|
160
|
+
def _chk_vars(self, k, v):
|
|
161
|
+
if k in vars(self):
|
|
161
162
|
self.__dict__[k] = v
|
|
162
163
|
|
|
163
|
-
def _vrfy_load(self, gonzo
|
|
164
|
+
def _vrfy_load(self, gonzo):
|
|
164
165
|
for k, v in gonzo.items():
|
|
165
|
-
self.
|
|
166
|
+
self._chk_vars(k, v)
|
|
166
167
|
|
|
167
168
|
def _load_dict(self, gonzo):
|
|
168
169
|
if isinstance(gonzo, dict):
|
|
169
|
-
|
|
170
|
-
self._vrfy_load(gonzo, prevars)
|
|
170
|
+
self._vrfy_load(gonzo)
|
|
171
171
|
|
|
172
172
|
def load(self, gonzo):
|
|
173
173
|
"""
|
|
@@ -175,7 +175,7 @@ class SCTE35Base:
|
|
|
175
175
|
data from a dict or json string.
|
|
176
176
|
only updates vars that exist in the obj.
|
|
177
177
|
"""
|
|
178
|
-
gonzo = self.
|
|
178
|
+
gonzo = self._json2dict(gonzo)
|
|
179
179
|
self._load_dict(gonzo)
|
|
180
180
|
|
|
181
181
|
def show(self):
|
|
@@ -6,6 +6,7 @@ scte35.hls hls.py
|
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
8
|
import datetime
|
|
9
|
+
import os
|
|
9
10
|
import sys
|
|
10
11
|
import time
|
|
11
12
|
from collections import deque
|
|
@@ -152,8 +153,10 @@ class Scte35Profile:
|
|
|
152
153
|
|
|
153
154
|
@staticmethod
|
|
154
155
|
def _clean(line):
|
|
156
|
+
'''
|
|
157
|
+
remove whitespace and quotes
|
|
158
|
+
'''
|
|
155
159
|
translate_map = {34: 94, 10: 94, 9: 94, 32: 94, 39: 94}
|
|
156
|
-
# translate " ", "\n", "\t", '"', "'" to ^ and delete.
|
|
157
160
|
return line.translate(translate_map).replace("^", "")
|
|
158
161
|
|
|
159
162
|
def clean_n_split(self, line):
|
|
@@ -209,13 +212,12 @@ class Scte35Profile:
|
|
|
209
212
|
|
|
210
213
|
def read_profile(self, pro_file):
|
|
211
214
|
"""
|
|
212
|
-
read_profile reads
|
|
215
|
+
read_profile reads hls.profile
|
|
213
216
|
"""
|
|
214
|
-
|
|
217
|
+
if os.path.isfile(pro_file):
|
|
215
218
|
with open(pro_file, "r", encoding="utf-8") as pro_handle:
|
|
216
219
|
self._parse_profile(pro_handle)
|
|
217
|
-
|
|
218
|
-
self.show_profile("Profile:")
|
|
220
|
+
self.show_profile("Profile:")
|
|
219
221
|
|
|
220
222
|
def set_pts(self, cue):
|
|
221
223
|
"""
|
|
@@ -272,7 +274,7 @@ class Scte35Profile:
|
|
|
272
274
|
"""
|
|
273
275
|
validate_splice_insert is named appropriately.
|
|
274
276
|
"""
|
|
275
|
-
line = self._is_splice_insert_cueout(
|
|
277
|
+
line = self._is_splice_insert_cueout(cue)
|
|
276
278
|
if not line:
|
|
277
279
|
line = "#EXT-X-CUE-IN\n"
|
|
278
280
|
return line
|
|
@@ -892,7 +894,7 @@ class CuePuller:
|
|
|
892
894
|
|
|
893
895
|
def chk_window_size(self, lines):
|
|
894
896
|
"""
|
|
895
|
-
|
|
897
|
+
mk_window_size sets the sliding window size
|
|
896
898
|
for the output to match that off the input and
|
|
897
899
|
determine how long to keep media data info
|
|
898
900
|
for segments.
|
|
@@ -121,8 +121,10 @@ class Segment(Stream):
|
|
|
121
121
|
decode a mpegts segment.
|
|
122
122
|
"""
|
|
123
123
|
super().decode(func=self.show_cue)
|
|
124
|
-
|
|
125
|
-
|
|
124
|
+
if self.start:
|
|
125
|
+
self.pts_start = self.as_90k(self.start.popitem()[1])
|
|
126
|
+
self.pts_last = self.as_90k(list(self.maps.prgm_pts.items())[0][1])
|
|
127
|
+
self.duration = round(self.pts_last - self.pts_start, 6)
|
|
128
|
+
|
|
126
129
|
if self.tmp:
|
|
127
130
|
os.unlink(self.tmp)
|
|
128
|
-
self.duration = round(self.pts_last - self.pts_start, 6)
|
|
@@ -231,7 +231,7 @@ class Stream:
|
|
|
231
231
|
while self._tsdata:
|
|
232
232
|
one = self._tsdata.read(1)
|
|
233
233
|
if one:
|
|
234
|
-
if one[0]== self.SYNC_BYTE:
|
|
234
|
+
if one[0] == self.SYNC_BYTE:
|
|
235
235
|
tail = self._tsdata.read(self.PACKET_SIZE - 1)
|
|
236
236
|
self._parse(one + tail)
|
|
237
237
|
return True
|
|
@@ -315,7 +315,7 @@ class Stream:
|
|
|
315
315
|
"""
|
|
316
316
|
self.info = True
|
|
317
317
|
for pkt in self.iter_pkts():
|
|
318
|
-
self.
|
|
318
|
+
self._parse(pkt)
|
|
319
319
|
if self.maps.prgm.keys():
|
|
320
320
|
sopro = sorted(self.maps.prgm.items())
|
|
321
321
|
for k, vee in sopro:
|
|
@@ -386,8 +386,14 @@ class Stream:
|
|
|
386
386
|
one = 1
|
|
387
387
|
if not bites:
|
|
388
388
|
return b""
|
|
389
|
-
|
|
390
|
-
|
|
389
|
+
while bites[0] == pad:
|
|
390
|
+
bites = bites[1:]
|
|
391
|
+
return self._unpad2(bites)
|
|
392
|
+
|
|
393
|
+
def _unpad2(self, bites):
|
|
394
|
+
pad = 255
|
|
395
|
+
while bites[-1] == pad:
|
|
396
|
+
bites = bites[:-1]
|
|
391
397
|
return bites
|
|
392
398
|
|
|
393
399
|
def _mk_packet_data(self, pid):
|
|
@@ -412,15 +418,6 @@ class Stream:
|
|
|
412
418
|
parse pts and store by program key
|
|
413
419
|
in the dict Stream._pid_pts
|
|
414
420
|
"""
|
|
415
|
-
## payload = self._parse_payload(pkt)
|
|
416
|
-
## if len(payload) > 13:
|
|
417
|
-
## if self._pts_flag(payload):
|
|
418
|
-
## pts = (payload[9] & 14) << 29
|
|
419
|
-
## pts |= payload[10] << 22
|
|
420
|
-
## pts |= (payload[11] >> 1) << 15
|
|
421
|
-
## pts |= payload[12] << 7
|
|
422
|
-
## pts |= payload[13] >> 1
|
|
423
|
-
|
|
424
421
|
pts = self.iframer.ticks(pkt)
|
|
425
422
|
if pts:
|
|
426
423
|
prgm = self.pid2prgm(pid)
|
|
@@ -449,21 +446,17 @@ class Stream:
|
|
|
449
446
|
head_size += afl + 1 # +1 for afl byte
|
|
450
447
|
return pkt[head_size:]
|
|
451
448
|
|
|
452
|
-
def _pmt_pid(self,
|
|
449
|
+
def _pmt_pid(self, pay, pid):
|
|
453
450
|
if pid in self.pids.pmt:
|
|
454
|
-
|
|
455
|
-
outdata = self._parse_pmt(pay, pid)
|
|
456
|
-
return outdata
|
|
451
|
+
self._parse_pmt(pay, pid)
|
|
457
452
|
|
|
458
|
-
def _pat_pid(self, pay, pid
|
|
453
|
+
def _pat_pid(self, pay, pid):
|
|
459
454
|
if pid == self.pids.PAT_PID:
|
|
460
|
-
|
|
461
|
-
return outdata
|
|
455
|
+
self._parse_pat(pay)
|
|
462
456
|
|
|
463
|
-
def _sdt_pid(self,
|
|
457
|
+
def _sdt_pid(self,pay,pid):
|
|
464
458
|
if pid == self.pids.SDT_PID:
|
|
465
|
-
|
|
466
|
-
return outdata
|
|
459
|
+
self._parse_sdt(pay)
|
|
467
460
|
|
|
468
461
|
def _parse_tables(self, pkt, pid):
|
|
469
462
|
"""
|
|
@@ -471,14 +464,11 @@ class Stream:
|
|
|
471
464
|
PAT, PMT, and SDT tables
|
|
472
465
|
based on pid of the pkt
|
|
473
466
|
"""
|
|
474
|
-
outdata = False
|
|
475
467
|
pay = self._parse_payload(pkt)
|
|
476
|
-
if self._same_as_last(pay, pid):
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
outdata = self._sdt_pid(pay, pid, outdata)
|
|
481
|
-
return outdata
|
|
468
|
+
if not self._same_as_last(pay, pid):
|
|
469
|
+
self._pmt_pid(pay,pid)
|
|
470
|
+
self._pat_pid(pay, pid)
|
|
471
|
+
self._sdt_pid(pay, pid)
|
|
482
472
|
|
|
483
473
|
def _parse_info(self, pkt):
|
|
484
474
|
"""
|
|
@@ -508,14 +498,14 @@ class Stream:
|
|
|
508
498
|
pid = self._parse_info(pkt)
|
|
509
499
|
if pid in self.pids.pcr:
|
|
510
500
|
self._chk_pcr(pkt, pid)
|
|
511
|
-
|
|
501
|
+
self._chk_pts(pkt, pid)
|
|
512
502
|
return self._chk_scte35(pkt, pid)
|
|
513
503
|
|
|
514
504
|
def _pid_has_scte35(self, pid):
|
|
515
|
-
# return pid in self.pids.scte35.union(self.pids.maybe_scte35) #
|
|
516
|
-
# return (pid in self.pids.scte35 or pid in self.pids.maybe_scte35)
|
|
517
|
-
return pid in (self.pids.scte35 or self.pids.maybe_scte35)
|
|
518
|
-
# return pid in (self.pids.scte35|self.pids.maybe_scte35) #
|
|
505
|
+
# return pid in self.pids.scte35.union(self.pids.maybe_scte35) # 4 Slowest. (union sucks)
|
|
506
|
+
# return (pid in self.pids.scte35 or pid in self.pids.maybe_scte35) #2 Fast
|
|
507
|
+
return pid in (self.pids.scte35 or self.pids.maybe_scte35) # 1 Fastest
|
|
508
|
+
# return pid in (self.pids.scte35|self.pids.maybe_scte35) #3 Slow. (I thought this would be fastest)
|
|
519
509
|
|
|
520
510
|
def _chk_partial(self, pay, pid, sep):
|
|
521
511
|
if pid in self.maps.partial:
|
|
@@ -531,10 +521,11 @@ class Stream:
|
|
|
531
521
|
|
|
532
522
|
def _section_incomplete(self, pay, pid, seclen):
|
|
533
523
|
# + 3 for the bytes before section starts
|
|
524
|
+
if len(pay) > (seclen + 3):
|
|
525
|
+
return False
|
|
534
526
|
if (seclen + 3) > len(pay):
|
|
535
527
|
self.maps.partial[pid] = pay
|
|
536
528
|
return True
|
|
537
|
-
return False
|
|
538
529
|
|
|
539
530
|
def _parse_cue(self, pay, pid):
|
|
540
531
|
packet_data = None
|
|
@@ -649,7 +640,6 @@ class Stream:
|
|
|
649
640
|
idx += chunk_size
|
|
650
641
|
return True
|
|
651
642
|
|
|
652
|
-
|
|
653
643
|
def _parse_pmt(self, pay, pid):
|
|
654
644
|
"""
|
|
655
645
|
parse program maps for streams
|
|
@@ -662,15 +652,13 @@ class Stream:
|
|
|
662
652
|
return False
|
|
663
653
|
program_number = self._parse_program(pay[3], pay[4])
|
|
664
654
|
if not program_number:
|
|
665
|
-
|
|
655
|
+
return False
|
|
666
656
|
pcr_pid = self._parse_pid(pay[8], pay[9])
|
|
667
657
|
if program_number not in self.maps.prgm:
|
|
668
658
|
self.maps.prgm[program_number] = ProgramInfo()
|
|
669
659
|
pinfo = self.maps.prgm[program_number]
|
|
670
660
|
pinfo.pid = pid
|
|
671
|
-
print(pid)
|
|
672
661
|
pinfo.pcr_pid = pcr_pid
|
|
673
|
-
print(pcr_pid)
|
|
674
662
|
self.pids.pcr.add(pcr_pid)
|
|
675
663
|
self.maps.pid_prgm[pcr_pid] = program_number
|
|
676
664
|
proginfolen = self._parse_length(pay[10], pay[11])
|
|
@@ -686,8 +674,8 @@ class Stream:
|
|
|
686
674
|
"""
|
|
687
675
|
# 5 bytes for stream_type info
|
|
688
676
|
chunk_size = 5
|
|
689
|
-
end_idx = (idx + si_len) -
|
|
690
|
-
while
|
|
677
|
+
end_idx = (idx + si_len) - 4
|
|
678
|
+
while end_idx - chunk_size >= idx:
|
|
691
679
|
stream_type, pid, ei_len = self._parse_stream_type(pay, idx)
|
|
692
680
|
pinfo = self.maps.prgm[program_number]
|
|
693
681
|
pinfo.streams[pid] = stream_type
|
|
@@ -8,9 +8,7 @@ from xml.sax.saxutils import unescape
|
|
|
8
8
|
from .xml import strip_ns, iter_attrs
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
CHILD_NODES = [
|
|
11
|
+
CHILD_NODES = [
|
|
14
12
|
"Program",
|
|
15
13
|
"SpliceTime",
|
|
16
14
|
"DeliveryRestrictions",
|
|
@@ -18,6 +16,19 @@ class SuperXmlParser:
|
|
|
18
16
|
"BreakDuration",
|
|
19
17
|
]
|
|
20
18
|
|
|
19
|
+
class SuperXmlParser:
|
|
20
|
+
"""
|
|
21
|
+
The Super Xml Parser
|
|
22
|
+
"""
|
|
23
|
+
def __init__(self,child_nodes=CHILD_NODES):
|
|
24
|
+
"""
|
|
25
|
+
__init__ allows you to specify child nodes
|
|
26
|
+
|
|
27
|
+
My thinking was, since I know which ones are
|
|
28
|
+
child nodes, why not specify them?
|
|
29
|
+
"""
|
|
30
|
+
self.child_nodes=child_nodes
|
|
31
|
+
|
|
21
32
|
def _split_attrs(self, node):
|
|
22
33
|
node = node.replace("='", '="').replace("' ", '" ')
|
|
23
34
|
attrs = [x for x in node.split(" ") if "=" in x]
|
|
@@ -74,7 +85,7 @@ class SuperXmlParser:
|
|
|
74
85
|
for sp in splitted:
|
|
75
86
|
if self._vrfy_sp(sp):
|
|
76
87
|
x = self._assemble(sp)
|
|
77
|
-
if x["name"] in self.
|
|
88
|
+
if x["name"] in self.child_nodes:
|
|
78
89
|
results[-1]["children"].append(x)
|
|
79
90
|
else:
|
|
80
91
|
results.append(x)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: threefive3
|
|
3
|
-
Version: 3.0.
|
|
3
|
+
Version: 3.0.15
|
|
4
4
|
Summary: threefive continued.
|
|
5
5
|
Home-page: https://github.com/superkabuki/scte35
|
|
6
6
|
Author: Adrian of Doom
|
|
@@ -18,81 +18,38 @@ Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
|
18
18
|
Requires-Python: >=3.6
|
|
19
19
|
Description-Content-Type: text/markdown
|
|
20
20
|
License-File: LICENSE
|
|
21
|
-
Requires-Dist: m3ufu>=0.0.89
|
|
22
|
-
Requires-Dist: sideways>=0.0.23
|
|
23
|
-
Requires-Dist: pyaes
|
|
24
21
|
|
|
25
|
-
[Cue Class
|
|
22
|
+
[Install](#install) |[SCTE-35 Cli](#the-cli-tool) |[SCTE-35 Xml ](https://github.com/superkabuki/threefive3/blob/main/xml.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) [FFmpeg SCTE35](https://github.com/superkabuki/FFmpeg_SCTE35)
|
|
26
23
|
|
|
27
|
-

|
|
28
24
|
|
|
29
|
-
#
|
|
25
|
+
# threefive3 SCTE-35 cli tool and python3 library.
|
|
30
26
|
|
|
31
|
-
|
|
32
|
-
#### Use like this
|
|
33
|
-
```js
|
|
34
|
-
threefive3 hls https://example.com/master.m3u8
|
|
35
|
-
or
|
|
36
|
-
threefive3 hls help
|
|
37
|
-
|
|
38
|
-
```
|
|
27
|
+
✅ SCTE-35 Parser ✅ SCTE-35 Encoder ✅ SCTE-35 HLS ✅ SCTE-35 Xml ✅ SCTE-35 Cli ✅ SCTE-35 library
|
|
39
28
|
|
|
40
|
-
# Why threefive3, why not just threefive?
|
|
41
29
|
|
|
42
|
-
*
|
|
43
|
-
|
|
30
|
+
* Parses SCTE-35 from MPEGTS, HLS, XML, XML+Binary, Base64, Bytes, Hex, and Integers.
|
|
31
|
+
* Built-in network support for http(s), UDP, and Multicast.
|
|
32
|
+
* Automatic AES decryption for HLS.
|
|
33
|
+
* All HLS SCTE-35 Tags are Supported
|
|
34
|
+
___
|
|
44
35
|
|
|
45
|
-
|
|
46
|
-
* <s>I came up with a really cool name, but it wasn't available on pypi.org for a package name.</s>
|
|
36
|
+
## MPEGTS streams can be parsed for SCTE-35 with three lines of code.
|
|
47
37
|
|
|
48
|
-
|
|
49
|
-
|
|
38
|
+
```py3
|
|
39
|
+
a@fu:~/build5/scte35/scte35$ pypy3
|
|
40
|
+
Python 3.9.16 (7.3.11+dfsg-2+deb12u3, Dec 30 2024, 22:36:23)
|
|
41
|
+
[PyPy 7.3.11 with GCC 12.2.0] on linux
|
|
42
|
+
Type "help", "copyright", "credits" or "license" for more information.
|
|
50
43
|
|
|
51
|
-
|
|
52
|
-
* <s>I'll tell you the truth, everything is a lie.</s>
|
|
44
|
+
>>>> from threefive import Stream
|
|
53
45
|
|
|
46
|
+
>>>> strm=Stream('https://futzu.com/xaa.ts')
|
|
54
47
|
|
|
55
|
-
|
|
56
|
-
> Despite making a lot of changes, the api remains. threefive3 is pretty much a drop in replacement for threefive. I used sed to upgrade my code.
|
|
57
|
-
```js
|
|
58
|
-
sed -i 's/threefive/threefive3/g'
|
|
48
|
+
>>>> strm.decode()
|
|
59
49
|
```
|
|
60
|
-
> One thing to note, calling load or decode is no longer necessary for the Cue class, however, the methods are there in case you do call them.
|
|
61
|
-
>
|
|
62
|
-
>
|
|
63
|
-
# Is threefive3 faster than threefive?
|
|
64
|
-
### `threefive` vs. `threefive3` vs. `threefive3 next release`
|
|
65
|
-
#
|
|
66
|
-

|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
* _testing was done on a beatup chrome book reporting 5GB of RAM running Debian Sid and PyPy 7.3.11_
|
|
72
|
-
|
|
73
|
-
---
|
|
74
|
-
|
|
75
|
-
# Now with Super Advanced Error Detection and Stuff.
|
|
76
|
-
* This is super cool.
|
|
77
|
-
* Does not generate Fatal errors, it won't break your process.
|
|
78
|
-
* Displays what is in error and how to correct it.
|
|
79
|
-
* Works in the cli
|
|
80
|
-
* Works in code.
|
|
81
|
-

|
|
82
50
|
|
|
51
|
+
___
|
|
83
52
|
|
|
84
|
-
# Issues and Bugs.
|
|
85
|
-
* If you think you have a bug, I'll quickly fix it, but first I need you to prove it to me. __Show me the entire error message, the code you're running, and if the SCTE-35 is in video, the video stream__. You think your stream has proprietary data, we call those UPIDS. I am not going to spend my time trying to guess what your issue might be because you don't trust me.
|
|
86
|
-
* Why am I being such a dick about this? Because nine out of ten issues opened are not bugs at all or even related to threefive3. Most of them are SCTE-35 questions.
|
|
87
|
-
* I am not here to tutor you on SCTE-35. I do not work for SCTE.
|
|
88
|
-
---
|
|
89
|
-
# Special Request and Contract Work.
|
|
90
|
-
* If need some work done, this is what I do for a living, you can hire me, it's usually a month or two wait before I have an opening.
|
|
91
|
-
* SCTE-35 is not easy to learn, there is over 1000 pages of specs you really need understand. ISO 13818,RFC 4326, SCTE-30,SCTE-35, SCTE-67, SCTE-104, SCTE-214, HLS, DAS and few others.
|
|
92
|
-
* It reminds me of DNS or Sendmail configurations. It's a lot turn learn, but once you get things setup, you can pretty forget about it.
|
|
93
|
-
* I know SCTE-35 really really well. It's all I've for the last five years. I'm probably not the best SCTE-35 guy, but I'm the top ten, if not the top five.
|
|
94
|
-
* If you want to discuss your project open an issue and I'll send you my contact info.
|
|
95
|
-
---
|
|
96
53
|
|
|
97
54
|
# `Install`
|
|
98
55
|
* python3 via pip
|
|
@@ -112,10 +69,9 @@ make install
|
|
|
112
69
|
___
|
|
113
70
|
|
|
114
71
|
# `The Cli tool`
|
|
115
|
-
> The cli audetects data being available on stdin and that allows it to autodetect the SCTE-35 format as well as MPEGTS steams. Now every SCTE-35 data format, except hls, is autodetected on the commandline, as well as stdin.HLS requires the `hls` ketyword.
|
|
116
72
|
|
|
117
|
-
### The cli tool installs automatically with pip or the Makefile.
|
|
118
73
|
|
|
74
|
+
### The cli tool installs automatically with pip or the Makefile.
|
|
119
75
|
|
|
120
76
|
* [__SCTE-35 Inputs__](#inputs)
|
|
121
77
|
* [__SCTE-35 Outputs__](#outputs)
|
|
@@ -125,13 +81,34 @@ ___
|
|
|
125
81
|
* [Display raw __SCTE-35 packets__ from __video streams__](#packets)
|
|
126
82
|
* [__Repair SCTE-35 streams__ changed to __bin data__ by __ffmpeg__](#sixfix)
|
|
127
83
|
|
|
128
|
-
|
|
129
84
|
# `Inputs`
|
|
130
85
|
|
|
131
86
|
* Most __inputs__ are __auto-detected.__
|
|
132
87
|
* __stdin__ is __auto selected__ and __auto detected.__
|
|
133
88
|
* __SCTE-35 data is printed to stderr__
|
|
134
89
|
* __stdout is used when piping video__
|
|
90
|
+
* mpegts can be specified by file name or URI.
|
|
91
|
+
```rebol
|
|
92
|
+
threefive3 udp://@235.2.5.35:3535
|
|
93
|
+
```
|
|
94
|
+
* If a file comtains a SCTE-35 Cue as a string( base64,hex,int,json,xml or xml+bin), redirect the file contents.
|
|
95
|
+
```rebol
|
|
96
|
+
|
|
97
|
+
threefive3 < json.json
|
|
98
|
+
|
|
99
|
+
threefive3 < xml.xml
|
|
100
|
+
|
|
101
|
+
cat xml.xml | threefive3
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
* quoted strings(( base64,hex,int,json,xml or xml+bin), can be passed directly on the command line as well.
|
|
105
|
+
|
|
106
|
+
```awk
|
|
107
|
+
|
|
108
|
+
threefive3 '/DAWAAAAAAAAAP/wBQb+ztd7owAAdIbbmw=='
|
|
109
|
+
|
|
110
|
+
```
|
|
111
|
+
|
|
135
112
|
|
|
136
113
|
| Input Type | Cli Example |
|
|
137
114
|
|------------|-------------------------------------------------------------------------------------------------------------|
|
|
@@ -140,9 +117,9 @@ ___
|
|
|
140
117
|
| __HLS__ |`threefive3 hls https://example.com/master.m3u8` |
|
|
141
118
|
| __JSON__ |`threefive3 < json.json` |
|
|
142
119
|
| __Xml__ | `threefive3 < xml.xml` |
|
|
143
|
-
| __Xmlbin__ | `threefive3 < xmlbin.xml` |
|
|
120
|
+
| __Xmlbin__ | `js threefive3 < xmlbin.xml` |
|
|
144
121
|
|
|
145
|
-
# Streams
|
|
122
|
+
# `Streams`
|
|
146
123
|
|
|
147
124
|
|Protocol | Cli Example |
|
|
148
125
|
|---------------|----------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
@@ -174,56 +151,64 @@ ___
|
|
|
174
151
|
|
|
175
152
|
### `hls`
|
|
176
153
|
* parse hls manifests and segments for SCTE-35
|
|
177
|
-
```
|
|
154
|
+
```smalltalk
|
|
178
155
|
threefive3 hls https://example.com/master.m3u8
|
|
179
156
|
```
|
|
180
157
|
___
|
|
181
158
|
### `Iframes`
|
|
182
159
|
* Show iframes PTS in an MPEGTS video
|
|
183
|
-
|
|
160
|
+
|
|
161
|
+
```smalltalk
|
|
184
162
|
threefive3 iframes https://example.com/video.ts
|
|
185
163
|
```
|
|
186
164
|
___
|
|
187
165
|
### `packets`
|
|
188
166
|
* Print raw SCTE-35 packets from multicast mpegts video
|
|
189
|
-
|
|
167
|
+
|
|
168
|
+
```smalltalk
|
|
190
169
|
threefive3 packets udp://@235.35.3.5:3535
|
|
191
170
|
```
|
|
192
171
|
___
|
|
193
172
|
### `proxy`
|
|
194
173
|
* Parse a https stream and write raw video to stdout
|
|
195
|
-
|
|
174
|
+
|
|
175
|
+
```smalltalk
|
|
196
176
|
threefive3 proxy video.ts
|
|
197
177
|
```
|
|
198
178
|
___
|
|
199
179
|
### `pts`
|
|
200
180
|
* Print PTS from mpegts video
|
|
201
|
-
|
|
202
|
-
|
|
181
|
+
|
|
182
|
+
```smalltalk
|
|
183
|
+
threefive3 pts video.ts
|
|
203
184
|
```
|
|
204
185
|
___
|
|
205
186
|
### `sidecar`
|
|
206
187
|
* Parse a stream, write pts,write SCTE-35 Cues to sidecar.txt
|
|
207
|
-
|
|
208
|
-
|
|
188
|
+
|
|
189
|
+
```smalltalk
|
|
190
|
+
threefive3 sidecar video.ts
|
|
209
191
|
```
|
|
210
192
|
___
|
|
211
193
|
### `sixfix`
|
|
212
194
|
* Fix SCTE-35 data mangled by ffmpeg
|
|
213
|
-
|
|
214
|
-
|
|
195
|
+
|
|
196
|
+
```smalltalk
|
|
197
|
+
threefive3 sixfix video.ts
|
|
215
198
|
```
|
|
216
199
|
___
|
|
217
200
|
### `show`
|
|
218
201
|
|
|
219
202
|
* Probe mpegts video _( kind of like ffprobe )_
|
|
220
|
-
|
|
203
|
+
|
|
204
|
+
```smalltalk
|
|
221
205
|
threefive3 show video.ts
|
|
222
206
|
```
|
|
223
207
|
___
|
|
224
208
|
### `version`
|
|
225
209
|
* Show version
|
|
226
|
-
|
|
210
|
+
|
|
211
|
+
```smalltalk
|
|
227
212
|
threefive3 version
|
|
228
213
|
```
|
|
229
214
|
___
|
|
@@ -232,7 +217,20 @@ ___
|
|
|
232
217
|
```rebol
|
|
233
218
|
threefive3 help
|
|
234
219
|
```
|
|
220
|
+
___
|
|
221
|
+
|
|
222
|
+

|
|
223
|
+
|
|
224
|
+
___
|
|
225
|
+
|
|
235
226
|
## [iodisco.com/scte35](https://iodisco.com/scte35)
|
|
236
227
|

|
|
237
228
|
|
|
238
229
|
|
|
230
|
+
|
|
231
|
+
___
|
|
232
|
+
|
|
233
|
+
[Install](#install) |[SCTE-35 Cli](#the-cli-tool) |[SCTE-35 Xml ](https://github.com/superkabuki/threefive3/blob/main/xml.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) [FFmpeg SCTE35](https://github.com/superkabuki/FFmpeg_SCTE35)
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|