github.com/livekit/protocol@v1.39.3/protobufs/livekit_egress.proto (about) 1 // Copyright 2023 LiveKit, Inc. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 syntax = "proto3"; 16 17 package livekit; 18 19 import "livekit_models.proto"; 20 21 option go_package = "github.com/livekit/protocol/livekit"; 22 option csharp_namespace = "LiveKit.Proto"; 23 option ruby_package = "LiveKit::Proto"; 24 25 service Egress { 26 // start recording or streaming a room, participant, or tracks 27 rpc StartRoomCompositeEgress(RoomCompositeEgressRequest) returns (EgressInfo); 28 rpc StartWebEgress(WebEgressRequest) returns (EgressInfo); 29 rpc StartParticipantEgress(ParticipantEgressRequest) returns (EgressInfo); 30 rpc StartTrackCompositeEgress(TrackCompositeEgressRequest) returns (EgressInfo); 31 rpc StartTrackEgress(TrackEgressRequest) returns (EgressInfo); 32 33 // update web composite layout 34 rpc UpdateLayout(UpdateLayoutRequest) returns (EgressInfo); 35 36 // add or remove stream endpoints 37 rpc UpdateStream(UpdateStreamRequest) returns (EgressInfo); 38 39 // list available egress 40 rpc ListEgress(ListEgressRequest) returns (ListEgressResponse); 41 42 // stop a recording or stream 43 rpc StopEgress(StopEgressRequest) returns (EgressInfo); 44 } 45 46 // composite using a web browser 47 message RoomCompositeEgressRequest { 48 string room_name = 1; // required 49 string layout = 2; // (optional) 50 bool audio_only = 3; // (default false) 51 AudioMixing audio_mixing = 15; // only applies to audio_only egress (default DEFAULT_MIXING) 52 bool video_only = 4; // (default false) 53 string custom_base_url = 5; // template base url (default https://recorder.livekit.io) 54 oneof output { // deprecated (use _output fields) 55 EncodedFileOutput file = 6 [deprecated = true]; 56 StreamOutput stream = 7 [deprecated = true]; 57 SegmentedFileOutput segments = 10 [deprecated = true]; 58 } 59 oneof options { 60 EncodingOptionsPreset preset = 8; // (default H264_720P_30) 61 EncodingOptions advanced = 9; // (optional) 62 } 63 repeated EncodedFileOutput file_outputs = 11; 64 repeated StreamOutput stream_outputs = 12; 65 repeated SegmentedFileOutput segment_outputs = 13; 66 repeated ImageOutput image_outputs = 14; 67 68 repeated WebhookConfig webhooks = 16; // extra webhooks to call for this request 69 70 // NEXT_ID: 17 71 } 72 73 // record any website 74 message WebEgressRequest { 75 string url = 1; 76 bool audio_only = 2; 77 bool video_only = 3; 78 bool await_start_signal = 12; 79 oneof output { // deprecated (use _output fields) 80 EncodedFileOutput file = 4 [deprecated = true]; 81 StreamOutput stream = 5 [deprecated = true]; 82 SegmentedFileOutput segments = 6 [deprecated = true]; 83 } 84 oneof options { 85 EncodingOptionsPreset preset = 7; 86 EncodingOptions advanced = 8; 87 } 88 repeated EncodedFileOutput file_outputs = 9; 89 repeated StreamOutput stream_outputs = 10; 90 repeated SegmentedFileOutput segment_outputs = 11; 91 repeated ImageOutput image_outputs = 13; 92 93 repeated WebhookConfig webhooks = 14; // extra webhooks to call for this request 94 95 // NEXT_ID: 15 96 97 } 98 99 // record audio and video from a single participant 100 message ParticipantEgressRequest { 101 string room_name = 1; // required 102 string identity = 2; // required 103 bool screen_share = 3; // (default false) 104 oneof options { 105 EncodingOptionsPreset preset = 4; // (default H264_720P_30) 106 EncodingOptions advanced = 5; // (optional) 107 } 108 repeated EncodedFileOutput file_outputs = 6; 109 repeated StreamOutput stream_outputs = 7; 110 repeated SegmentedFileOutput segment_outputs = 8; 111 repeated ImageOutput image_outputs = 9; 112 113 repeated WebhookConfig webhooks = 10; // extra webhooks to call for this request 114 115 // NEXT_ID: 11 116 } 117 118 // containerize up to one audio and one video track 119 message TrackCompositeEgressRequest { 120 string room_name = 1; // required 121 string audio_track_id = 2; // (optional) 122 string video_track_id = 3; // (optional) 123 oneof output { // deprecated (use _output fields) 124 EncodedFileOutput file = 4 [deprecated = true]; 125 StreamOutput stream = 5 [deprecated = true]; 126 SegmentedFileOutput segments = 8 [deprecated = true]; 127 } 128 oneof options { 129 EncodingOptionsPreset preset = 6; // (default H264_720P_30) 130 EncodingOptions advanced = 7; // (optional) 131 } 132 repeated EncodedFileOutput file_outputs = 11; 133 repeated StreamOutput stream_outputs = 12; 134 repeated SegmentedFileOutput segment_outputs = 13; 135 repeated ImageOutput image_outputs = 14; 136 137 repeated WebhookConfig webhooks = 15; // extra webhooks to call for this request 138 139 // NEXT_ID: 16 140 } 141 142 // record tracks individually, without transcoding 143 message TrackEgressRequest { 144 string room_name = 1; // required 145 string track_id = 2; // required 146 oneof output { // required 147 DirectFileOutput file = 3; 148 string websocket_url = 4; 149 } 150 151 repeated WebhookConfig webhooks = 5; // extra webhooks to call for this request 152 153 // NEXT_ID: 6 154 } 155 156 enum EncodedFileType { 157 DEFAULT_FILETYPE = 0; // file type chosen based on codecs 158 MP4 = 1; 159 OGG = 2; 160 } 161 162 message EncodedFileOutput { 163 EncodedFileType file_type = 1; // (optional) 164 string filepath = 2; // see egress docs for templating (default {room_name}-{time}) 165 bool disable_manifest = 6; // disable upload of manifest file (default false) 166 oneof output { 167 S3Upload s3 = 3; 168 GCPUpload gcp = 4; 169 AzureBlobUpload azure = 5; 170 AliOSSUpload aliOSS = 7; 171 } 172 } 173 174 enum SegmentedFileProtocol { 175 DEFAULT_SEGMENTED_FILE_PROTOCOL = 0; 176 HLS_PROTOCOL = 1; 177 } 178 179 enum SegmentedFileSuffix { 180 INDEX = 0; 181 TIMESTAMP = 1; 182 } 183 184 // Used to generate HLS segments or other kind of segmented output 185 message SegmentedFileOutput { 186 SegmentedFileProtocol protocol = 1; // (optional) 187 string filename_prefix = 2; // (optional) 188 string playlist_name = 3; // (optional) 189 string live_playlist_name = 11; // (optional, disabled if not provided). Path of a live playlist 190 uint32 segment_duration = 4; // in seconds (optional) 191 SegmentedFileSuffix filename_suffix = 10; // (optional, default INDEX) 192 bool disable_manifest = 8; // disable upload of manifest file (default false) 193 oneof output { // required 194 S3Upload s3 = 5; 195 GCPUpload gcp = 6; 196 AzureBlobUpload azure = 7; 197 AliOSSUpload aliOSS = 9; 198 } 199 } 200 201 message DirectFileOutput { 202 string filepath = 1; // see egress docs for templating (default {track_id}-{time}) 203 bool disable_manifest = 5; // disable upload of manifest file (default false) 204 oneof output { 205 S3Upload s3 = 2; 206 GCPUpload gcp = 3; 207 AzureBlobUpload azure = 4; 208 AliOSSUpload aliOSS = 6; 209 } 210 } 211 212 enum ImageFileSuffix { 213 IMAGE_SUFFIX_INDEX = 0; 214 IMAGE_SUFFIX_TIMESTAMP = 1; 215 IMAGE_SUFFIX_NONE_OVERWRITE = 2; // Do not append any suffix and overwrite the existing image with the latest 216 } 217 218 message ImageOutput { 219 uint32 capture_interval = 1; // in seconds (required) 220 int32 width = 2; // (optional, defaults to track width) 221 int32 height = 3; // (optional, defaults to track height) 222 string filename_prefix = 4; // (optional) 223 ImageFileSuffix filename_suffix = 5; // (optional, default INDEX) 224 ImageCodec image_codec = 6; // (optional) 225 bool disable_manifest = 7; // disable upload of manifest file (default false) 226 oneof output { // required 227 S3Upload s3 = 8; 228 GCPUpload gcp = 9; 229 AzureBlobUpload azure = 10; 230 AliOSSUpload aliOSS = 11; 231 } 232 } 233 234 message S3Upload { 235 string access_key = 1; 236 string secret = 2; 237 string session_token = 11; 238 string region = 3; 239 string endpoint = 4; 240 string bucket = 5; 241 bool force_path_style = 6; 242 map<string, string> metadata = 7; 243 string tagging = 8; 244 string content_disposition = 9; // Content-Disposition header 245 ProxyConfig proxy = 10; 246 } 247 248 message GCPUpload { 249 // service account credentials serialized in JSON "credentials.json" 250 string credentials = 1; 251 string bucket = 2; 252 ProxyConfig proxy = 3; 253 } 254 255 message AzureBlobUpload { 256 string account_name = 1; 257 string account_key = 2; 258 string container_name = 3; 259 } 260 261 message AliOSSUpload { 262 string access_key = 1; 263 string secret = 2; 264 string region = 3; 265 string endpoint = 4; 266 string bucket = 5; 267 } 268 269 message ProxyConfig { 270 string url = 1; 271 string username = 2; 272 string password = 3; 273 } 274 275 enum StreamProtocol { 276 DEFAULT_PROTOCOL = 0; // protocol chosen based on urls 277 RTMP = 1; 278 SRT = 2; 279 } 280 281 message StreamOutput { 282 StreamProtocol protocol = 1; // required 283 repeated string urls = 2; // required 284 } 285 286 enum AudioMixing { 287 DEFAULT_MIXING = 0; // all users are mixed together 288 DUAL_CHANNEL_AGENT = 1; // agent audio in the left channel, all other audio in the right channel 289 DUAL_CHANNEL_ALTERNATE = 2; // each new audio track alternates between left and right channels 290 } 291 292 message EncodingOptions { 293 int32 width = 1; // (default 1920) 294 int32 height = 2; // (default 1080) 295 int32 depth = 3; // (default 24) 296 int32 framerate = 4; // (default 30) 297 AudioCodec audio_codec = 5; // (default OPUS) 298 int32 audio_bitrate = 6; // (default 128) 299 int32 audio_quality = 11; // quality setting on audio encoder 300 int32 audio_frequency = 7; // (default 44100) 301 VideoCodec video_codec = 8; // (default H264_MAIN) 302 int32 video_bitrate = 9; // (default 4500) 303 int32 video_quality = 12; // quality setting on video encoder 304 double key_frame_interval = 10; // in seconds (default 4s for streaming, segment duration for segmented output, encoder default for files) 305 } 306 307 enum EncodingOptionsPreset { 308 H264_720P_30 = 0; // 1280x720, 30fps, 3000kpbs, H.264_MAIN / OPUS 309 H264_720P_60 = 1; // 1280x720, 60fps, 4500kbps, H.264_MAIN / OPUS 310 H264_1080P_30 = 2; // 1920x1080, 30fps, 4500kbps, H.264_MAIN / OPUS 311 H264_1080P_60 = 3; // 1920x1080, 60fps, 6000kbps, H.264_MAIN / OPUS 312 PORTRAIT_H264_720P_30 = 4; // 720x1280, 30fps, 3000kpbs, H.264_MAIN / OPUS 313 PORTRAIT_H264_720P_60 = 5; // 720x1280, 60fps, 4500kbps, H.264_MAIN / OPUS 314 PORTRAIT_H264_1080P_30 = 6; // 1080x1920, 30fps, 4500kbps, H.264_MAIN / OPUS 315 PORTRAIT_H264_1080P_60 = 7; // 1080x1920, 60fps, 6000kbps, H.264_MAIN / OPUS 316 } 317 318 message UpdateLayoutRequest { 319 string egress_id = 1; 320 string layout = 2; 321 } 322 323 message UpdateStreamRequest { 324 string egress_id = 1; 325 repeated string add_output_urls = 2; 326 repeated string remove_output_urls = 3; 327 } 328 329 message ListEgressRequest { 330 string room_name = 1; // (optional, filter by room name) 331 string egress_id = 2; // (optional, filter by egress ID) 332 bool active = 3; // (optional, list active egress only) 333 } 334 335 message ListEgressResponse { 336 repeated EgressInfo items = 1; 337 } 338 339 message StopEgressRequest { 340 string egress_id = 1; 341 } 342 343 enum EgressStatus { 344 EGRESS_STARTING = 0; 345 EGRESS_ACTIVE = 1; 346 EGRESS_ENDING = 2; 347 EGRESS_COMPLETE = 3; 348 EGRESS_FAILED = 4; 349 EGRESS_ABORTED = 5; 350 EGRESS_LIMIT_REACHED = 6; 351 } 352 353 enum EgressSourceType { 354 EGRESS_SOURCE_TYPE_WEB = 0; 355 EGRESS_SOURCE_TYPE_SDK = 1; 356 } 357 358 message EgressInfo { 359 string egress_id = 1; 360 string room_id = 2; 361 string room_name = 13; 362 EgressSourceType source_type = 26; 363 EgressStatus status = 3; 364 int64 started_at = 10; 365 int64 ended_at = 11; 366 int64 updated_at = 18; 367 string details = 21; 368 string error = 9; 369 int32 error_code = 22; 370 oneof request { 371 RoomCompositeEgressRequest room_composite = 4; 372 WebEgressRequest web = 14; 373 ParticipantEgressRequest participant = 19; 374 TrackCompositeEgressRequest track_composite = 5; 375 TrackEgressRequest track = 6; 376 } 377 oneof result { // deprecated (use _result fields) 378 StreamInfoList stream = 7 [deprecated = true]; 379 FileInfo file = 8 [deprecated = true]; 380 SegmentsInfo segments = 12 [deprecated = true]; 381 } 382 repeated StreamInfo stream_results = 15; 383 repeated FileInfo file_results = 16; 384 repeated SegmentsInfo segment_results = 17; 385 repeated ImagesInfo image_results = 20; 386 string manifest_location = 23; 387 bool backup_storage_used = 25; 388 // next ID: 27 389 } 390 391 message StreamInfoList { 392 option deprecated = true; 393 repeated StreamInfo info = 1; 394 } 395 396 message StreamInfo { 397 enum Status { 398 ACTIVE = 0; 399 FINISHED = 1; 400 FAILED = 2; 401 } 402 403 string url = 1; 404 int64 started_at = 2; 405 int64 ended_at = 3; 406 int64 duration = 4; 407 Status status = 5; 408 string error = 6; 409 } 410 411 message FileInfo { 412 string filename = 1; 413 int64 started_at = 2; 414 int64 ended_at = 3; 415 int64 duration = 6; 416 int64 size = 4; 417 string location = 5; 418 } 419 420 message SegmentsInfo { 421 string playlist_name = 1; 422 string live_playlist_name = 8; 423 int64 duration = 2; 424 int64 size = 3; 425 string playlist_location = 4; 426 string live_playlist_location = 9; 427 int64 segment_count = 5; 428 int64 started_at = 6; 429 int64 ended_at = 7; 430 } 431 432 message ImagesInfo { 433 string filename_prefix = 4; 434 int64 image_count = 1; 435 int64 started_at = 2; 436 int64 ended_at = 3; 437 } 438 439 message AutoParticipantEgress { 440 oneof options { 441 EncodingOptionsPreset preset = 1; // (default H264_720P_30) 442 EncodingOptions advanced = 2; // (optional) 443 } 444 repeated EncodedFileOutput file_outputs = 3; 445 repeated SegmentedFileOutput segment_outputs = 4; 446 } 447 448 message AutoTrackEgress { 449 string filepath = 1; // see docs for templating (default {track_id}-{time}) 450 bool disable_manifest = 5; // disables upload of json manifest file (default false) 451 oneof output { 452 S3Upload s3 = 2; 453 GCPUpload gcp = 3; 454 AzureBlobUpload azure = 4; 455 AliOSSUpload aliOSS = 6; 456 } 457 }