Content-Length: 187537 | pFad | https://cloudinary.com/blog/simple-simulcast-live-streaming-cloudinary-obs

Learn How to Live Stream With Cloudinary and OBS
Skip to content

Simple Simulcast Live Streaming With Cloudinary and OBS

In this blog post, we’ll use the Cloudinary Live Streaming feature to start a live stream that we can simulcast to other services like YouTube and Twitch using OBS (Open Broadcaster Software).

At the time of this post, the only way to manage your live streams is via the Cloudinary API. Fortunately, Cloudinary has high-quality API documentation that makes this process mostly frictionless.

Before getting started making calls to the API, you need to collect a few details from the Cloudinary dashboard. The API calls will require your cloud name, API key, and API secret. You can find these details in Settings > API Keys. Once you have these ready, go to the Video Live Streaming API documentation page.

Enter your API details near the top of the page. This will allow you to copy calls to the API endpoints with your credentials already added. This UI allows you to test API calls directly from the browser, but please keep in mind that the cloudName variable isn’t automatically prefilled. You’ll need to do this manually. For the examples in this post, we’ll use the shell/terminal to make curl requests to the API.

API call

Once you get your cloudName and API keys set in the documentation, you should be able to copy curl commands and execute requests to the Cloudinary Live Streaming API. To confirm this, copy the command for GET /live_streams in your terminal. You should get back a JSON response with an empty array value for the data.

{
  "request_id": "3131e028f1e4ea7d024e15dd1153a586",
  "data": []
}
Code language: JSON / JSON with Comments (json)

Before you can start live streaming, you’ll need to create a stream. Copy the curl command from the POST /live_streams endpoint and run it in your terminal. With the default options, this will create a new RTMP live stream named “My first stream.”

We’ve trimmed out some of the response values to focus on the important parts of the new stream that we will be using for this tutorial. (We’ve also replaced any sensitive data related to my personal account.)

{
  "request_id": "2c41da07b90183b48c4f93b5a83ded20",
  "data": {
    "id": "[REDACTED]",
    "name": "My first stream",
    "input": {
      "type": "rtmp",
      "uri": "rtmp://live.cloudinary.com/streams",
      "stream_key": "[REDACTED]"
    },
    "status": "idle",
    "outputs": [
      {
        "id": "[REDACTED]",
        "name": "default hls",
        "type": "hls",
        "uri": "https://res.cloudinary.com/{cloudName}/video/live/live_stream_{stream_id}_hls.m3u8",
        "created_at": 1730130837173,
        "updated_at": 1730130837173
      },
    ],
  }
}

Code language: JSON / JSON with Comments (json)

data includes the details of our stream input. We will need these values to start broadcasting to our new stream with OBS. outputs contain the URL to the HLS stream that will be used to access and watch the stream. The HLS stream is the default output provided by the Cloudinary service. Later we will add additional outputs to our stream for simulcasting. Simulcasting allows us to broadcast the same stream to multiple platforms or devices simultaneously.

It’s time for the fun part. Now that we’ve created our stream, we can start broadcasting with OBS. You’ll want to open OBS to get your scenes and sources set up to your preferences for your broadcast. Once you’ve completed that, we can configure our Cloudinary Stream RTMP input.

Open OBS settings and navigate to the Stream page. For service, you will select Custom. This will provide Server and Stream Key inputs. Stream will take our input uri value and Stream Key will take the input stream_key from our stream data.

Once you fill these in your settings screen should look something like this:

settings screen

Click OK once you have these filled in and you’re ready to start broadcasting!

You can now click Start Streaming in your OBS Controls, and you’ll be broadcasting live via Cloudinary Streaming.

OBS controls start streaming

OBS controls stop streaming

In our stream data, Cloudinary provided an HLS output URL outputs[].uri. Once you’ve started broadcasting, you can use this URI in an HLS stream player. You can test out your stream as a viewer using a web based HLS stream player. This will let us confirm that our stream is working as expected.

Once you add your output URI to the input, your live stream should be loaded into the video player.

HLS URI output

live stream

Congratulations! Cloudinary made it pretty easy to start broadcasting a live stream. Next, we’ll cover one of the coolest features of Cloudinary’s live streaming service.

You might have bigger ambitions than just setting up a live stream on your personal website. Luckily, Cloudinary Live Streaming supports simulcasting. This means that you can send your live stream to broadcast on other services like Twitch and YouTube simultaneously.

To start simulcasting, you just need to add outputs to an existing live stream. For this demo, I’ll add a YouTube output. It’s a similar setup process to adding our Cloudinary stream to OBS. Providers like YouTube and Twitch will provide an RTMP address and stream key.

Head to YouTube and click Create > Go Live in the top-right navigation bar. Follow the dialogs to start a live stream. Once you’re finished, you should be on a dashboard that includes the RTMP URL and stream key.

Navigate to Create a new live stream output in the Cloudinary documentation. Copy the curl request. You’ll need to update some of the values before sending it.

First you need to replace __LIVESTREAMID__ with the ID provided from the curl call to create the stream earlier (data.id).

curl --request POST \
  --url https://api.cloudinary.com/v2/dtkji4khh/video/live_streams/{stream_id}/outputs \
  --header 'Authorization: Basic {auth_token}' \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "new youtube",
  "type": "simulcast",
  "uri": "rtmp://a.rtmp.youtube.com/live2",
  "stream_key": "[REDACTED]",
  "vendor": "youtube"
}'
Code language: PHP (php)

Once you update your request data and send the curl request, your Cloudinary live stream will start simulcasting to YouTube!

live stream simulcast

Broadcasting to Cloudinary live streaming using OBS is really fun! At the time of this writing it requires a little extra work manually making the API calls, as the feature is still in beta. The process to get a stream going will remain mostly the same though. You need to create a live stream, add any outputs for simulcasting, and start broadcasting using software like OBS. Cloudinary manages all the hard stuff! Just plug in RTMP URLs and stream keys and you’re all set.

If you haven’t already, sign up for a free Cloudinary account and try creating your own live stream today. And, if you found this blog post helpful and want to discuss it in more detail, head over to the Cloudinary Community forum and its associated Discord.

Back to top

Featured Post









ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://cloudinary.com/blog/simple-simulcast-live-streaming-cloudinary-obs

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy