How to get the camera recording only through egres...
# ask-ai
f
How to get the camera recording only through egress and not other tracks like screen sharing and etc
t
Thanks for reaching out, Ayush. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I'd be happy to help you record only the camera track while excluding other tracks like screen sharing. You can achieve this using the Track Composite Egress method, which lets you specify exactly which video and audio tracks to record by providing their track IDs. Here’s how you can set it up: 1. First, identify the track IDs for the camera video and any associated audio tracks you want to capture. 2. Then, use the
StartTrackCompositeEgress
API to start the recording, making sure to specify only the camera and audio track IDs you want: • Set the
video_track_id
to your camera track’s ID. • Set the
audio_track_id
to the associated audio track’s ID, if you have one. • Be sure not to include any screen share track IDs here. This way, your recording will include just the camera and audio tracks you want, leaving out screen sharing and other tracks. If you’d like, I’m here to guide you through the implementation or answer any questions you have—just let me know! Sources: Recording participants | LiveKit docs | packages/livekit-server-sdk/src/EgressClient.ts | livekit-protocol/livekit/protocol/egress.pyi | src/main/kotlin/io/livekit/server/EgressServiceClient.kt | README.md
f
Is it possible to run dual egress
t
Absolutely, you can run dual egress in LiveKit by specifying multiple output types within a single egress request. Here are some options you can configure: • File: Export to formats like MP4 or OGG. • Stream: Stream to destinations such as RTMP or SRT. • Segments: Export as segmented files, like HLS. • Images: Capture thumbnails. For instance, you could output a room composite egress to both a file and a stream at the same time. Some supported combinations include MP4 file + RTMP stream, HLS segments + JPEG thumbnails, and more. Plus, you have the flexibility to update active stream egresses on the fly by adding or removing output URLs without needing to restart the egress. If you'd like, I’m here to help guide you through setting this up—just let me know! Sources: packages/livekit-server-sdk/src/EgressClient.ts | README.md | lib/livekit/egress_service_client.rb
f
Provide example code snippet setting it up
t
I'd love to help you set up dual egress in LiveKit! Here's an example where you record to an S3 bucket as HLS segments and stream via RTMP:
Copy code
{
  "room_name": "my-room",
  "layout": "grid",
  "preset": "H264_720P_30",
  "segment_outputs": [
    {
      "protocol": "HLS_PROTOCOL",
      "filename_prefix": "path/to/hls-output",
      "playlist_name": "output.m3u8",
      "segment_duration": 10,
      "s3": {
        "access_key": "your-access-key",
        "secret": "your-secret-key",
        "region": "us-east-1",
        "bucket": "my-recordings-bucket"
      }
    }
  ],
  "stream_outputs": [
    {
      "protocol": "RTMP",
      "urls": [
        "rtmp://live.twitch.tv/app/STREAM_KEY",
        "rtmp://a.rtmp.youtube.com/live2/YOUR_STREAM_KEY"
      ]
    }
  ]
}
Explanation: • Segment Outputs: This part sets up your HLS segment output to be saved in an S3 bucket. • Stream Outputs: This enables streaming via RTMP to multiple platforms at once. This configuration will start both outputs together in a single egress session. If you'd like, I’m here to help with more examples or guide you through a specific SDK—just let me know! Sources: Egress examples | LiveKit docs | README.md | Recording and export | LiveKit docs