|
| 1 | +--- |
| 2 | +title: Create an Azure Media Services live stream with OBS Studio |
| 3 | +description: Learn how to create an Azure Media Services live stream by using the portal and OBS Studio |
| 4 | +services: media-services |
| 5 | +ms.service: media-services |
| 6 | +ms.topic: quickstart |
| 7 | +ms.author: inhenkel |
| 8 | +author: IngridAtMicrosoft |
| 9 | +ms.date: 04/16/2020 |
| 10 | +--- |
| 11 | + |
| 12 | +# Create an Azure Media Services live stream with OBS |
| 13 | + |
| 14 | +This quickstart will help you create an Azure Media Services live stream by using the Azure portal and Open Broadcasting Studio (OBS). It assumes that you have an Azure subscription and have created a Media Services account. |
| 15 | + |
| 16 | +In this quickstart, we'll cover: |
| 17 | + |
| 18 | +- Setting up an on-premises encoder with OBS. |
| 19 | +- Setting up a live stream. |
| 20 | +- Setting up live stream outputs. |
| 21 | +- Running a default streaming endpoint. |
| 22 | +- Using Azure Media Player to view the live stream and on-demand output. |
| 23 | + |
| 24 | +## Prerequisites |
| 25 | + |
| 26 | +If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/) before you begin. |
| 27 | + |
| 28 | +## Sign in to the Azure portal |
| 29 | + |
| 30 | +Open your web browser, and go to the [Microsoft Azure portal](https://portal.azure.com/). Enter your credentials to sign in to the portal. The default view is your service dashboard. |
| 31 | + |
| 32 | +## Set up an on-premises encoder by using OBS |
| 33 | + |
| 34 | +1. Download and install OBS for your operating system on the [Open Broadcaster Software website](https://obsproject.com/). |
| 35 | +1. Start the application and keep it open. |
| 36 | + |
| 37 | +## Run the default streaming endpoint |
| 38 | + |
| 39 | +1. Select **Streaming endpoints** in the Media Services listing. |
| 40 | + |
| 41 | +  |
| 42 | +1. If the default streaming endpoint status is stopped, select it. This step takes you to the page for that endpoint. |
| 43 | +1. Select **Start**. |
| 44 | + |
| 45 | +  |
| 46 | + |
| 47 | +## Set up an Azure Media Services live stream |
| 48 | + |
| 49 | +1. Go to the Azure Media Services account within the portal, and then select **Live streaming** from the **Media Services** listing. |
| 50 | + |
| 51 | +  |
| 52 | +1. Select **Add live event** to create a new live streaming event. |
| 53 | + |
| 54 | +  |
| 55 | +1. Enter a name for your new event, such as *TestLiveEvent*, in the **Live event name** box. |
| 56 | + |
| 57 | +  |
| 58 | +1. Enter an optional description of the event in the **Description** box. |
| 59 | +1. Select the **Pass-through – no cloud encoding** option. |
| 60 | + |
| 61 | +  |
| 62 | +1. Select the **RTMP** option. |
| 63 | +1. Make sure that the **No** option is selected for **Start live event**, to avoid being billed for the live event before it's ready. (Billing will begin when the live event is started.) |
| 64 | + |
| 65 | +  |
| 66 | +1. Select the **Review + create** button to review the settings. |
| 67 | +1. Select the **Create** button to create the live event. You're then returned to the live event listing. |
| 68 | +1. Select the link to the live event that you just created. Notice that your event is stopped. |
| 69 | +1. Keep this page open in your browser. We'll come back to it later. |
| 70 | + |
| 71 | +## Set up a live stream by using OBS Studio |
| 72 | + |
| 73 | +OBS starts with a default scene but with no inputs selected. |
| 74 | + |
| 75 | +  |
| 76 | + |
| 77 | +### Add a video source |
| 78 | + |
| 79 | +1. From the **Sources** panel, click the **add** icon to select a new source device. The **Sources** menu will open. |
| 80 | + |
| 81 | +1. Select **Video Capture Device** from the source device menu. The **Create/Select Source** menu will open. |
| 82 | + |
| 83 | +  |
| 84 | + |
| 85 | +1. Select the **Add Existing** radio button, then click **OK**. The **Properties for Video Device** menu will open. |
| 86 | + |
| 87 | +  |
| 88 | + |
| 89 | +1. From the **Device** dropdown list, select the video input you want to use for your broadcast. Leave the rest of the settings alone for now, and click **OK**. The input source will be added to the **Sources** panel, and the video input view will show up in the **Preview** area. |
| 90 | + |
| 91 | +  |
| 92 | + |
| 93 | +### Add an audio source |
| 94 | + |
| 95 | +1. From the **Sources** panel, click the **add** icon to select a new source device. The Source Device menu will open. |
| 96 | + |
| 97 | +1. Select **Audio Input Capture** from the source device menu. The **Create/Select Source** menu will open. |
| 98 | + |
| 99 | +  |
| 100 | + |
| 101 | +1. Select the **Add Existing** radio button, then click **OK**. The **Properties for Audio Input Capture** menu will open. |
| 102 | + |
| 103 | +  |
| 104 | + |
| 105 | +1. From the **Device** dropdown list, select the audio capture device you want to use for your broadcast. Leave the rest of the settings alone for now, and click OK. The audio capture device will be added to the audio mixer panel. |
| 106 | + |
| 107 | +  |
| 108 | + |
| 109 | +### Set up streaming in OBS |
| 110 | + |
| 111 | +In the next procedure, you'll go back to Azure Media Services in your browser to copy the input URL to enter into the output settings: |
| 112 | + |
| 113 | +1. On the Azure Media Services page of the portal, select **Start** to start the live stream event. (Billing starts now.) |
| 114 | + |
| 115 | +  |
| 116 | +1. Set the **RTMP** toggle to **RTMPS**. |
| 117 | +1. In the **Input URL** box, copy the URL to your clipboard. |
| 118 | + |
| 119 | +  |
| 120 | + |
| 121 | +1. Switch to the OBS application. |
| 122 | + |
| 123 | +1. Click the **Settings** button in the **Controls** panel. The Settings options will open. |
| 124 | + |
| 125 | +  |
| 126 | + |
| 127 | +1. Select **Stream** from the **Settings** menu. |
| 128 | + |
| 129 | +1. From the **Service** dropdown list, select Show all, then select **Custom...**. |
| 130 | + |
| 131 | +1. In the **Server** field, paste the RTMPS URL you copied to your clipboard. |
| 132 | + |
| 133 | +1. Enter something into the **Stream key** field. It doesn't really matter what it is, but it needs to have a value. |
| 134 | + |
| 135 | +  |
| 136 | + |
| 137 | +1. Select **Output** from the **Settings** menu. |
| 138 | + |
| 139 | +1. Enter *2* into the **Keyframe interval** field. This sets the fragment length to 2 seconds. For lower latency live delivery, use the value of 1 second. |
| 140 | + |
| 141 | +1. OPTIONAL: Set the **CPU Usage Preset** to *veryfast* if you are using a computer that is low on processing power. Optionally, you can set the kbps to something lower if there are undesirable network conditions. |
| 142 | + |
| 143 | +  |
| 144 | + |
| 145 | +1. Leave the rest of the settings unchanced and click **OK**. |
| 146 | + |
| 147 | +### Start streaming |
| 148 | + |
| 149 | +1. In the **Controls** panel, click **Start Streaming**. |
| 150 | + |
| 151 | +  |
| 152 | + |
| 153 | +2. Switch to the Azure Media Services Live event screen in your browser and click the **Reload Player** link. You should now see your stream in the Preview player. |
| 154 | + |
| 155 | +## Set up outputs |
| 156 | + |
| 157 | +This part will set up your outputs and enable you to save a recording of your live stream. |
| 158 | + |
| 159 | +> [!NOTE] |
| 160 | +> For you to stream this output, the streaming endpoint must be running. See the later [Run the default streaming endpoint](#run-the-default-streaming-endpoint) section. |
| 161 | +
|
| 162 | +1. Select the **Create outputs** link below the **Outputs** video viewer. |
| 163 | +1. If you like, edit the name of the output in the **Name** box to something more user-friendly so it's easy to find later. |
| 164 | + |
| 165 | +  |
| 166 | +1. Leave all the rest of the boxes alone for now. |
| 167 | +1. Select **Next** to add a streaming locator. |
| 168 | +1. Change the name of the locator to something more user-friendly, if you want. |
| 169 | + |
| 170 | +  |
| 171 | +1. Leave everything else on this screen alone for now. |
| 172 | +1. Select **Create**. |
| 173 | + |
| 174 | +## Play the output broadcast by using Azure Media Player |
| 175 | + |
| 176 | +1. Copy the streaming URL under the **Output** video player. |
| 177 | +1. In a web browser, open the [Azure Media Player demo](https://ampdemo.azureedge.net/azuremediaplayer.html). |
| 178 | +1. Paste the streaming URL into the **URL** box of Azure Media Player. |
| 179 | +1. Select the **Update Player** button. |
| 180 | +1. Select the **Play** icon on the video to see your live stream. |
| 181 | + |
| 182 | +## Stop the broadcast |
| 183 | + |
| 184 | +When you think you've streamed enough content, stop the broadcast. |
| 185 | + |
| 186 | +1. In the portal, select **Stop**. |
| 187 | + |
| 188 | +1. In OBS, select the **Stop Streaming** button in the **Controls** panel. This step stops the broadcast from OBS. |
| 189 | + |
| 190 | +## Play the on-demand output by using Azure Media Player |
| 191 | + |
| 192 | +The output that you created is now available for on-demand streaming as long as your streaming endpoint is running. |
| 193 | + |
| 194 | +1. Go to the Media Services listing and select **Assets**. |
| 195 | +1. Find the event output that you created earlier and select the link to the asset. The asset output page opens. |
| 196 | +1. Copy the streaming URL under the video player for the asset. |
| 197 | +1. Return to Azure Media Player in the browser and paste the streaming URL into the URL box. |
| 198 | +1. Select **Update Player**. |
| 199 | +1. Select the **Play** icon on the video to view the on-demand asset. |
| 200 | + |
| 201 | +## Clean up resources |
| 202 | + |
| 203 | +> [!IMPORTANT] |
| 204 | +> Stop the services! After you've completed the steps in this quickstart, be sure to stop the live event and the streaming endpoint, or you'll be billed for the time they remain running. To stop the live event, see the [Stop the broadcast](#stop-the-broadcast) procedure, steps 2 and 3. |
| 205 | +
|
| 206 | +To stop the streaming endpoint: |
| 207 | + |
| 208 | +1. From the Media Services listing, select **Streaming endpoints**. |
| 209 | +2. Select the default streaming endpoint that you started earlier. This step opens the endpoint's page. |
| 210 | +3. Select **Stop**. |
| 211 | + |
| 212 | +> [!TIP] |
| 213 | +> If you don't want to keep the assets from this event, be sure to delete them so you're not billed for storage. |
| 214 | +
|
| 215 | +## Next steps |
| 216 | + |
| 217 | +> [!div class="nextstepaction"] |
| 218 | +> [Live events and live outputs in Media Services](./live-events-outputs-concept.md) |
0 commit comments