Giter VIP home page Giter VIP logo

Comments (2)

futzu avatar futzu commented on June 13, 2024

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.

Complex cue messages

https://github.com/futzu/scte35-threefive/blob/master/Encoding.md

Simple Splice Insert

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

from x9k3.

ashiskumarsahu avatar ashiskumarsahu commented on June 13, 2024

Hi @futzu ,
Thanks for sharing this. It helped me a lot.

from x9k3.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.