Our lives, from meaningful life events like birthdays, weddings, and baby showers, to work meetings, fitness classes, shopping, and social media streaming, have moved online this year. With change comes an opportunity to innovate - and that’s what we have done collectively as a world society amidst a global pandemic.
At Livepeer, we understand the increasing importance of capturing these meaningful moments, both for individuals and for companies riding this wave of digital innovation. We are therefore proud to announce the release of Livepeer.com stream recording, a feature much requested and anticipated.
This recording feature provides all Livepeer.com API and dashboard users with a .m3u8 link to an adaptive bitrate streaming (ABR) recording of their completed livestream. Playback is delivered via Livepeer.com's CDN by default.
To take advantage of this newly released feature, check out the guide below. The first section is for Livepeer.com users who create streams using the Livepeer.com Dashboard directly. The second section is for those who use the Livepeer.com API.
Please note: If you are using recording and OBS, be sure to change your keyframe interval to 2.
If you’re using the Livepeer.com Dashboard to create streams, enabling recording is as simple as checking the Record ON
button in your individual stream page. The URL for your individual stream page should look something like this:
https://livepeer.com/app/stream/12345678-ab40-429d-a714-0e0fd4ab0abc.
The Record ON
button is located immediately below the Ingest and playback URL pairs
section. When Record ON
is checked, future streaming sessions will be recorded and stored by Livepeer.com. The session recording playback URL will be available about 5 minutes after the live stream ends and will appear in the session table at the bottom of the stream page.
If you do not have a Livepeer.com account or an API key follow step 1 in this guide prior to getting started.
Before learning how to make a simple API request to turn recording on for streaming, we need to understand the Livepeer.com API stream
object.
There are two types of stream objects.
stream
object is a single live streaming session.stream
object shows the configuration and metadata totals of all its child stream sessions.On a parent stream
object.
record: true
means that new sessions are recordedrecord: false
means that new sessions are not recordedOn a child-session stream
object, the record value is read-only.
record: true
means that the session is actively being recorded or was recorded.record: false
means that the session is not being recorded or was not recorded.Read more about the stream
object here.
Send an HTTP POST
request to https://livepeer.com/api/stream
. In that request, include an authorization
header of Bearer <api_key>
, a JSON body with a stream name
of your choosing, a record
field set to true
, and details about which video profiles or renditions you’d like to transcode your stream into. See step 3 in this guide for more information on profiles.
Sample post request:
curl -X POST \
-H 'content-type: application/json' \
-H 'authorization: Bearer <api_key>' \
-d '{
"name": "test_stream_recording_on",
"record": true
}' \
https://livepeer.com/api/stream
Sample response of stream with recording turned on:
{
"name":"test_stream_recording_on",
"record":true,
"kind":"stream",
"userId":"xxxxxxxx-xxxx-xxxx-xxxx-xxxx",
"id":"yyyyyyyy-yyyy-yyyy-yyyy-yyyy",
"createdAt":1595721600,
"streamKey":"zzzz-zzzz-zzzz-zzzz",
"playbackId":"xyz123xyz123",
"createdByTokenName":"test-api-key",
<other asset object keys, like profiles>
}
PATCH /stream/<parent_stream_id>/record
to modify a parent stream
object. The parent record
value is inherited by all future child-session stream
objects.
curl -X PATCH https://livepeer.com/api/stream/<parent_stream_id>/record \
-H 'content-type: application/json' \
-H 'authorization: Bearer <api_key>' \
-d '{"record":true}'
The response to GET /stream/<parent_stream_id>
will return the record
value.
curl -H 'authorization: Bearer <api_key>' \
"https://livepeer.com/api/stream/<parent_stream_id>"
The parentId
of a child-session stream
object is the same as the id
of its parent stream
object. A common use case is to request all recorded sessions with the same parentId
. For example, a user generated content (UGC) video platform may create a stream
object for each UGC live streamer and then want to show an archive of all recorded livestream sessions for each live streamer.
To request all stream
sessions with the same parentId
with record: true
make the following request:
curl -H 'authorization: Bearer <api_key>' \
"https://livepeer.com/api/stream/<parent_stream_id>/sessions?record=1"
The playback URL for a livestream session recording will not be available until approximately 5 minutes after the livestream has ended.
Once the recording is ready, the session stream
object's recordingUrl
parameter will return the .m3u8 recording playback URL.
The recording playback URL will look something like this: https://region-cdn.livepeer.com/recordings/<id-of-stream-session>/index.m3u8
. View the live stream with any HLS video player.
For more detailed information on stream recording or to ask any questions, share your thoughts, or make any kind of suggestion, feel free to get in touch at hello@livepeer.com. We’d love to hear from you!