github.com/livekit/protocol@v1.16.1-0.20240517185851-47e4c6bba773/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 bool video_only = 4; // (default false) 52 string custom_base_url = 5; // template base url (default https://recorder.livekit.io) 53 oneof output { // deprecated (use _output fields) 54 EncodedFileOutput file = 6 [deprecated = true]; 55 StreamOutput stream = 7 [deprecated = true]; 56 SegmentedFileOutput segments = 10 [deprecated = true]; 57 } 58 oneof options { 59 EncodingOptionsPreset preset = 8; // (default H264_720P_30) 60 EncodingOptions advanced = 9; // (optional) 61 } 62 repeated EncodedFileOutput file_outputs = 11; 63 repeated StreamOutput stream_outputs = 12; 64 repeated SegmentedFileOutput segment_outputs = 13; 65 repeated ImageOutput image_outputs = 14; 66 } 67 68 // record any website 69 message WebEgressRequest { 70 string url = 1; 71 bool audio_only = 2; 72 bool video_only = 3; 73 bool await_start_signal = 12; 74 oneof output { // deprecated (use _output fields) 75 EncodedFileOutput file = 4 [deprecated = true]; 76 StreamOutput stream = 5 [deprecated = true]; 77 SegmentedFileOutput segments = 6 [deprecated = true]; 78 } 79 oneof options { 80 EncodingOptionsPreset preset = 7; 81 EncodingOptions advanced = 8; 82 } 83 repeated EncodedFileOutput file_outputs = 9; 84 repeated StreamOutput stream_outputs = 10; 85 repeated SegmentedFileOutput segment_outputs = 11; 86 repeated ImageOutput image_outputs = 13; 87 } 88 89 // record audio and video from a single participant 90 message ParticipantEgressRequest { 91 string room_name = 1; // required 92 string identity = 2; // required 93 bool screen_share = 3; // (default false) 94 oneof options { 95 EncodingOptionsPreset preset = 4; // (default H264_720P_30) 96 EncodingOptions advanced = 5; // (optional) 97 } 98 repeated EncodedFileOutput file_outputs = 6; 99 repeated StreamOutput stream_outputs = 7; 100 repeated SegmentedFileOutput segment_outputs = 8; 101 repeated ImageOutput image_outputs = 9; 102 } 103 104 // containerize up to one audio and one video track 105 message TrackCompositeEgressRequest { 106 string room_name = 1; // required 107 string audio_track_id = 2; // (optional) 108 string video_track_id = 3; // (optional) 109 oneof output { // deprecated (use _output fields) 110 EncodedFileOutput file = 4 [deprecated = true]; 111 StreamOutput stream = 5 [deprecated = true]; 112 SegmentedFileOutput segments = 8 [deprecated = true]; 113 } 114 oneof options { 115 EncodingOptionsPreset preset = 6; // (default H264_720P_30) 116 EncodingOptions advanced = 7; // (optional) 117 } 118 repeated EncodedFileOutput file_outputs = 11; 119 repeated StreamOutput stream_outputs = 12; 120 repeated SegmentedFileOutput segment_outputs = 13; 121 repeated ImageOutput image_outputs = 14; 122 } 123 124 // record tracks individually, without transcoding 125 message TrackEgressRequest { 126 string room_name = 1; // required 127 string track_id = 2; // required 128 oneof output { // required 129 DirectFileOutput file = 3; 130 string websocket_url = 4; 131 } 132 } 133 134 enum EncodedFileType { 135 DEFAULT_FILETYPE = 0; // file type chosen based on codecs 136 MP4 = 1; 137 OGG = 2; 138 } 139 140 message EncodedFileOutput { 141 EncodedFileType file_type = 1; // (optional) 142 string filepath = 2; // see egress docs for templating (default {room_name}-{time}) 143 bool disable_manifest = 6; // disable upload of manifest file (default false) 144 oneof output { 145 S3Upload s3 = 3; 146 GCPUpload gcp = 4; 147 AzureBlobUpload azure = 5; 148 AliOSSUpload aliOSS = 7; 149 } 150 } 151 152 enum SegmentedFileProtocol { 153 DEFAULT_SEGMENTED_FILE_PROTOCOL = 0; 154 HLS_PROTOCOL = 1; 155 } 156 157 enum SegmentedFileSuffix { 158 INDEX = 0; 159 TIMESTAMP = 1; 160 } 161 162 // Used to generate HLS segments or other kind of segmented output 163 message SegmentedFileOutput { 164 SegmentedFileProtocol protocol = 1; // (optional) 165 string filename_prefix = 2; // (optional) 166 string playlist_name = 3; // (optional) 167 string live_playlist_name = 11; // (optional, disabled if not provided). Path of a live playlist 168 uint32 segment_duration = 4; // in seconds (optional) 169 SegmentedFileSuffix filename_suffix = 10; // (optional, default INDEX) 170 bool disable_manifest = 8; // disable upload of manifest file (default false) 171 oneof output { // required 172 S3Upload s3 = 5; 173 GCPUpload gcp = 6; 174 AzureBlobUpload azure = 7; 175 AliOSSUpload aliOSS = 9; 176 } 177 } 178 179 message DirectFileOutput { 180 string filepath = 1; // see egress docs for templating (default {track_id}-{time}) 181 bool disable_manifest = 5; // disable upload of manifest file (default false) 182 oneof output { 183 S3Upload s3 = 2; 184 GCPUpload gcp = 3; 185 AzureBlobUpload azure = 4; 186 AliOSSUpload aliOSS = 6; 187 } 188 } 189 190 enum ImageFileSuffix { 191 IMAGE_SUFFIX_INDEX = 0; 192 IMAGE_SUFFIX_TIMESTAMP = 1; 193 } 194 195 message ImageOutput { 196 uint32 capture_interval = 1; // in seconds (required) 197 int32 width = 2; // (optional, defaults to track width) 198 int32 height = 3; // (optional, defaults to track height) 199 string filename_prefix = 4; // (optional) 200 ImageFileSuffix filename_suffix = 5; // (optional, default INDEX) 201 ImageCodec image_codec = 6; // (optional) 202 bool disable_manifest = 7; // disable upload of manifest file (default false) 203 oneof output { // required 204 S3Upload s3 = 8; 205 GCPUpload gcp = 9; 206 AzureBlobUpload azure = 10; 207 AliOSSUpload aliOSS = 11; 208 } 209 } 210 211 message S3Upload { 212 string access_key = 1; 213 string secret = 2; 214 string region = 3; 215 string endpoint = 4; 216 string bucket = 5; 217 bool force_path_style = 6; 218 map<string, string> metadata = 7; 219 string tagging = 8; 220 string content_disposition = 9; // Content-Disposition header 221 ProxyConfig proxy = 10; 222 } 223 224 message GCPUpload { 225 // service account credentials serialized in JSON "credentials.json" 226 string credentials = 1; 227 string bucket = 2; 228 ProxyConfig proxy = 3; 229 } 230 231 message AzureBlobUpload { 232 string account_name = 1; 233 string account_key = 2; 234 string container_name = 3; 235 } 236 237 message AliOSSUpload { 238 string access_key = 1; 239 string secret = 2; 240 string region = 3; 241 string endpoint = 4; 242 string bucket = 5; 243 } 244 245 message ProxyConfig { 246 string url = 1; 247 string username = 2; 248 string password = 3; 249 } 250 251 enum StreamProtocol { 252 DEFAULT_PROTOCOL = 0; // protocol chosen based on urls 253 RTMP = 1; 254 } 255 256 message StreamOutput { 257 StreamProtocol protocol = 1; // required 258 repeated string urls = 2; // required 259 } 260 261 message EncodingOptions { 262 int32 width = 1; // (default 1920) 263 int32 height = 2; // (default 1080) 264 int32 depth = 3; // (default 24) 265 int32 framerate = 4; // (default 30) 266 AudioCodec audio_codec = 5; // (default OPUS) 267 int32 audio_bitrate = 6; // (default 128) 268 int32 audio_quality = 11; // quality setting on audio encoder 269 int32 audio_frequency = 7; // (default 44100) 270 VideoCodec video_codec = 8; // (default H264_MAIN) 271 int32 video_bitrate = 9; // (default 4500) 272 int32 video_quality = 12; // quality setting on video encoder 273 double key_frame_interval = 10; // in seconds (default 4s for streaming, segment duration for segmented output, encoder default for files) 274 } 275 276 enum EncodingOptionsPreset { 277 H264_720P_30 = 0; // 1280x720, 30fps, 3000kpbs, H.264_MAIN / OPUS 278 H264_720P_60 = 1; // 1280x720, 60fps, 4500kbps, H.264_MAIN / OPUS 279 H264_1080P_30 = 2; // 1920x1080, 30fps, 4500kbps, H.264_MAIN / OPUS 280 H264_1080P_60 = 3; // 1920x1080, 60fps, 6000kbps, H.264_MAIN / OPUS 281 PORTRAIT_H264_720P_30 = 4; // 720x1280, 30fps, 3000kpbs, H.264_MAIN / OPUS 282 PORTRAIT_H264_720P_60 = 5; // 720x1280, 60fps, 4500kbps, H.264_MAIN / OPUS 283 PORTRAIT_H264_1080P_30 = 6; // 1080x1920, 30fps, 4500kbps, H.264_MAIN / OPUS 284 PORTRAIT_H264_1080P_60 = 7; // 1080x1920, 60fps, 6000kbps, H.264_MAIN / OPUS 285 } 286 287 message UpdateLayoutRequest { 288 string egress_id = 1; 289 string layout = 2; 290 } 291 292 message UpdateStreamRequest { 293 string egress_id = 1; 294 repeated string add_output_urls = 2; 295 repeated string remove_output_urls = 3; 296 } 297 298 message ListEgressRequest { 299 string room_name = 1; // (optional, filter by room name) 300 string egress_id = 2; // (optional, filter by egress ID) 301 bool active = 3; // (optional, list active egress only) 302 } 303 304 message ListEgressResponse { 305 repeated EgressInfo items = 1; 306 } 307 308 message StopEgressRequest { 309 string egress_id = 1; 310 } 311 312 enum EgressStatus { 313 EGRESS_STARTING = 0; 314 EGRESS_ACTIVE = 1; 315 EGRESS_ENDING = 2; 316 EGRESS_COMPLETE = 3; 317 EGRESS_FAILED = 4; 318 EGRESS_ABORTED = 5; 319 EGRESS_LIMIT_REACHED = 6; 320 } 321 322 message EgressInfo { 323 string egress_id = 1; 324 string room_id = 2; 325 string room_name = 13; 326 EgressStatus status = 3; 327 int64 started_at = 10; 328 int64 ended_at = 11; 329 int64 updated_at = 18; 330 string details = 21; 331 string error = 9; 332 int32 error_code = 22; 333 oneof request { 334 RoomCompositeEgressRequest room_composite = 4; 335 WebEgressRequest web = 14; 336 ParticipantEgressRequest participant = 19; 337 TrackCompositeEgressRequest track_composite = 5; 338 TrackEgressRequest track = 6; 339 } 340 oneof result { // deprecated (use _result fields) 341 StreamInfoList stream = 7 [deprecated = true]; 342 FileInfo file = 8 [deprecated = true]; 343 SegmentsInfo segments = 12 [deprecated = true]; 344 } 345 repeated StreamInfo stream_results = 15; 346 repeated FileInfo file_results = 16; 347 repeated SegmentsInfo segment_results = 17; 348 repeated ImagesInfo image_results = 20; 349 350 // next ID: 23 351 } 352 353 message StreamInfoList { 354 option deprecated = true; 355 repeated StreamInfo info = 1; 356 } 357 358 message StreamInfo { 359 enum Status { 360 ACTIVE = 0; 361 FINISHED = 1; 362 FAILED = 2; 363 } 364 365 string url = 1; 366 int64 started_at = 2; 367 int64 ended_at = 3; 368 int64 duration = 4; 369 Status status = 5; 370 string error = 6; 371 } 372 373 message FileInfo { 374 string filename = 1; 375 int64 started_at = 2; 376 int64 ended_at = 3; 377 int64 duration = 6; 378 int64 size = 4; 379 string location = 5; 380 } 381 382 message SegmentsInfo { 383 string playlist_name = 1; 384 string live_playlist_name = 8; 385 int64 duration = 2; 386 int64 size = 3; 387 string playlist_location = 4; 388 string live_playlist_location = 9; 389 int64 segment_count = 5; 390 int64 started_at = 6; 391 int64 ended_at = 7; 392 } 393 394 message ImagesInfo { 395 int64 image_count = 1; 396 int64 started_at = 2; 397 int64 ended_at = 3; 398 } 399 400 message AutoParticipantEgress { 401 oneof options { 402 EncodingOptionsPreset preset = 1; // (default H264_720P_30) 403 EncodingOptions advanced = 2; // (optional) 404 } 405 repeated EncodedFileOutput file_outputs = 3; 406 repeated SegmentedFileOutput segment_outputs = 4; 407 } 408 409 message AutoTrackEgress { 410 string filepath = 1; // see docs for templating (default {track_id}-{time}) 411 bool disable_manifest = 5; // disables upload of json manifest file (default false) 412 oneof output { 413 S3Upload s3 = 2; 414 GCPUpload gcp = 3; 415 AzureBlobUpload azure = 4; 416 AliOSSUpload aliOSS = 6; 417 } 418 }