How would i upload the meeting using egress api us...
# ask-ai
e
How would i upload the meeting using egress api using gcp
t
Thanks for reaching out, Aditya. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
You're asking how to upload a meeting recording to GCP using LiveKit's Egress API — I'll guide you through the required steps and show example requests. Quick question before I give code: do you want a single MP4 file, HLS segments, or both/thumbnails? Also tell me which client you prefer: REST (curl), Go, or Python. Sources: Egress API | LiveKit docs | Egress output types | LiveKit docs
e
i want to upload video, like the meeting recording
Copy code
req = api.RoomCompositeEgressRequest(
    room_name=self.room_name,
    layout="grid",
    audio_only=False,
    preset=api.EncodingOptionsPreset.H264_720P_30,
    file_outputs=[
        api.EncodedFileOutput(
            file_type=api.EncodedFileType.MP4,
            filepath=filepath,
            s3=api.S3Upload(
                bucket=os.getenv("EGRESS_AWS_BUCKET_NAME"),
                region=os.getenv("EGRESS_AWS_REGION"),
                access_key=os.getenv("EGRESS_AWS_ACCESS_KEY_ID"),
                secret=os.getenv("EGRESS_AWS_SECRET_ACCESS_KEY"),
            ),
        )
    ],
)
what is the gcp equivalent to this
t
You're using
file_outputs
with
s3
for MP4. For GCP, replace the
s3
block with a
gcp
block using
GCPUpload
and pass the service account JSON as a string plus the target bucket. Example Python snippet:
Copy code
import json
from livekit import api

# read your GCP service account key JSON
with open("credentials.json", "r") as f:
    credentials_json = f.read()

req = api.RoomCompositeEgressRequest(
    room_name=self.room_name,
    layout="grid",
    audio_only=False,
    preset=api.EncodingOptionsPreset.H264_720P_30,
    file_outputs=[
        api.EncodedFileOutput(
            file_type=api.EncodedFileType.MP4,
            filepath=filepath,
            gcp=api.GCPUpload(
                credentials=credentials_json,  # full JSON string from service account key
                bucket="my-meetings-bucket",
            ),
        )
    ],
)
Key points: •
credentials
must contain the full service account JSON (string). •
bucket
is the GCS bucket name. • Ensure the service account has Storage Object Creator permissions for the bucket. Would you like the equivalent REST (curl) or Go example as well?
e
credentials
So that means i need to read the credentials from the file and then stringify it first or is it expecting the file path
t
The
GCPUpload.credentials
field expects the full service-account JSON content as a string (not a file path). Read the JSON file and pass its contents. Short Python example:
Copy code
with open("credentials.json", "r") as f:
    credentials_json = f.read()

req = api.RoomCompositeEgressRequest(
    ...,
    file_outputs=[
        api.EncodedFileOutput(
            file_type=api.EncodedFileType.MP4,
            filepath=filepath,
            gcp=api.GCPUpload(
                credentials=credentials_json,
                bucket="my-meetings-bucket",
            ),
        )
    ],
)
Make sure the service account has Storage Object Creator permission on the target bucket. Would you like a curl or Go example too?