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

Schedule live stream from mp4 #1510

Open
kisso opened this issue Feb 12, 2024 · 12 comments
Open

Schedule live stream from mp4 #1510

kisso opened this issue Feb 12, 2024 · 12 comments

Comments

@kisso
Copy link

kisso commented Feb 12, 2024

Hi, is it possible to schedule live stream at specific time using nginx-vod-module? I need this stream to be not rewindable. I want to embed link to playlist at my website, and for example need to start stream at 8PM.

@erankor
Copy link
Contributor

erankor commented Feb 17, 2024

Yes, it's possible, you need to use mapped mode with a JSON like -

{
	"playlistType": "live",
	"discontinuity": true,
	"firstClipTime": 1451918170000,
	"durations": [1800000],
	"sequences": [
		{
			"clips": [
				{
					"type": "source",
					"path": "/path/to/video1.mp4"
				}
			]
		}
	]
}

You need to set firstClipTime to the broadcast start time, in unix-time millis. If the stream is loaded outside the broadcast time, it will return an error. So it may be a good idea to stitch some slate before + after the main video, either by including them in the JSON, or by concatenating them to the source MP4.
Regarding the ability to rewind, you can use vod_live_window_duration to the control the number of seconds of video returned in the manifest. Note that it is not recommended to set this value below 3 segments.

@kisso
Copy link
Author

kisso commented Feb 17, 2024

Okay thank you, and what about discontinuty why should I enable it?

@erankor
Copy link
Contributor

erankor commented Feb 17, 2024

With one video, it's irrelevant, doesn't matter what you put there...
If you embed a slate before/after the video, you will most likely need to set it to true, unless you take extra care to ensure the videos have identical SPS/PPS.

@kisso
Copy link
Author

kisso commented Feb 17, 2024

And what about presentationEndTime or expiredTime? Should I used them? I tried presentationEndTime and the video continued after specified time

@erankor
Copy link
Contributor

erankor commented Feb 17, 2024

These params provide more fine grained control, intended mostly for "real" live streams. presentationEndTime controls whether the module returns EXT-X-ENDLIST, expirationTime can be used to make the module return 404 after a certain time.
I don't think you need them here, as far as I remember, the module will return an error, when the clock moves out of the window defined in the JSON.

@kisso
Copy link
Author

kisso commented Feb 17, 2024

Super thank you so much, also I am able to use multibitrate stream right?

@erankor
Copy link
Contributor

erankor commented Feb 17, 2024

Yup, you just need to add more elements to the sequences array

@kisso
Copy link
Author

kisso commented Feb 17, 2024

I tried and getting error: ngx_http_vod_validate_streams: invalid sequence count 3 while sending to client

@erankor
Copy link
Contributor

erankor commented Feb 18, 2024

Are you requesting index.m3u8?
You can't request index.m3u8 when there are multiple sequences, you need to use master.m3u8

@kisso
Copy link
Author

kisso commented Feb 18, 2024

Yes i am requesting master.m3u8

@kisso
Copy link
Author

kisso commented Feb 18, 2024

I have another problem, when I use only one sequence and requesting master.m3u8 I am getting whole video which I can rewind, when I request on index.m3u8 I am getting livestream is this correct behavior? Anybody can change url from index to master and see whole video, I don't want this

@erankor
Copy link
Contributor

erankor commented Mar 15, 2024

this doesn't make sense... the master.m3u8 references the index.m3u8 internally, there should be no difference between the two. maybe you have some caching issue.

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