Hi LiveKit community! :wave: I'm building a recor...
# ask-ai
m
Hi LiveKit community! 👋 I'm building a recording status monitor for interviews and need to display real server-side bitrate statistics (not client-side estimates). I've been exploring the LiveKit APIs but haven't found the right approach yet. What I'm trying to achieve: Display the actual bitrate that the LiveKit server receives from participants Ideally: Get the bitrate that egress services receive during recording Alternative: Get the inbound bitrate the server receives from each client What I've tried so far: LiveKit Server SDK getParticipant() - only gives track metadata (dimensions, quality) LiveKit Client SDK stats - gives client-side estimates, but I need server-side measurements LiveKit Analytics API - not sure if this provides real-time bitrate data My questions: Does the LiveKit Server SDK expose real-time bitrate statistics anywhere? Does the Analytics API provide per-participant bitrate data that I can query in real-time? Is there a way to get the bitrate that egress services receive during recording? Any other approaches to get server-measured (not estimated) bitrate data? Use case: Recording quality monitoring for interview sessions - showing hosts the actual bandwidth/quality being received by the server for each participant. Any guidance would be greatly appreciated! Thanks for building such an awesome platform! 🙏 Tech stack: Node.js backend with LiveKit Server SDK, React frontend LiveKit version: 1.8.4
t
Thanks for reaching out, Rafa. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
To monitor server-side bitrate statistics for your use case, here are the available options: • LiveKit Server SDK: The SDK tracks real-time bitrate statistics for each spatial and temporal layer. This data is calculated by dividing the bytes sent by the time interval. • LiveKit Analytics API: This provides detailed, real-time per-participant bitrate data, including track-level statistics like bitrate, frame rate, and packet loss. • Egress Services: While there isn't a direct API to monitor the bitrate received by egress services during recording, you can use external tools like FFprobe for post-processing analysis or monitor configured bitrate settings in the egress encoding options. Would you like guidance on implementing any of these approaches, or do you have specific requirements for your monitoring system? Sources: pkg/sfu/streamtracker/streamtracker_dd.go | Announcing LiveKit Cloud | test/ffprobe.go | Sources/LiveKit/Protos/livekit_models.pb.swift | livekit-ffi/src/livekit.proto.rs
m
Please give me details for option 1
t
Here’s a quick rundown on how to use the LiveKit Server SDK for real-time bitrate stats: • Bitrate Tracking: The SDK has a handy
StreamTrackerDependencyDescriptor
that keeps an eye on bytes for each spatial and temporal layer. It figures out the bitrate by dividing the bytes sent over the time interval. • Periodic Updates: The server regularly sends updates about the bitrate through a worker function, refreshing each layer’s bitrate and letting listeners know when availability changes. • Implementation: You can grab these stats easily by integrating the SDK into your Node.js backend and using the right APIs to pull track-level data. If you want, I’m here to help you get the SDK set up or show you how to access these stats in your backend—just let me know!
m
Can you give me some example code?
Could you please point me to the right directly how I can implement that? I can't find it in the docs
t
I don't have the answer you're looking for. You could also try asking your question: • in one of the other Slack channels or • to https://deepwiki.com/livekit/livekit_composite which is trained on all LiveKit source code If you find the answer, please post it here to help others!