The HLS format is the most common format for delivering videos online. This format allows you to:
Video content delivered in HLS format contains a manifest (.m3u8) which tells browsers the order in which they should play the chunks into which the video is divided.
Here is the format of the link to get the master manifest:
Where:
Example of the manifest link: https://demo-public.gvideo.io/videos/2675_FnlHXwA16ZMxmUr/master.m3u8
Video can be streamed and downloaded using the .mp4 file format when you want to handle the whole file at once instead of in chunks. So MP4 format allows users to:
When using the MP4 format, users can work with each available video resolution separately. For example, select the video quality version (720p) and download only that version: https://demo-public.gvideo.io/videos/2675_FnlHXwA16ZMxmUr/720.mp4
Example usage:
<video width="100%" height="auto" autoplay="autoplay" loop="true" playsinline="" oncanplay="this.play()">
<source type="video/mp4" src="https://demo-public.gvideo.io/videos/2675_FnlHXwA16ZMxmUr/720.mp4"/>
</video>
Gcore supports regular download requests for entire MP4 file downloads. We also support range requests specifying the HTTP "Range" header.
curl -v 'https://demo-public.gvideo.io/videos/2675_FnlHXwA16ZMxmUr/720.mp4' -H 'range: bytes=4259840-'
> GET /videos/2675_FnlHXwA16ZMxmUr/720.mp4 HTTP/2
> Host: demo-public.gvideo.io
> range: bytes=4259840-
< HTTP/2 206 < content-type: video/mp4
< content-length: 43497712
< content-range: bytes 4259840-47757551/47757552
Note: Video protection via the Security Tokens feature is available for MP4 files.
Gcore’s Streaming Platform provides HLS by default. If you want to enable MP4 support, contact our support team.
You can get links to videos in two ways: in the control panel or via the API.
Select the video in the Video Hosting section, open the "Export" tab, and copy the following links.
To get information about the video, call a method:
https://api.gcore.com/docs/streaming#tag/Videos/operation/get_api_videos_id
Example request:
GET https://api.gcore.com/streaming/videos/2474723
Example response:
{
"id": 2474723,
"name": "Coffee Run - Blender Open Movie",
...
"hls_url": "https://demo-public.gvideo.io/videos/2675_FnlHXwA16ZMxmUr/master.m3u8",
"iframe_url": "https://demo-public.gvideo.io/videos/2675_FnlHXwA16ZMxmUr",
"iframe_embed_code": "<iframe width="560" height="315" src="https://demo-public.gvideo.io/videos/2675_FnlHXwA16ZMxmUr" frameborder="0" allowfullscreen></iframe>",
"converted_videos": [
{
"name": "vod720n",
"width": 1720,
"height": 720,
"mp4_url": "https://demo-public.gvideo.io/videos/2675_FnlHXwA16ZMxmUr/720.mp4"
},
{
"name": "vod480n",
"width": 1146,
"height": 480,
"mp4_url": "https://demo-public.gvideo.io/videos/2675_FnlHXwA16ZMxmUr/480.mp4"
},
...
]
}
Where:
iframe_url
contains a web player linkiframe_embed_code
contains web player embed codehls_url
contains the HLS linkmp4_url
contains the MP4 linkThe manifest file (.m3u8) contains all possible video qualities by default. If you want to limit the quality for old devices, non-paying users, or a quick view, you can specify a suffix indicating the minimum and/or maximum allowed resolution:
-min-N
: minimum resolution not less than specified-max-N
: maximum resolution not exceeding than specifiedN
is a resolution (height or width) from 240 to 9999. If the video is horizontally oriented, the resolution is its height. If it's vertically oriented, it should be width.
Here’s an example of how to get two qualities only—360 and 480—instead of the full set:
curl https://demo-public.gvideo.io/videos/2675_FnlHXwA16ZMxmUr/master-min-360-max-719-img.m3u8
The response is:
#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=928000,RESOLUTION=1148x480,FRAME-RATE=24.000,CODECS="avc1.4d401f,mp4a.40.2",VIDEO-RANGE=SDR
index-svod480n-v1-a1.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=514000,RESOLUTION=860x360,FRAME-RATE=24.000,CODECS="avc1.42c01e,mp4a.40.2",VIDEO-RANGE=SDR
index-svod360n-v1-a1.m3u8
#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=71839,RESOLUTION=1148x480,CODECS="avc1.4d401f",URI="iframes-svod480n-v1-a1.m3u8",VIDEO-RANGE=SDR
#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=35296,RESOLUTION=860x360,CODECS="avc1.42c01e",URI="iframes-svod360n-v1-a1.m3u8",VIDEO-RANGE=SDR
Was this article helpful?
Explore the Streaming Platform by Gcore