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

Segment index is 1 more than media sequence in playlist #204

Open
Ivan114654 opened this issue May 6, 2024 · 3 comments
Open

Segment index is 1 more than media sequence in playlist #204

Ivan114654 opened this issue May 6, 2024 · 3 comments

Comments

@Ivan114654
Copy link

Ivan114654 commented May 6, 2024

Hello, per RFC HTTP Live Streaming 2nd Edition,
#EXT-X-MEDIA-SEQUENCE sets sequence number for first segment, example from the RFC

   #EXTM3U
   #EXT-X-VERSION:3
   #EXT-X-TARGETDURATION:8
   #EXT-X-MEDIA-SEQUENCE:2680
   #EXTINF:7.975,
   https://priv.example.com/fileSequence2680.ts
   #EXTINF:7.941,
   https://priv.example.com/fileSequence2681.ts
   #EXTINF:7.975,
   https://priv.example.com/fileSequence2682.ts

but in media framework media sequence of first segment on 1 bigger:

#EXTM3U
#EXT-X-TARGETDURATION:4
#EXT-X-VERSION:6
#EXT-X-MEDIA-SEQUENCE:1714957236
#EXT-X-DISCONTINUITY-SEQUENCE:0
#EXT-X-INDEPENDENT-SEGMENTS
#EXT-X-ALLOW-CACHE:YES
#EXT-X-SERVER-CONTROL:CAN-BLOCK-RELOAD=YES,CAN-SKIP-UNTIL=24.000,PART-HOLD-BACK=3.000
#EXT-X-PART-INF:PART-TARGET=1.000
#EXT-X-MAP:URI="init-1714957226-s1080-v.mp4"
#EXT-X-PROGRAM-DATE-TIME:2024-05-06T01:01:09.998+00:00
#EXT-X-PART:DURATION=1.000,INDEPENDENT=YES,URI="part-1714957237-1-s1080-v.m4s"
#EXT-X-PART:DURATION=1.000,URI="part-1714957237-2-s1080-v.m4s"
#EXT-X-PART:DURATION=1.000,INDEPENDENT=YES,URI="part-1714957237-3-s1080-v.m4s"
#EXT-X-PART:DURATION=1.000,URI="part-1714957237-4-s1080-v.m4s"
#EXTINF:4.000,
seg-1714957237-s1080-v.m4s
...

here seg-1714957237-s1080-v.m4s has 1714957236 media sequence,
and should be named as seg-1714957236-s1080-v.m4s then,
it is not big deal, but this might be misleading

UPD: And it is not just naming, segment indexes gotten from media framework API endpoints have same numbers as in segment names, which don't add up with #EXT-X-MEDIA-SEQUENCE in a playlist.
So if you want to somehow post-process playlists you should aware about it. It would be better if segment indexes and media sequences were the same numbers.

@Ivan114654 Ivan114654 changed the title media sequence is bigger on 1 than should be Segment index is 1 more than media sequence in playlist May 6, 2024
@erankor
Copy link
Collaborator

erankor commented May 6, 2024

Yes, the segment index in the URL is one-based, so it is greater than the media sequence by 1. But, the URL can be anything the server desires, the player must not make any assumptions on the URL structure. So it's fine to have a number greater by 1 or 1000, or having no number at all (for example, in some past project, we encrypted the segment URLs, and in that case, the segment index wasn't visible at all).

@Ivan114654
Copy link
Author

Ivan114654 commented May 6, 2024

URL can be anything the server desires, the player must not make any assumptions on the URL structure

yes, but media engine APIs also reporting segment index greater by 1,

I'm doing some post processing with playlists, and I'm using API endpoints to get current segment for some events on the channel and then I need to find these segments in playlist, and it is not suitable that media sequence number in playlist and segment index are not the same number

@Ivan114654
Copy link
Author

And also in the settings there is some confusion between segment index and media sequence number:

initial_segment_index - integer (CR), the index of the first segment, default to 0

but really first segment index will not be same as set in initial_segment_index but will be bigger by 1,
and by default segment index will start not from 0 but from 1

maybe better to name this setting initial_msn?

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

No branches or pull requests

2 participants