Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x9k3 not show CUE-OUT=YES/CUE-IN=YES messages. #2

Closed
sergeyshulga opened this issue Aug 20, 2022 · 11 comments
Closed

x9k3 not show CUE-OUT=YES/CUE-IN=YES messages. #2

sergeyshulga opened this issue Aug 20, 2022 · 11 comments

Comments

@sergeyshulga
Copy link

Hello.
x9k3 not show CUE-OUT=YES/CUE-IN=YES messages, only binary decoded SCTE messages.
In version 1.21 we get string like that -
#EXT-X-SCTE35:CUE="/DAgAAAAAAAAAP/wDwUAAAAAf/9+AAAAAAAAAAAAAD4xJP8=",CUE-OUT=YES
In version 1.23 and latest string always show as
#EXT-X-SCTE35:CUE="/DAgAAAAAAAAAP/wDwUAAAAAf/9+AAAAAAAAAAAAAD4xJP8="
I think its related to discontinuity control in your script.

@futzu
Copy link
Owner

futzu commented Aug 22, 2022

index.m3u8.txt
I just made that 10 seconds ago.
Maybe its because you're doing a splice immediate.
Send me a link to a video I can try it out and see whats happening.

@futzu
Copy link
Owner

futzu commented Aug 22, 2022

I think I got it.
Run pip.

python3 -mpip install --upgrade x9k3

version is 0.1.37

@sergeyshulga
Copy link
Author

Yes, i use splice immediate commands.
Now x9k3 v0.1.37 working fine. Thank you!

@futzu
Copy link
Owner

futzu commented Aug 24, 2022

Hey man did you see the fake live loop stuff?

ffplay https://slo.me/index.m3u8

@khoand58
Copy link

@futzu hey man, How to add ,CUE-OUT=YES/ CUE-IN=YES, from -s sidecart.txt ?

@futzu
Copy link
Owner

futzu commented Sep 15, 2022

Is it a splice insert ?

@futzu
Copy link
Owner

futzu commented Sep 15, 2022

I don't know if you saw this
https://github.com/futzu/x9k3#faq

@futzu
Copy link
Owner

futzu commented Sep 15, 2022

you can use anything to trigger a CUE-OUT or CUE-IN,
just override the static methods with functions that return a boolean

I called this file x9.py

  • It will write cues as hex strings
  • It adds CUE-OUT if there is a time signal with a segmentation descriptor and a segmentation message of "Break Start"
  • It adds CUE-IN if there is a time signal with a segmentation descriptor and a segmentation message of "Break End"

x9.py

import x9k3

def mk_hex_cue_tag(cue):
    """
    mk_cue_tag
    """
    if cue:
        # make the cue a hex string
        return f'#EXT-X-SCTE35:CUE="{cue.encode_as_hex()}"'
    return "# No Cue"


def my_cue_out(cue):
    """
 
    Returns True for a cue_out event.
    """
    # if time signal
    if cue.command.command_type == 6:
        #  if first descriptor is a  segmentation descriptor
        if cue.descriptors[0].tag ==2:
            # if  segmentation_message is "Break Start"
            if cue.descriptors[0].segmentation_message== "Break Start": 
                return True
    return False

def my_cue_in(cue):
    """
    is_cue_in checks a Cue instance
    to see if it is a cue_in event.
    Returns True for a cue_in event.
    """
    # if time signal
    if cue.command.command_type == 6:
    #  if first descriptor is a  segmentation descriptor
        if cue.descriptors[0].tag ==2:
                # if  segmentation_message is "Break End"
            if cue.descriptors[0].segmentation_message=="Break End":
                return True
    return False

if __name__ == '__main__':
    x9 = x9k3.X9K3()
    x9.scte35.is_cue_out = my_cue_out
    x9.scte35.is_cue_in = my_cue_in
    x9.mk_cue_tag = mk_hex_cue_tag
    x9.decode()
  • command line switches still work
pypy3 x9.py -h
usage: x9.py [-h] [-i INPUT] [-o OUTPUT_DIR] [-s SIDECAR] [-t TIME] [-l] [-d] [-r] [-v]

optional arguments:
  -h, --help            show this help message and exit
  -i INPUT, --input INPUT
                        Input source, like "/home/a/vid.ts" or "udp://@235.35.3.5:3535" or "https://futzu.com/xaa.ts"
  -o OUTPUT_DIR, --output_dir OUTPUT_DIR
                        Directory for segments and index.m3u8 ( created if it does not exist )
  -s SIDECAR, --sidecar SIDECAR
                        Sidecar file of scte35 cues. each line contains PTS, Cue
  -t TIME, --time TIME  Segment time in seconds ( default is 2)
  -l, --live            Flag for a live event ( enables sliding window m3u8 )
  -d, --delete          delete segments ( enables --live )
  -r, --replay          Flag for replay (looping) ( enables --live and --delete )
  -v, --version         Show version

@futzu
Copy link
Owner

futzu commented Sep 16, 2022

here's an easier way,

import x9k3

def mk_cue_tag(cue):
    """
    mk_cue_tag with CUE-IN / CUE-OUT
    using the  out_of_network_indicator from Splice Inserts.
    """
    if cue:
        if cue.command.out_of_network_indicator:
            return f'#EXT-X-SCTE35:CUE="{cue.encode()}" ,CUE-OUT=YES'
        return f'#EXT-X-SCTE35:CUE="{cue.encode()}" ,CUE-IN=YES'

    return "# No Cue"

if __name__ == '__main__':
    x9 = x9k3.X9K3()
    x9.mk_cue_tag = mk_hex_cue_tag
    x9.decode()

@futzu
Copy link
Owner

futzu commented Sep 21, 2022

When I take the time to help you, I expect a reply.
Don't be a dick.

@sergeyshulga
Copy link
Author

Sorry for silence. I'm traveling last 2 weeks and cannot check your x9.py example. Its working Ok for me. I can customize messages in x9k3 or x9.py files.
Reason why i need it - make M3U compatible with Amazon MediaTailor - https://docs.aws.amazon.com/mediatailor/latest/ug/hls-ad-markers.html
Currently its seems working ok when i store only hex-coded mesages in m3u.
#EXT-X-SPLICEPOINT-SCTE35:/DA9AAAAAAAAAP/wBQb+uYbZqwAnAiVDVUVJAAAKqX//AAEjW4AMEU1EU05CMDAxMTMyMjE5M19ONAAAmXz5JA==
...
#EXT-X-SPLICEPOINT-SCTE35:/DA4AAAAAAAAAP/wBQb+tTeaawAiAiBDVUVJAAAKqH+/DBFNRFNOQjAwMTEzMjIxOTJfTjUAAIiGK1s=

But before i try to make it working with only EXT-X-CUE-OUT and EXT-X-CUE-IN commands, without hex or anything else..

Also Amazon need manifest (master) playlist, not only media playlist ((
https://docs.aws.amazon.com/mediatailor/latest/ug/manifest-hls-example.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants