Closed ashiskumarsahu closed 1 year ago
You would think it would be straight forward, but like many things in computing, making SCTE-35 Cues is ten times harder than it needs to be, and makes very little sense.
https://github.com/futzu/scte35-threefive/blob/master/Encoding.md
threefive.encode has some new encoding functions that I haven't announced yet, but I use them a lot in my work.
a@debian:~/build/clean/scte35-threefive$ pypy3
Python 3.8.13 (7.3.9+dfsg-5, Oct 30 2022, 09:55:31)
[PyPy 7.3.9 with GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>> from threefive import encode
>>>> help(encode)
Help on module threefive.encode in threefive:
NAME
threefive.encode - encode.py
DESCRIPTION
threefive.encode has helper functions for Cue encoding.
FUNCTIONS
mk_splice_insert(event_id, pts, duration=None)
mk_cue returns a Cue
with a Splice Insert.
splice_event_id = event_id
If duration is NOT set,
out_of_network_indicator False
time_specified_flag False
duration_flag False
splice_immediate_flag True
if duration IS set:
out_of_network_indicator True
time_specified_flag True
duration_flag True
splice_immediate_flag False
break_auto_return True
break_duration duration
pts_time pts
mk_splice_null()
mk_splice_null returns a Cue
with a Splice Null
mk_time_signal(pts=None)
mk_time_signal returns a Cue
with a Time Signal
if pts is NOT set:
time_specified_flag False
if pts IS set:
time_specified_flag True
pts_time pts
FILE
/home/a/build/clean/scte35-threefive/threefive/encode.py
Let's try one real quick.
a@debian:~/cuei$ pypy3 Python 3.8.13 (7.3.9+dfsg-5, Oct 30 2022, 09:55:31) [PyPy 7.3.9 with GCC 12.2.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> from threefive.encode import mk_splice_insert >>> evnt_id= 9 >>> pts = 29053.123456 >>> duration = 300 >>> cue =mk_splice_insert(evnt_id,pts,duration)
mk_splice_insert returns an instance of threefive.Cue which has the following methods
| | encode(self) | Cue.encode() converts SCTE35 data | to a base64 encoded string. | | encode_as_hex(self) | encode_as_hex returns self.bites as | a hex string | | encode_as_int(self) | encode_as_int returns self.bites as an int. |
Use threefive.Cue's encoding methods to generate the cue messages
>>> cue.encode()
'/DAlAAAAAAAAAP/wFAUAAAAJf+/+m9pkt/4Bm/zAAAkAAAAA5ftzmA=='
cue.encode_as_hex()
'0xfc302500000000000000fff01405000000097feffe9bda64b7fe019bfcc0000900000000e5fb7398'
cue.encode_as_int() 2104181392760166021170929920497819646350710275162000838308971042240028739408705486837725464851352
Hi @futzu , Thanks for sharing this. It helped me a lot.
I am new to SCTE and need help on creating SCTE messages like below. I need to understand what does these string means and how I can create and use with this package.
Note: I have copied these messages from your examples.
I am able to insert them my livestream output using this package piping with ffmpeg.
Any help is highly appriciated.
Thank You