You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#### class `threefive.Segment`
```python
Help on class Segment in module threefive.segment:
class Segment(threefive.stream.Stream)
| Segment(seg_uri, key_uri=None, iv=None)
|
| The Segment class is a Sub Class of threefive.Stream
| made for small, fixed size MPEGTS files,like HLS segments.
|
| Segment Class Specific Features:
|
| * Decryption of AES Encrypted MPEGTS.
|
| * Segment.cues a list of SCTE35 cues found in the segment.
|
|
| Example:
|
| from threefive import Segment
|
| >>>> uri = "https://example.com/1.ts"
| >>>> seg = Segment(uri)
| >>>> seg.decode()
| >>>> [cue.encode() for cue in cues]
| ['/DARAAAAAAAAAP/wAAAAAHpPv/8=',
| '/DAvAAAAAAAAAP/wFAUAAAKWf+//4WoauH4BTFYgAAEAAAAKAAhDVUVJAAAAAOv1oqc=']
|
| # For aes encrypted files
|
| >>>> key = "https://example.com/aes.key"
| >>>> IV=0x998C575D24F514AEC84EDC5CABCCDB81
| >>>> uri = "https://example.com/aes-1.ts"
|
| >>>> seg = Segment(uri,key_uri=key, iv=IV)
| >>>> seg.decode()
| >>>> {cue.packet_data.pcr:cue.encode() for cue in seg.cues}
|
| { 89718.451333: '/DARAAAAAAAAAP/wAAAAAHpPv/8=',
| 89730.281789: '/DAvAAAAAAAAAP/wFAUAAAKWf+//4WoauH4BTFYgAAEAAAAKAAhDVUVJAAAAAOv1oqc='}
|
| Method resolution order:
| Segment
| threefive.stream.Stream
| builtins.object
|
| Methods defined here:
|
| __init__(self, seg_uri, key_uri=None, iv=None)
| tsdata is an file or http/https url
| set show_null=False to exclude Splice Nulls
|
| Use like...
|
| from threefive import Stream
| strm = Stream("vid.ts",show_null=False)
| strm.decode()
|
| __repr__(self)
|
| add_cue(self, cue)
| add_cue is passed to a Stream instance
| to collect SCTE35 cues.
|
| decode(self)
| decode a mpegts segment.
|
| show_cue(self, cue)
| the Segment,cues list.
|
| ----------------------------------------------------------------------
| Methods inherited from threefive.stream.Stream:
|
| decode_fu(self, func=<function show_cue at 0x00007fb582c77420>)
| Stream.decode_fu decodes
| 1880 packets at a time.
|
| decode_next(self)
| Stream.decode_next returns the next
| SCTE35 cue as a threefive.Cue instance.
|
| decode_program(self, the_program, func=<function show_cue at 0x00007fb582c77420>)
| Stream.decode_program limits SCTE35 parsing
| to a specific MPEGTS program.
|
| decode_proxy(self, func=<function show_cue_stderr at 0x00007fb582c774c0>)
| Stream.decode_proxy writes all ts packets are written to stdout
| for piping into another program like mplayer.
| SCTE-35 cues are printed to stderr.
|
| decode_start_time(self)
| displays streams that will be
| parsed for SCTE-35.
|
| show(self)
| displays streams that will be
| parsed for SCTE-35.
|
| strip_scte35(self, func=<function show_cue_stderr at 0x00007fb582c774c0>)
| Stream.strip_scte35 works just likle Stream.decode_proxy,
| MPEGTS packets, ( Except the SCTE-35 packets) ,
| are written to stdout after being parsed.
| SCTE-35 cues are printed to stderr.
|
| ----------------------------------------------------------------------