Encoding and Inserting SCTE35 packets into MPEG-TS video
futzu opened this issue · comments
Adrian of Doom commented
- I'm about to start adding SCTE35 encoding methods.
- I created the bitn.NBin class to make encoding data to easy.
- check this out:
* The first method _parse_break, is the decoder using bitn.BitBin.- _encode_break, the encoder using bitn.NBin follows the same flow as the decoder method.
def _parse_break(self, bitbin):
"""
SpliceInsert._parse_break(bitbin) is called
if SpliceInsert.duration_flag is set
"""
self.break_auto_return = bitbin.asflag(1)
bitbin.forward(6)
self.break_duration = bitbin.as90k(33)
def _encode_break(self, nbin):
"""
SpliceInsert._encode_break(nbin) is called
if SpliceInsert.duration_flag is set
"""
nbin.add_flag(self.break_auto_return)
nbin.forward(6)
nbin.add_90k(self.break_duration, 33)
```
Richard van Dijk commented
I know a fair bit of PIDs and packets and can validate the output. I am however new at coding Python so bear with me.
Adrian of Doom commented
If you can figure out what steps we need to:
- Add a SCTE-35 stream
- Add MPEG-TS packets
I can help you with the code.
The encoding for the splice info section, and the splice commands is done.
The encoding for Audio, Avail, DTMF, and Time descriptors is done.
Only the Segmentation Descriptors remain, and I'm about to start on them now.
Adrian of Doom commented
threefive.Cue can now Encode and Decode itself for all Splice Commands and Descriptors.
The currently supported Segmentation Upid types:
- 0x02
- 0x03
- 0x04
- 0x05
- 0x06
- 0x07
- 0x08
- 0x09
- 0x0A
- 0x0B
- 0x0C
- 0x0D
- 0x0E
- 0x0F
Cue.bites --->>> b'\xfc0/\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\x05\x00\x00\x02\x96\x7f\xef\xff\xe1j\x1a\xb8~\x01LV \x00\x01\x00\x00\x00\n\x00\x08CUEI\x00\x00\x00\x00\x10\xfaM\x9e'
Encoded --->>> b'\xfc0/\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\x05\x00\x00\x02\x96\x7f\xef\xff\xe1j\x1a\xb8~\x01LV \x00\x01\x00\x00\x00\n\x00\x08CUEI\x00\x00\x00\x00\x10\xfaM\x9e'