Record Your Livestream
How to get your live stream recordings from LiveAPI
Overview
All live streams broadcasted via LiveAPI are automatically recorded as temporary video-on-demand (VOD) files.
These temporary files are available for preview or download for 3 days. After that, all temporary recordings will be deleted.
If you want to permanently store the recordings and redistribute them to your audience later, you can do so with our Convert Temporary Recordings into VOD endpoint.
How to get recording files of a stream
After the live stream starts for a few seconds, you can call GET /live_streams/{id}/temporary_recordings
and use the Livestream ID to get the details of the recording.
Please note that the full recording of the stream is only accessible when it has fully ended (stopped streaming for more than one minute).
Sample request:
curl --location --request GET 'https://api.liveapi.com/live_streams/621ef65be0d97130801f5ffc/temporary_recordings' \
--header 'Authorization: {your_authentication}'
Sample Response:
For a detailed explanation of each field, please refer to GET /live_streams/{id}/temporary_recordings
[
{
"_id": "624322b9dbe478395adc8077",
"stream_key": "lv_161ecd60af7311ec9725b19ca3388eec",
"start_time": "2022-03-29T15:16:01.000Z",
"end_time": "2022-03-29T15:17:49.000Z",
"export_data": [
{
"from": "2022-03-29T15:16:01.000Z",
"duration": 100,
"bytes": 23843092,
"status": "EXPORTED",
"video_id": "6243245a0e7d6f41651d8408",
"download_url": "https://assets.liveapi.com/recordings/623996689bae82d397a16f7e/lv_161ecd60af7311ec9725b19ca3388eec/archive-1648566961-100.mp4"
}
],
"duration": 108,
"playback": {
"temporary_playback": "https://player.liveapi.com/lv_161ecd60af7311ec9725b19ca3388eec?range=1648566961-108&store=ap-1"
},
"download_url": "https://assets.liveapi.com/instant/ap-1/623996689bae82d397a16f7e/lv_161ecd60af7311ec9725b19ca3388eec/archive-1648566961-108.mp4"
}
]
Merging disrupted stream
If for any reason, the live stream is disrupted then resumes in less than 1 minute, the recording parts will be automatically merged into one recording.
Converting a temporary recorded file to a Permanent Video Asset
You have two options for converting the temporary recordings to permanent files:
-
Convert the whole temporary recording file - The entire temporary recording file is converted into a permanent video asset using the Convert Temporary Recordings into VOD endpoint.
-
Convert a part of temporary recording file - Only a part of the file is converted into a permanent video asset. Using the
from
parameter in the Convert Temporary Recordings into VOD endpoint, you can specify the starting time of the converting video and use theduration
parameter to specify the duration (in seconds) from the selected starting time to complete snipping the recording.
Sample Request
curl --location --request POST 'https://api.liveapi.com/live_streams/620e0d57427ff4ddd764515f/temporary_recordings/6220825bd387435dcfd6434a' \
--header 'Content-Type: application/json;charset=UTF-8' \
--header 'Authorization: {your_authentication}' \
--data-raw '{
"from": "2022-03-03T08:50:53.000Z",
"duration": 222
}'
Sample Response
{
"from": "2022-03-03T08:50:53.000Z",
"duration": 222,
"bytes": 0,
"status": "PROCESSING",
"download_url": null
}
Depends on the length of the video, the exporting time is varied. To know when the video is exported successfully, it's best to set up a webhook. Once the video is exported, you will receive a video-ready
event which has the exported video's _id
and some media info for further processing.
You can use the _id
returned in the webhook and call GET /videos/{id}
to get the video's playback URLs, download URL, media info, and other details.
Sample webhook event
{
"event": "video-ready",
"payload": {
"_id": "622096d9d3b96564a0180c62",
"mediainfo": {
"duration": "222.000",
"track": [
{
"@type": "General",
"VideoCount": "3",
"AudioCount": "1",
"FileExtension": "mp4",
"Format": "MPEG-4",
"FileSize": "52305879",
"Duration": "222.000",
"OverallBitRate_Mode": "VBR",
"OverallBitRate": "1884897",
"FrameRate": "30.000"
},
{
"@type": "Video",
"Format": "AVC",
"Format_Profile": "Main",
"Format_Level": "3.1",
"CodecID": "avc1",
"BitRate": "928860",
"Width": "1280",
"Height": "720",
"DisplayAspectRatio_String": "16:9",
"FrameRate_Mode": "CFR",
"FrameRate": "30.000"
},
{
"@type": "Audio",
"Format": "AAC",
"CodecID": "mp4a-40-2",
"BitRate": "132300",
"Channels": "2",
"ChannelPositions": "Front: L R",
"SamplingRate": "48000"
}
]
}
}
}
Get all permanent videos belonging to a livestream
If you wish to get a list of all exported videos from a livestream, you can do so by calling GET /live_streams/{id}/recordings
Manage Permanent Video Asset
Once the live-to-vod files are converted into permanent video assets, you can manage them using the Videos endpoints in LiveAPI.
Storage Term
All temporary recordings will not be counted against your minute hosting quota, while permanent videos will. We suggest that you only export the necessary videos to optimize storage usage.
Updated about 1 year ago