futzu / SCTE-35_HLS_x9k3

HLS and SCTE-35 x9k3 is a HLS Segmenter with SCTE 35, and Live Streaming from Non-Live Soures and Looping.
67 stars 17 forks source link

negative EXTINF values and no X_CUE tags from scte35 mpegts stream #18

Closed acris5 closed 9 months ago

acris5 commented 1 year ago

I tried generate m3u8 from test xaa.ts video with scte35 stream inside, but found no x_cue tags in result:

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:3
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-DISCONTINUITY-SEQUENCE:0
#EXT-X-X9K3-VERSION:0.1.89
#EXTINF:2.002000,
seg0.ts
#EXTINF:2.002011,
seg1.ts
#EXTINF:2.002000,
...
seg27.ts
#EXTINF:2.002011,
seg28.ts
#EXT-X-ENDLIST

I used bin from Dockerfile with cmd: x9k3 -i /src/xaa.ts --output_dir /results

Also it sometimes inserts wrong negative EXTINF values


#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:3
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-DISCONTINUITY-SEQUENCE:0
#EXT-X-X9K3-VERSION:0.1.89
#EXTINF:-0.000011,
seg0.ts
#EXTINF:1.001000,
seg1.ts
#EXTINF:1.001000,
seg2.ts
...
futzu commented 12 months ago

Sorry, I'm just now seeing this. Your using my xaa.ts video?

acris5 commented 12 months ago

yes, as I noticed it cuts video into 1 sec chunks but does not insert any scte35 tags.

futzu commented 12 months ago

To be honest, that is a horrible example to use, I really should take that down and put up a better one. It has time signals with no descriptors, I made that with SuperKabuki, it has time signals every second, that it cuts like that. Let me make a better one and put it up, sorry about that.

acris5 commented 12 months ago

I also have my stream with scte35 markers but they look like that:

{
    "info_section": {
        "table_id": "0xfc",
        "section_syntax_indicator": false,
        "private": false,
        "sap_type": "0x3",
        "sap_details": "No Sap Type",
        "section_length": 37,
        "protocol_version": 0,
        "encrypted_packet": false,
        "encryption_algorithm": 0,
        "pts_adjustment_ticks": 0,
        "pts_adjustment": 0.0,
        "cw_index": "0x0",
        "tier": "0xfff",
        "splice_command_length": 20,
        "splice_command_type": 5,
        "descriptor_loop_length": 0,
        "crc": "0x58282ac0"
    },
    "command": {
        "command_length": 20,
        "command_type": 5,
        "name": "Splice Insert",
        "time_specified_flag": true,
        "pts_time": 37067.053078,
        "pts_time_ticks": 3336034777,
        "break_auto_return": false,
        "break_duration": 90.0,
        "break_duration_ticks": 8100000,
        "splice_event_id": 38125,
        "splice_event_cancel_indicator": false,
        "out_of_network_indicator": true,
        "program_splice_flag": true,
        "duration_flag": true,
        "splice_immediate_flag": false,
        "unique_program_id": 1,
        "avail_num": 19,
        "avail_expected": 255
    },
    "descriptors": [],
    "packet_data": {
        "pid": "0x104",
        "program": 1,
        "pts_ticks": 78020747,
        "pts": 866.897189
    }
}

And also are ignored in your tool, i think because they lack segmetation type :/

futzu commented 12 months ago

I see what the problem is there, the pts times. the splice insert is set to "pts_time": 37067.053078 but the cue itself is at "pts": 866.897189

  "command": {
        "command_length": 20,
        "command_type": 5,
        "name": "Splice Insert",
        "time_specified_flag": true,
        "pts_time": 37067.053078,        <------ PTS of the splice point
        "pts_time_ticks": 3336034777,
        "break_auto_return": false,
        "break_duration": 90.0,
        "break_duration_ticks": 8100000,
        "splice_event_id": 38125,
        "splice_event_cancel_indicator": false,
        "out_of_network_indicator": true,
        "program_splice_flag": true,
        "duration_flag": true,
        "splice_immediate_flag": false,
        "unique_program_id": 1,
        "avail_num": 19,
        "avail_expected": 255
    },
    "descriptors": [],
    "packet_data": {
        "pid": "0x104",
        "program": 1,
        "pts_ticks": 78020747,
        "pts": 866.897189           <------------ When the SCTE-3 data is in the video 
    }

What happens when you re-encode, the PTS is rewritten by default with ffmpeg. If you add -copyts before the -i with ffmpeg, it won't rewrite the PTS.

like this ffmpeg -copyts -i input.ts output.ts

acris5 commented 12 months ago

ok will check my command:) Thx much

futzu commented 10 months ago

ok will check my command:) Thx much

Sorry man to be honest I zoned out for a month or so, Try the latest 2.0.1 I think, negative times are definitely resolved and I switched to splicing on frames not just iframes for ad breaks, should be a lot more accurate. I also added a continue_m3u8 flag so you can resume an index.m3u8

Let me know if it's working for you.

Adrian

futzu commented 9 months ago

This was fixed a while back.