Live Streaming

Get API Key for Live Streaming

The start streaming with Qencode, you need your

, which can be found in the List of Projects for live streaming inside your account.


assigned to each Project allows you easily segment usage and billing based on your preferences, while provide some control over access to the Qencode API. If you want to generate a new API Key, you can do so by creating a Project. You can also recreate an
for an existing Project via the UI inside your account.

Get Access Token

Once you have your

, use it to generate a session-based
, which is used to authenticate all of your subsequent live stream requests.

Here's an example of API request to get access token:

curl -X POST

Response example:

 "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyjpYXQiOjE2MjgxNTgyNJMsInN1YiI6MTMwLCJleHAiOjE2MjgyNDQ2NjN9.SxS3zLx2CZbZ9ylTpd25kj9el6_4TqqTWUA9RT2iJ9I"

Token returned should be passed in Authorization header to all other live streaming API methods.

Create Live Stream

Now that you have an

, use it with the
method to create a new live stream.

There is a wide range of parameters that are required that contains all the information you need to start streaming.

Choose an Input Protocol for Stream

The way you stream depends on your ingest protocol. Qencode supports RTMP, WebRTC and SRT protocols for live streaming.

RTMP Streaming

To start broadcasting with RTMP, enter the following values into your streaming client or software.

OBS live streaming parameters
  1. Server URL

You can also get this URL

method and get RTMP Server URL.

"server_urls": {
   "rtmp": "rtmp://",
  1. Stream key

There are three ways to get the

for your stream.

  • As part of the response when you create a live stream
  • When you query stream details
    method and get webrtc server url from its response
  • By clicking on a stream on the Stream List page.

If you want to reduce startup time, you can start the encoder in advance using You can also get this URL

method and get RTMP Server URL.

Otherwise, you can start streaming using your credentials and the system will allocate an encoder automatically.

WebRTC Streaming

For WebRTC input typical setup is the following: client's webpage gets access to a webcam and pushes the stream from it to Qencode. We provide a powerful WebRTC Kit you can use to integrate this feature into your web site. For testing purposes you can use this WebRTC Test page

  1. Start your WebRTC stream

You should call

method and get webrtc server url from its response:

"server_urls": {
   "rtmp": "rtmp://",
   "webrtc": "wss://"

Alternatively you can start stream using Start stream link on the Stream detail page in your Qencode account UI. Available server urls will be shown there as well.

  1. Push stream to Server URL

To start broadcasting with WebRTC, you need the webrtc value from

along with the
you received in Step 1.

You can start streaming using our WebRTC Test page or any web client that supports WebRTC.

Note: The timeout to receive input for a stream is 120 seconds, so please make sure you call the

method shortly after the stream is started.

Using the WebRTC test page

If you are using the test page, make sure you

  1. Allow webcam and microphone access. You can verify this if the video is visible on the page.
  2. Press Connect button to start pushing the stream to Qencode.

SRT Streaming

To set up your client app you need a Server URL for SRT input. This URL also includes

. Server URL for SRT is available after the stream is started. You can start your stream via UI or API. To start a stream in UI click on one of your streams on the stream list page, then press Start stream button in the stream Input section:

Starting SRT stream in UI

You can also start the stream by calling

method and getting srt server url from its response:

"server_urls": {
   "rtmp": "rtmp://",
   "srt": "srt://"

Specify the SRT Server URL in your streaming client app settings. You can see screenshot of OBS params below:

OBS stream params

Ingest timeout for a stream is 120 seconds. Please make sure it's less than 120 seconds passed since you have called

method when you start pushing the stream to the srt server url.

Play your live stream

Each stream has a unique playback_id value identifying a playback URL.


For HLS output stream playback URL format will be the following:


You can use any player supporting ABR streams playback.
Using Qencode Player is described here

Stop live stream

Stopping a broadcast in your streaming client will bring stream to an Idle status. Renewing broadcast withing a two minutes interval after stopping it will make your stream Live again. If more than two minutes pass after broadcast is stopped or interrupted stream gets Stopped.

method immediately stops a live stream.

Here's an example of API request to stop a stream:

curl -H "Authorization: Bearer $ACCESS_TOKEN" 

Receive stream event callbacks

You can set up an endpoint on your web server and get webhook notifications each time a stream event occurs, e.g. when stream status is changed. To specify a callback for a stream you need to call

method and pass the following data:

    "callback_url": ""

After you set up a callback URL for a stream, Qencode will send an http POST request to it each time a stream event occurs. The body of http POST request is stream object data in JSON format.

More tutorials

Simulcast to 3rd party services or devices