const userID = "host-user-id";
const callID = "my-livestream";
const call = client.video.call("livestream", callID);
call.getOrCreate({
data: {
created_by_id: userID,
members: [{ user_id: "john", role: "host" }],
},
});
const credentials = call.createSRTCredentials(userID);
console.log(credentials.address);
SRT
Secure Reliable Transport (SRT) lets you ingest audio/video into Stream Video calls and livestreams. It’s a modern alternative to RTMP with UDP transport, codec‑agnostic support, and strong resilience to jitter and packet loss.
Quickstart
1) Create a call and generate SRT credentials
from getstream.models import CallRequest, MemberRequest
user_id = "host-user-id"
call_id = "my-livestream"
call = client.video.call('livestream', call_id)
call.create(
data=CallRequest(
created_by_id=user_id,
members=[MemberRequest(user_id=user_id, role="host")],
),
)
srt_credentials = call.create_srt_credentials(user_id)
print(srt_credentials.address)
call := client.Video().Call("default", "my-livestream")
_, err := call.GetOrCreate(context.Background(), &getstream.GetOrCreateCallRequest{
Data: &getstream.CallRequest{
CreatedByID: &userID,
},
})
if err != nil {
log.Fatal(err)
}
credentials, err := call.CreateSRTCredentials("host-user-id")
if err != nil {
log.Fatal(err)
}
fmt.Println(credentials.Address)
String userId = "user-" + RandomStringUtils.randomAlphanumeric(10);
client.updateUsers(
UpdateUsersRequest.builder()
.users(Map.of(userId, UserRequest.builder().id(userId).name("User Name").build()))
.build()
);
String callID = "call-" + RandomStringUtils.randomAlphanumeric(10);
Call call = video.call("livestream", callID);
call.getOrCreate(GetOrCreateCallRequest.builder().data(
CallRequest.builder().createdByID(userId).build()
).build());
String srtToken = call.createSRTCredentials(testUser.getId()).getAddress();
System.out.println("SRT Token: " + srtToken);
# Create the call (example)
curl -X POST "https://video.stream-io-api.com/api/v2/video/call/livestream/${CALL_ID}?api_key=${API_KEY}" \
-H "Authorization: ${TOKEN}" -H "Content-Type: application/json" -H "stream-auth-type: jwt" \
-d '{
"data": {"created_by_id": "host-user-id", "members": [{"user_id": "host-user-id", "role": "host"}]}
}'
# Generate SRT credentials (address contains embedded credentials)
curl -X POST "https://video.stream-io-api.com/api/v2/video/call/livestream/${CALL_ID}/srt_credentials?api_key=${API_KEY}" \
-H "Authorization: ${TOKEN}" -H "Content-Type: application/json" -H "stream-auth-type: jwt" \
-d '{"user_id": "host-user-id"}'
2) Send video to Stream via ffmpeg or OBS
If you have ffmpeg installed, you can quickly send a sample video to your call. Replace ${SRT_ADDRESS}
with the generated address above.
Send with FFMPEG
ffmpeg -re \
-i "https://cdn.jsdelivr.net/npm/big-buck-bunny-1080p@0.0.6/video.mp4" \
-c:v libx264 -preset veryfast -tune zerolatency -g 50 -pix_fmt yuv420p \
-c:a aac -b:a 128k -ac 2 \
-f mpegts "${SRT_ADDRESS}"
Send with OBS
To stream from OBS using SRT, use a recent OBS release (32.0.0 or newer). Then set Service to “Custom” and paste the SRT address into the Server/URL field.
Note: OBS 32.0.0+ is required for stable SRT support; older versions may fail to publish.
3) Preview the stream
Use the viewer demo to watch the livestream via WebRTC/HLS. Ensure you use the same API key and call ID you used in step 1.
Recommended settings
- Video codec: H.264
- Choose resolution/bitrate for your content. See Quality for guidance.
SRT vs RTMP
Feature | SRT | RTMP |
---|---|---|
Latency | ~100 ms – 1s | ~2s |
Transport | UDP (ARQ/FEC) | TCP |
Reliability | High (handles jitter/loss) | Moderate (retransmits add delay) |
Security | AES encryption | RTMPS/TLS required |
Codecs | H.264, AV1, VP8, VP9 | Commonly H.264/AAC |