nginx-vod-module
nginx-vod-module copied to clipboard
Get a manifest with uris pointing to different servers for different qualities?
We're serving files which have multiple qualities,like 360p, 480p etc.
Currently we're using local mode and we receive a master.m3u8 like this:
#EXTM3U
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio0",NAME="English",LANGUAGE="de",AUTOSELECT=YES,DEFAULT=YES,CHANNELS="2",URI="https://server1.example.com/hls/secret-key-with-local-paths/index-a1.m3u8"
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=2833039,RESOLUTION=1920x800,FRAME-RATE=23.974,CODECS="avc1.640832,mp4a.40.2",AUDIO="audio0"
https://server1.example.com/hls/token/index-v1-a2.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1112172,RESOLUTION=1280x534,FRAME-RATE=23.974,CODECS="avc1.64081f,mp4a.40.2",AUDIO="audio0"
https://server1.example.com/hls/token/index-v1-a2.m3u8
#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=264941,RESOLUTION=1920x800,CODECS="avc1.640832",URI="https://subserver1.example.com/hls/token/iframes-v1-a2.m3u8"
#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=98639,RESOLUTION=1280x534,CODECS="avc1.64081f",URI="https://server1.example.com/hls/token/iframes-v1-a2.m3u8"
The request url looks like this:
https://server1.example.com/hls/PREFIX,DATA_FOR_720p,DATA_FOR_1080p,.urlset/master.m3u8
On each server runs a script which generates a json response according to the data from the request url
return response()->json([
"sequences" => [
[
"clips" => [
[
"type" => "source",
"path" => $path
]
]
]
]
]);
Since some qualities generate high traffic we would like to offload them to special servers. Might it therefore be possible to receive such a manifest?
#EXTM3U
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio0",NAME="English",LANGUAGE="de",AUTOSELECT=YES,DEFAULT=YES,CHANNELS="2",URI="https://server1.example.com/hls/secret-key-with-local-paths/index-a1.m3u8"
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=2833039,RESOLUTION=1920x800,FRAME-RATE=23.974,CODECS="avc1.640832,mp4a.40.2",AUDIO="audio0"
https://server2.example.com/hls/token/index-v1-a2.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1112172,RESOLUTION=1280x534,FRAME-RATE=23.974,CODECS="avc1.64081f,mp4a.40.2",AUDIO="audio0"
https://server1.example.com/hls/token/index-v1-a2.m3u8
#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=264941,RESOLUTION=1920x800,CODECS="avc1.640832",URI="https://server2.example.com/hls/token/iframes-v1-a2.m3u8"
#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=98639,RESOLUTION=1280x534,CODECS="avc1.64081f",URI="https://server1.example.com/hls/token/iframes-v1-a2.m3u8"
I assume we have to modify the path to use /http/
, correct?
{
"sequences": [{
"clips": [{
"type": "source",
"path": "/http/????"
}]
}]
}
If so, the path should point to something like this: https://server2.example.com/DATA_FOR_1080p/v.mp4
?
Would this approach even make sense?
This is not supported, you can't have different base urls for different renditions. I'm not sure there's real value to it, we are partitioning the requests between the servers according to the video id (=all renditions of a specific video go to the same server), this makes the metadata cache more effective, and saves a lot of read bandwidth.