Live Streaming
Get API Key for Live Streaming
The start streaming with Qencode, you need your
The
Get Access Token
Once you have your
Here's an example of API request to get access token:
curl -X POST https://api-live.qencode.com/v1/access_token/your_api_key
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
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.

- Server URL
rtmp://rtmp-live.qencode.com/qlive
You can also get this URL
...
"server_urls": {
"rtmp": "rtmp://rtmp-live.qencode.com/qlive",
}
...
- Stream key
There are three ways to get the
- As part of the response when you create a live stream
- When you query stream details /v1/live-streams/<stream_id>/startmethod 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
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
- Start your WebRTC stream
You should call
...
"server_urls": {
"rtmp": "rtmp://rtmp-live.qencode.com/qlive",
"webrtc": "wss://live-df6607d4-8866-4d30-906d-0fed54e58f97.qencode.com:3334/qlive/1234e5b1-dfd7-4daa-8121-bc5c68bbeb37"
}
...
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.
- Push stream to Server URL
To start broadcasting with WebRTC, you need the webrtc value from
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
If you are using the test page, make sure you
- Allow webcam and microphone access. You can verify this if the video is visible on the page.
- 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

You can also start the stream by calling
...
"server_urls": {
"rtmp": "rtmp://rtmp-live.qencode.com/qlive",
"srt": "srt://live-53801710-8c4e-433e-befb-5571d4843d4f.qencode.com:9999?streamid=1234e5b1-dfd7-4daa-8121-bc5c68bbeb37"
}
...
Specify the SRT Server URL in your streaming client app settings. You can see screenshot of OBS params below:

Ingest timeout for a stream is 120 seconds. Please make sure it's less than 120 seconds passed since you have called
Play your live stream
Each stream has a unique playback_id value identifying a playback URL.
HLS
For HLS output stream playback URL format will be the following:
https://play-<playback_id>/qhls/qlive/playlist.m3u8
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.
Calling
Here's an example of API request to stop a stream:
curl -H "Authorization: Bearer $ACCESS_TOKEN"
-X POST https://api-live.qencode.com/v1/live-streams/$STREAM_ID/stop
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
{
"callback_url": "https://yourserver.com/stream-callback-endpoint"
}
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.