Does livekit enforce audio encoding at 48k stereo ...
# ask-ai
w
Does livekit enforce audio encoding at 48k stereo opus? in my client i'm publishing an audiotrack with 16k sampleRate withand1 channel, but in the server I'm always getting it back as stereo and what seems to be 48k pcm
g
It seems likely that LiveKit enforces a default audio encoding of 48kHz stereo, as indicated by the AudioStream class which defaults to a sample rate of 48000 Hz and 1 channel. This suggests that even if you publish an audio track with a different sample rate and channel configuration, LiveKit might convert it to its default settings for consistency and compatibility across different clients and devices. If you are experiencing this conversion, it might be due to LiveKit's internal handling of audio streams to ensure optimal quality and compatibility. Would you like more details on how to potentially configure or override these settings? Sources: - AudioStream class 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.
w
@millions-hair-24956 i'm specifically using the js SDK on the client and the golang server sdk (edited)
g
In the context of using the LiveKit JS SDK on the client and the Go SDK on the server, the default behavior for audio tracks is to use the Opus codec, which typically operates at a 48kHz sample rate and can support stereo. This is a common configuration for WebRTC applications to ensure high-quality audio transmission. If you are publishing an audio track with a 16kHz sample rate and a single channel, the LiveKit server may be transcoding it to 48kHz stereo to maintain consistency with its default settings and to optimize for quality across different network conditions and devices. This behavior is not explicitly documented in the provided data sources, but it aligns with standard practices in WebRTC implementations. If you need to maintain the original audio configuration, you might need to explore options to configure the audio settings explicitly in the JS SDK or handle the audio processing on the server side to prevent automatic transcoding. Would you like more detailed guidance on configuring these settings? Sources: - https://docs.livekit.io/home/egress/track/ - https://livekit-users.slack.com/archives/C07FYCB7FRQ/p1728674567.746139 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.