-
Notifications
You must be signed in to change notification settings - Fork 17
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
auto return not working? #9
Comments
It's not turned on, because a lot of stuff doesn't respect auto-return in SCTE-35 Cues, I need to look at the code and then I tell you where it should be called. x9k3 will also read cues from a sidecar file, you don't have to inject them. 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
a@debian:~/cuei$ pypy3
>>>> from threefive.encode import mk_splice_insert
>>>> evnt_id= 9
>>>> pts = 29053.123456
>>>> duration = 300
>>>> cue =mk_splice_insert(evnt_id,pts,duration) >>>> cue.encode()
'/DAlAAAAAAAAAP/wFAUAAAAJf+/+m9pkt/4Bm/zAAAkAAAAA5ftzmA=='
>>>> cue.encode_as_hex()
'0xfc302500000000000000fff01405000000097feffe9bda64b7fe019bfcc0000900000000e5fb7398'
>>>> cue.encode_as_int()
2104181392760166021170929920497819646350710275162000838308971042240028739408705486837725464851352 |
python3 -m pip install --upgrade x9k3 threefive new_reader and auto return should work. |
Thanks a lot for this quick fix! Great! However, there is a new issue with "immediate" splice requests, when no pts is given: I guess the pts_default should be set to current pts (or of the next packet) instead to None if there is no pts_time given in the section. tsduck splice xml looks like above, which is |
in line 534 change cmd.pts_time to self.scte35.cue_time pts = self.scte35.cue_time + cmd.break_duration see if that works |
no, the self.scte35.cue_time is still empty (None). I'll do more debugging tomorrow. /tmp/seg0.ts start: 32514.760000 duration: 3.600000 stream diff: 0.069976
(*spliceinject is from tsduck, piping to | python3 x9k3.py -d -o /tmp -t 2 -T x_cue |
That command is complex and not needed. x9k3 has multicast support. x9k3 can read cues from a sidecar file.
from threefive.encode import mk_splice_insert
evnt_id= 9
pts =None # None for Splice Immediate
duration = 300
insert_pts = 1234.567890
cue =mk_splice_insert(evnt_id,pts,duration)
with open("sidecar.txt, "a") as scf:
scf.write(f"{insert_pts},{cue.encode()} ")
x9k3 -i udp://@224.0.0.1:6600 -s sidecar.txt -T x_cue -o /tmp |
Did it work for you? |
~/build/clean/x9k3$ 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
>>>> evt_id, pts, dur = 9, None, 13.4
>>>> cue = mk_splice_insert(evt_id,pts,dur).encode()
>>>> with open("sidecar.txt","w") as sidecar:
.... sidecar.write(f'113.456789,{cue}')
....
59
>>>> I ran this x9k3 command a@debian:~/build/clean/x9k3$ x9k3 -i la-slim.ts -s sidecar.txt
Loading from Sidecar File
113.456789 /DAhAAAAAAAAAP/wEAUAAAAJf78A/gASZvAACQAAAACokv3z
./seg0.ts start: 102.506478 duration: 2.126855
./seg1.ts start: 104.633333 duration: 2.000000
./seg2.ts start: 106.633333 duration: 2.000000
./seg3.ts start: 108.633333 duration: 2.000000
./seg4.ts start: 110.633333 duration: 2.000000
Loading from Sidecar File
113.456789 /DAhAAAAAAAAAP/wEAUAAAAJf78A/gASZvAACQAAAACokv3z
Loading from Sidecar File
113.456789 /DAhAAAAAAAAAP/wEAUAAAAJf78A/gASZvAACQAAAACokv3z
#EXT-X-CUE-OUT:13.4
./seg5.ts start: 112.633333 duration: 2.000000
#EXT-X-CUE-OUT-CONT:2.000/13.4
./seg6.ts start: 114.633333 duration: 2.000000
#EXT-X-CUE-OUT-CONT:4.000/13.4
./seg7.ts start: 116.633333 duration: 2.000000
#EXT-X-CUE-OUT-CONT:6.000/13.4
./seg8.ts start: 118.633333 duration: 2.000000
#EXT-X-CUE-OUT-CONT:8.000/13.4
./seg9.ts start: 120.633333 duration: 2.000000
#EXT-X-CUE-OUT-CONT:10.000/13.4
./seg10.ts start: 122.633333 duration: 2.000000
#EXT-X-CUE-OUT-CONT:12.000/13.4
./seg11.ts start: 124.633333 duration: 2.000000
#EXT-X-CUE-IN
./seg12.ts start: 126.633333 duration: 2.000000
./seg13.ts start: 128.633333 duration: 2.000000
./seg14.ts start: 130.633333 duration: 2.000000
./seg15.ts start: 132.633333 duration: 2.033334
./seg16.ts start: 134.666667 duration: 2.000000
./seg17.ts start: 136.666667 duration: 2.000000
./seg18.ts start: 138.666667 duration: 2.000000
./seg19.ts start: 140.666667 duration: 2.000000
./seg20.ts start: 142.666667 duration: 2.000000
./seg21.ts start: 144.666667 duration: 2.000000
./seg22.ts start: 146.666667 duration: 2.000000
./seg23.ts start: 148.666667 duration: 2.000000
./seg24.ts start: 150.666667 duration: 2.000000 |
I can confirm that auto_return works for "immediate" cues, injected by sidecar created by threefive.encode. I'll open another issue regarding the alignment of HLS ad markers to GOP boundaries. |
changing x9k3.py line 540 to /tmp/seg155.ts start: 19309.086222 duration: 4.040000 |
ah, I see. You're adding the automatically created cue-in to the sidecar data. But if there is no sidecar, the auto-return won't work. We should store the cue-in locally as the next cue msg. |
You are confusing the sidecar file with the sidecar object, two different things. I am going to pull out the auto return stuff, it is causing too many problems. |
I am in the middle of re-writing x9k3, and I need to finish that first, and then add auto-return |
Its not line 540, its line 539 that needs to be changed to
|
pip up
work perfectly for me:
If it doesnt work for you, it will have to wait until I finish my big update. |
make sure your cues are on iframes. |
I have a tool for that as well called iframes
iframes matches up with ffprobe,
the is nothing wrong with the iframe detection in x9k3. |
I have auto-return working very well in the rewrite, probably be finished with it this week. |
Check out v.0.1.77 auto-return is working well. |
Thanks! Will have a look tomorrow. |
I'm using tsduck to inject SCTE35 Markers with
...
<splice_insert splice_event_id="0x00000001" out_of_network="true" splice_immediate="true" unique_program_id="0x0001">
<break_duration auto_return="true" duration="2,150,000"/>
</splice_insert>
...
However, the ad breaks runs forever:
#EXT-X-CUE-OUT-CONT:825.560/23.888889
#EXTINF:3.840,
seg1796.ts
#EXT-X-CUE-OUT-CONT:829.400/23.888889
#EXTINF:3.840,
seg1797.ts
#EXT-X-CUE-OUT-CONT:833.240/23.888889
#EXTINF:3.840,
I'm a total python newbie, but looking at the code, the _auto_return is never called / tested. Where should I insert the auto-return test?
Great tool, btw! Adds the last missing piece to the ffmpeg / tsduck eco system.
The text was updated successfully, but these errors were encountered: