Thursday, January 28, 2021
Product

Livepeer.com's New Stream Recording & MP4 Download Features

By
Angie Ramirez
Angie Ramirez
4 min read
The latest release of Livepeer stream recording & MP4 downloads, and much requested features from our comunity.

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 and an MP4 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.

Using the Livepeer.com Dashboard to record streams

If you’re using the Livepeer.com Dashboard to create streams, enabling recording is as simple as checking the Record ON toggle in your individual stream page. The URL for your individual stream page should look something like this:

https://livepeer.com/dashboard/streams/12345678-ab40-429d-a714-0e0fd4ab0abc.

The Record ON toggle is located immediately below the Stream Key section. You can also change the settings by using the "Actions" button at the top of the page. When Record ON is switched on, 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.

Using the Livepeer.com API to record streams

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.

  • A child stream object is a single live streaming session.
  • A parent 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 recorded
  • record: false means that new sessions are not recorded

On 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.

To create a new recording-enabled stream:

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>
}

To enable recording for existing streams:

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}'

To check if recording is enabled on an existing stream:

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>"

To request all recorded sessions for a parent stream:

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"

Playback a session recording:

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. Additionally, the session stream object's mp4URL will return an .mp4 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!


Articles you may be interested in

Ready to get started?

Create a free account instantly and start creating streams. You can also contact us to design a custom package for your business.
Join our newsletter to stay up to date on features and new releases.
Livepeer, Inc.
223 Bedford Ave PMB 530
Brooklyn, NY 11211