how do I egress an audio track to an rtmp url?
# ask-ai
b
how do I egress an audio track to an rtmp url?
✅ 1
t
Thanks for reaching out, Jacob. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I’ll help with that. You're asking how to egress an audio track to an RTMP URL. LiveKit does not support sending a single raw Track Egress directly to RTMP. Use the Track Composite Egress (or Room Composite) and set the output to an RTMP stream. This lets LiveKit transcode and push the audio to the RTMP destination. Quick steps 1. Get the
AudioTrackId
for the track you want to egress (from Server API or webhooks). 2. Call the Egress service with a
TrackCompositeEgressRequest
, providing
RoomName
,
AudioTrackId
, and an
Output
set to a
StreamOutput
with
Protocol: RTMP
and the RTMP URL(s). 3. Start the egress; LiveKit will encode and stream the audio to the RTMP endpoint. Example (Go):
Copy code
info, err := egressClient.StartTrackCompositeEgress(ctx, &livekit.TrackCompositeEgressRequest{
	RoomName:     "my-room",
	AudioTrackId: "audio-track-id",
	Output: &livekit.TrackCompositeEgressRequest_Stream{
		Stream: &livekit.StreamOutput{
			Protocol: livekit.StreamProtocol_RTMP,
			Urls:     []string{"rtmp://live.twitch.tv/app/<stream-key>"},
		},
	},
})
Notes • RTMP output is available only for Track Composite or Room Composite egress—not single Track Egress file exports. • For audio-only streaming, omit
VideoTrackId
. Depending on transcoding, a black/placeholder video stream may be generated for RTMP sinks that require video. If you want, tell me: • Which server SDK you’re using (Go, Node.js, etc.), • The RTMP provider (Twitch, YouTube, custom), and • Whether you need audio-only or audio+placeholder video— and I’ll give the exact request/code sample for your setup. Sources: Universal Egress | LiveKit | server-sdk-js | livekit/livekit_composite | DeepWiki, with interactive elements