how can I select codec in livekit cloud which is a...
# ask-ai
r
how can I select codec in livekit cloud which is allowed or not
t
Thanks for reaching out, Rahul. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I'm happy to help you with selecting allowed or disallowed codecs in LiveKit Cloud! You have a few ways to manage codec settings, and I'll walk you through them: • Client-Side Configuration: You can use the SDKs to specify which codecs you'd like to use when publishing tracks. For instance, with the JavaScript SDK, you can set your preferences like this:
Copy code
room.localParticipant.setPublishDefaults({
  videoCodec: 'vp8', // or 'h264', 'vp9', 'av1', 'h265'
});
• Server-Side Rules: LiveKit also takes care of disabling certain codecs automatically for specific devices or browsers—for example, AV1 is disabled when using Safari. • Backup Codec Handling: To ensure compatibility, you can set up backup codecs with options like these:
Copy code
room.localParticipant.setPublishDefaults({
  videoCodec: 'vp9',
  backupCodec: { codec: 'vp8', encoding: { maxBitrate: 1000000 } },
  backupCodecPolicy: BackupCodecPolicy.PREFER_REGRESSION
});
• Ingress and Transcoding: If you're importing streams, LiveKit Ingress supports transcoding with presets you can configure to fit your needs. Please feel free to reach out if you'd like more details or need help with a specific SDK or setup—I'm here to support you! Sources: pkg/clientconfiguration/conf.go | src/room/track/options.ts | lib/src/options.dart | WebRTC Codecs Guide - LiveKit | Codecs and more | LiveKit Docs
r
I want to disable some audio codec in livekit cloud how can I do that any API for that?
t
Thank you for reaching out! I want to help clarify how you can manage audio codecs in LiveKit Cloud. Currently, disabling specific audio codecs directly through a public API isn’t supported, but here are some options that might work for you: • Server-Side Configuration: You can disable codecs using server-side rules with the
DisabledCodecs
field in
ClientConfiguration
. This is commonly used for video codecs, and while it’s not guaranteed for audio codecs like OPUS or AAC, it’s worth exploring. • Client-Side Control: You have the ability to influence codec preferences when publishing tracks, although enforcing codec restrictions across all participants isn’t possible. • Audio RED: Disabling redundant encoding (RED) for audio tracks can help save bandwidth, but please note this doesn’t block specific codecs. If you have a particular scenario or need more detailed guidance, please don’t hesitate to share! I’m here to help you find the best solution or connect you with additional support if needed. Sources: Codecs and more | LiveKit Docs | Sources/LiveKit/Protos/livekit_models.pb.swift | lib/src/options.dart | pkg/rtc/dynacast/dynacastqualityaudio.go | livekit/livekit_models.pb.go
r
what is this AUDIO RED?
t
Hi there! I’d love to help you understand Audio RED (Redundant Encoding) in LiveKit. It’s a neat technique designed to boost audio quality, especially on networks where some data might get lost. Basically, it sends multiple copies of the same audio data in different packets. So, if a few packets don’t make it through, the receiver can still piece together the original audio, which helps reduce those annoying glitches. That said, this does use a bit more bandwidth. If you’re worried about bandwidth, you can easily turn off Audio RED when publishing audio tracks by setting the
disableRed
parameter to
true
in your publishing options. If you’d like, I’m here to guide you through the setup or answer any other questions you might have. Just let me know! Sources: Codecs and more | LiveKit Docs | lib/src/proto/livekit_rtc.pb.dart | pkg/sfu/redprimaryreceiver.go