From f8546358422d83a9f3d5f46ef58c6249625496fe Mon Sep 17 00:00:00 2001 From: Adrian <52701496+futzu@users.noreply.github.com> Date: Sun, 20 Aug 2023 01:38:43 +0000 Subject: [PATCH] Create segment.md --- segment.md | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 segment.md diff --git a/segment.md b/segment.md new file mode 100644 index 00000000..89f65213 --- /dev/null +++ b/segment.md @@ -0,0 +1,50 @@ + ### The threefive.Segment Class +The Segment class is a sub class of threefive.Stream,
designed for processing HLS segments. + + +* Segment Class Specific Features: + * Decryption of AES Encrypted MPEGTS. + * Segment.cues a list of SCTE35 cues found in the segment. +--- +* Usage: + +```lua + +from threefive import Segment + +uri = "https://example.com/1.ts" +seg = Segment(uri) +seg.decode() + +# Make a list comprehension of cues found in the segment. +data = [cue.encode() for cue in seg.cues] +print(data) + +['/DARAAAAAAAAAP/wAAAAAHpPv/8=', +'/DAvAAAAAAAAAP/wFAUAAAKWf+//4WoauH4BTFYgAAEAAAAKAAhDVUVJAAAAAOv1oqc='] + +``` + +* For aes encrypted files + + +```lua +from threefive import Segment + +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() + +# make a dictionary comprehension of pts and base64 encoded cues + +data = {cue.packet_data.pts:cue.encode() for cue in seg.cues} + +print(data) + +{ 89718.451333: '/DARAAAAAAAAAP/wAAAAAHpPv/8=', +89730.281789: '/DAvAAAAAAAAAP/wFAUAAAKWf+//4WoauH4BTFYgAAEAAAAKAAhDVUVJAAAAAOv1oqc='} +``` +