github.com/whoyao/protocol@v0.0.0-20230519045905-2d8ace718ca5/livekit_egress.proto (about)

     1  syntax = "proto3";
     2  
     3  package livekit;
     4  
     5  import "livekit_models.proto";
     6  
     7  option go_package = "github.com/livekit/protocol/livekit";
     8  option csharp_namespace = "LiveKit.Proto";
     9  option ruby_package = "LiveKit::Proto";
    10  
    11  service Egress {
    12    // start recording or streaming a room, participant, or tracks
    13    rpc StartRoomCompositeEgress(RoomCompositeEgressRequest) returns (EgressInfo);
    14    rpc StartTrackCompositeEgress(TrackCompositeEgressRequest) returns (EgressInfo);
    15    rpc StartTrackEgress(TrackEgressRequest) returns (EgressInfo);
    16    rpc StartWebEgress(WebEgressRequest) returns (EgressInfo);
    17  
    18    // update web composite layout
    19    rpc UpdateLayout(UpdateLayoutRequest) returns (EgressInfo);
    20  
    21    // add or remove stream endpoints
    22    rpc UpdateStream(UpdateStreamRequest) returns (EgressInfo);
    23  
    24    // list available egress
    25    rpc ListEgress(ListEgressRequest) returns (ListEgressResponse);
    26  
    27    // stop a recording or stream
    28    rpc StopEgress(StopEgressRequest) returns (EgressInfo);
    29  }
    30  
    31  // composite using a web browser
    32  message RoomCompositeEgressRequest {
    33    string room_name = 1;         // required
    34    string layout = 2;            // (optional)
    35    bool audio_only = 3;          // (default false)
    36    bool video_only = 4;          // (default false)
    37    string custom_base_url = 5;   // template base url (default https://recorder.livekit.io)
    38    oneof output {                // deprecated (use _output fields)
    39      EncodedFileOutput file = 6 [deprecated = true];
    40      StreamOutput stream = 7 [deprecated = true];
    41      SegmentedFileOutput segments = 10 [deprecated = true];
    42    }
    43    oneof options {
    44      EncodingOptionsPreset preset = 8; // (default H264_720P_30)
    45      EncodingOptions advanced = 9;     // (optional)
    46    }
    47    repeated EncodedFileOutput file_outputs = 11;
    48    repeated StreamOutput stream_outputs = 12;
    49    repeated SegmentedFileOutput segment_outputs = 13;
    50  }
    51  
    52  // record any website
    53  message WebEgressRequest {
    54    string url = 1;
    55    bool audio_only = 2;
    56    bool video_only = 3;
    57    oneof output { // deprecated (use _output fields)
    58      EncodedFileOutput file = 4 [deprecated = true];
    59      StreamOutput stream = 5 [deprecated = true];
    60      SegmentedFileOutput segments = 6 [deprecated = true];
    61    }
    62    oneof options {
    63      EncodingOptionsPreset preset = 7;
    64      EncodingOptions advanced = 8;
    65    }
    66    repeated EncodedFileOutput file_outputs = 9;
    67    repeated StreamOutput stream_outputs = 10;
    68    repeated SegmentedFileOutput segment_outputs = 11;
    69  }
    70  
    71  // containerize up to one audio and one video track
    72  message TrackCompositeEgressRequest {
    73    string room_name = 1;      // required
    74    string audio_track_id = 2; // (optional)
    75    string video_track_id = 3; // (optional)
    76    oneof output {             // deprecated (use _output fields)
    77      EncodedFileOutput file = 4 [deprecated = true];
    78      StreamOutput stream = 5 [deprecated = true];
    79      SegmentedFileOutput segments = 8 [deprecated = true];
    80    }
    81    oneof options {
    82      EncodingOptionsPreset preset = 6; // (default H264_720P_30)
    83      EncodingOptions advanced = 7;     // (optional)
    84    }
    85    repeated EncodedFileOutput file_outputs = 11;
    86    repeated StreamOutput stream_outputs = 12;
    87    repeated SegmentedFileOutput segment_outputs = 13;
    88  }
    89  
    90  // record tracks individually, without transcoding
    91  message TrackEgressRequest {
    92    string room_name = 1;      // required
    93    string track_id = 2;       // required
    94    oneof output {             // required
    95      DirectFileOutput file = 3;
    96      string websocket_url = 4;
    97    }
    98  }
    99  
   100  enum EncodedFileType {
   101    DEFAULT_FILETYPE = 0; // file type chosen based on codecs
   102    MP4  = 1;
   103    OGG = 2;
   104  }
   105  
   106  message EncodedFileOutput {
   107    EncodedFileType file_type = 1; // (optional)
   108    string filepath = 2;           // see egress docs for templating (default {room_name}-{time})
   109    bool disable_manifest = 6;     // disable upload of manifest file (default false)
   110    oneof output {
   111      S3Upload s3 = 3;
   112      GCPUpload gcp = 4;
   113      AzureBlobUpload azure = 5;
   114      AliOSSUpload aliOSS = 7;
   115    }
   116  }
   117  
   118  enum SegmentedFileProtocol {
   119    DEFAULT_SEGMENTED_FILE_PROTOCOL = 0;
   120    HLS_PROTOCOL = 1;
   121  }
   122  
   123  enum SegmentedFileSuffix {
   124    INDEX = 0;
   125    TIMESTAMP = 1;
   126  }
   127  
   128  // Used to generate HLS segments or other kind of segmented output
   129  message SegmentedFileOutput {
   130    SegmentedFileProtocol protocol = 1;       // (optional)
   131    string filename_prefix = 2;               // (optional)
   132    string playlist_name = 3;                 // (optional)
   133    uint32 segment_duration = 4;              // in seconds (optional)
   134    SegmentedFileSuffix filename_suffix = 10; // (optional, default INDEX)
   135    bool disable_manifest = 8;                // disable upload of manifest file (default false)
   136    oneof output {                            // required
   137      S3Upload s3 = 5;
   138      GCPUpload gcp = 6;
   139      AzureBlobUpload azure = 7;
   140      AliOSSUpload aliOSS = 9;
   141    }
   142  }
   143  
   144  message DirectFileOutput {
   145    string filepath = 1;       // see egress docs for templating (default {track_id}-{time})
   146    bool disable_manifest = 5; // disable upload of manifest file (default false)
   147    oneof output {
   148      S3Upload s3 = 2;
   149      GCPUpload gcp = 3;
   150      AzureBlobUpload azure = 4;
   151      AliOSSUpload aliOSS = 6;
   152    }
   153  }
   154  
   155  message S3Upload {
   156    string access_key = 1;
   157    string secret = 2;
   158    string region = 3;
   159    string endpoint = 4;
   160    string bucket = 5;
   161    bool force_path_style = 6;
   162    map<string, string> metadata = 7;
   163    string tagging = 8;
   164  }
   165  
   166  message GCPUpload {
   167    string credentials = 1;
   168    string bucket = 2;
   169  }
   170  
   171  message AzureBlobUpload {
   172    string account_name = 1;
   173    string account_key = 2;
   174    string container_name = 3;
   175  }
   176  
   177  message AliOSSUpload {
   178    string access_key = 1;
   179    string secret = 2;
   180    string region = 3;
   181    string endpoint = 4;
   182    string bucket = 5;
   183  }
   184  
   185  enum StreamProtocol {
   186    DEFAULT_PROTOCOL = 0; // protocol chosen based on urls
   187    RTMP = 1;
   188  }
   189  
   190  message StreamOutput {
   191    StreamProtocol protocol = 1; // required
   192    repeated string urls = 2;    // required
   193  }
   194  
   195  message EncodingOptions {
   196    int32 width = 1;                // (default 1920)
   197    int32 height = 2;               // (default 1080)
   198    int32 depth = 3;                // (default 24)
   199    int32 framerate = 4;            // (default 30)
   200    AudioCodec audio_codec = 5;     // (default OPUS)
   201    int32 audio_bitrate = 6;        // (default 128)
   202    int32 audio_frequency = 7;      // (default 44100)
   203    VideoCodec video_codec = 8;     // (default H264_MAIN)
   204    int32 video_bitrate = 9;        // (default 4500)
   205    double key_frame_interval = 10; // in seconds (default 4s for streaming, segment duration for segmented output, encoder default for files)
   206  }
   207  
   208  enum EncodingOptionsPreset {
   209    H264_720P_30 = 0;           //  1280x720, 30fps, 3000kpbs, H.264_MAIN / OPUS
   210    H264_720P_60 = 1;           //  1280x720, 60fps, 4500kbps, H.264_MAIN / OPUS
   211    H264_1080P_30 = 2;          // 1920x1080, 30fps, 4500kbps, H.264_MAIN / OPUS
   212    H264_1080P_60 = 3;          // 1920x1080, 60fps, 6000kbps, H.264_MAIN / OPUS
   213    PORTRAIT_H264_720P_30 = 4;  //  720x1280, 30fps, 3000kpbs, H.264_MAIN / OPUS
   214    PORTRAIT_H264_720P_60 = 5;  //  720x1280, 60fps, 4500kbps, H.264_MAIN / OPUS
   215    PORTRAIT_H264_1080P_30 = 6; // 1080x1920, 30fps, 4500kbps, H.264_MAIN / OPUS
   216    PORTRAIT_H264_1080P_60 = 7; // 1080x1920, 60fps, 6000kbps, H.264_MAIN / OPUS
   217  }
   218  
   219  message UpdateLayoutRequest {
   220    string egress_id = 1;
   221    string layout = 2;
   222  }
   223  
   224  message UpdateStreamRequest {
   225    string egress_id = 1;
   226    repeated string add_output_urls = 2;
   227    repeated string remove_output_urls = 3;
   228  }
   229  
   230  message ListEgressRequest {
   231    string room_name = 1; // (optional, filter by room name)
   232    string egress_id = 2; // (optional, filter by egress ID)
   233    bool active = 3;      // (optional, list active egress only)
   234  }
   235  
   236  message ListEgressResponse {
   237    repeated EgressInfo items = 1;
   238  }
   239  
   240  message StopEgressRequest {
   241    string egress_id = 1;
   242  }
   243  
   244  enum EgressStatus {
   245    EGRESS_STARTING = 0;
   246    EGRESS_ACTIVE = 1;
   247    EGRESS_ENDING = 2;
   248    EGRESS_COMPLETE = 3;
   249    EGRESS_FAILED = 4;
   250    EGRESS_ABORTED = 5;
   251    EGRESS_LIMIT_REACHED = 6;
   252  }
   253  
   254  message EgressInfo {
   255    string egress_id = 1;
   256    string room_id = 2;
   257    string room_name = 13;
   258    EgressStatus status = 3;
   259    int64 started_at = 10;
   260    int64 ended_at = 11;
   261    string error = 9;
   262    oneof request {
   263      RoomCompositeEgressRequest room_composite = 4;
   264      TrackCompositeEgressRequest track_composite = 5;
   265      TrackEgressRequest track = 6;
   266      WebEgressRequest web = 14;
   267    }
   268    oneof result { // deprecated (use _result fields)
   269      StreamInfoList stream = 7 [deprecated = true];
   270      FileInfo file = 8 [deprecated = true];
   271      SegmentsInfo segments = 12 [deprecated = true];
   272    }
   273    repeated StreamInfo stream_results = 15;
   274    repeated FileInfo file_results = 16;
   275    repeated SegmentsInfo segment_results = 17;
   276  }
   277  
   278  message StreamInfoList {
   279    option deprecated = true;
   280    repeated StreamInfo info = 1;
   281  }
   282  
   283  message StreamInfo {
   284    enum Status {
   285      ACTIVE = 0;
   286      FINISHED = 1;
   287      FAILED = 2;
   288    }
   289  
   290    string url = 1;
   291    int64 started_at = 2;
   292    int64 ended_at = 3;
   293    int64 duration = 4;
   294    Status status = 5;
   295    string error = 6;
   296  }
   297  
   298  message FileInfo {
   299    string filename = 1;
   300    int64 started_at = 2;
   301    int64 ended_at = 3;
   302    int64 duration = 6;
   303    int64 size = 4;
   304    string location = 5;
   305  }
   306  
   307  message SegmentsInfo {
   308    string playlist_name = 1;
   309    int64 duration = 2;
   310    int64 size = 3;
   311    string playlist_location = 4;
   312    int64 segment_count = 5;
   313    int64 started_at = 6;
   314    int64 ended_at = 7;
   315  }
   316  
   317  message AutoTrackEgress {
   318    string filepath = 1;       // see docs for templating (default {track_id}-{time})
   319    bool disable_manifest = 5; // disables upload of json manifest file (default false)
   320    oneof output {
   321      S3Upload s3 = 2;
   322      GCPUpload gcp = 3;
   323      AzureBlobUpload azure = 4;
   324    }
   325  }