:x: Failed to start audio recording: TwirpError(co...
# ask-ai
c
❌ Failed to start audio recording: TwirpError(code=invalid_argument, message=request has missing or invalid field: output, status=400)
t
Thanks for reaching out, raj. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
It looks like your audio recording request is missing or has an invalid
output
field configuration. LiveKit's egress service needs you to set up at least one output destination for recording or streaming. Here are the main output types you can choose from: • EncodedFileOutput: To save recordings as files (like MP4 or OGG). • StreamOutput: For live streaming to RTMP endpoints. • SegmentedFileOutput: For HLS/DASH segmented output. • ImageOutput: To capture periodic snapshots or thumbnails. For example, here’s how you can set up a file output for recording:
Copy code
from livekit import api

# Configure file output for recording
req = api.RoomCompositeEgressRequest(
    room_name="your-room-name",
    audio_only=True,
    file_outputs=[api.EncodedFileOutput(
        file_type=api.EncodedFileType.OGG,
        filepath="livekit/my-room-test.ogg",
        s3=api.S3Upload(
            bucket="<s3 bucket name>",
            region="<s3 region>",
            access_key="<s3 access key>",
            secret="<s3 secret key>",
        ),
    )],
)
Make sure your request includes a properly set
output
field. If you want, just tell me what kind of output you’re aiming for, and I’d be happy to help you get it sorted! Sources: lib/livekit/egress_service_client.rb | Session recording and transcripts | LiveKit Docs | Egress output types | LiveKit Docs | pkg/errors/errors.go | livekit-api/livekit/api/twirp_client.py
c
how to enable livekit egress on my server
t
Hey there! To get LiveKit egress up and running on your server, you can go with either Docker or Helm (if you’re using Kubernetes). I’ve broken down the steps for both to make it super easy for you: Docker Deployment 1. First, create a
config.yaml
file with your settings:
Copy code
# Required fields
api_key: your-livekit-server-api-key
api_secret: your-livekit-server-api-secret
ws_url: ws://your-livekit-server:7880
redis:
  address: your-redis-address:6379

# Storage configuration (choose one)
storage:
  s3:
    access_key: your-aws-access-key
    secret: your-aws-secret-key
    region: us-west-2
    bucket: your-egress-bucket
1. Then, run the egress service using Docker:
Copy code
docker run --rm \
    -e EGRESS_CONFIG_FILE=/out/config.yaml \
    -v /path/to/your/config:/out \
    livekit/egress
Helm Deployment (Kubernetes) 1. Add the LiveKit Helm repo:
Copy code
helm repo add livekit <HELM_REPO_URL>
1. Create a
values.yaml
file with your details:
Copy code
egress:
  api_key: "your-server-api-key"
  api_secret: "your-server-api-secret"
  ws_url: "ws://livekit-host:7880"
  redis:
    address: redis-host:6379
  s3:
    access_key: "your-access-key"
    secret: "your-secret"
    region: "us-west-2"
    bucket: "your-egress-bucket"
1. Finally, install the Helm chart:
Copy code
helm install egress livekit/egress --namespace livekit --values values.yaml
Quick Tips for Configuration • Make sure your API credentials match those of your LiveKit server. • Use the same Redis instance as your LiveKit server to keep things synced. • Don’t forget to set up at least one storage backend like S3, GCP, or Azure. If you hit any bumps or want me to walk you through a particular step, just give me a shout—I’m here to help! Sources: egress-sample.yaml | cmd/lk/egress.go | pkg/server/server.go | Self-hosting the Egress Service | LiveKit Docs
c
can't i test egress locally instead of aws or other cloud
t
Absolutely, you can test LiveKit egress locally without needing cloud storage like AWS or GCP. LiveKit actually supports local file storage by default when you don’t have any cloud storage providers set up. Here’s how you can test egress locally: 1. First, mount a local directory when you run the egress service:
Copy code
docker run --rm \
    -e EGRESS_CONFIG_FILE=/out/config.yaml \
    -v ~/egress-test:/out \
    livekit/egress
1. Next, use local file paths in your egress requests by pointing to the mounted directory in your filenames (for example,
/out/my-recording.mp4
). 2. Make sure the mounted directory has the right permissions, since the egress service doesn’t run as root. Local Configuration: When testing locally, your
config.yaml
should leave out any cloud storage settings. The egress service will then automatically save files locally. Here’s a sample config:
Copy code
log_level: debug
api_key: your-api-key
api_secret: your-api-secret
ws_url: ws://192.168.65.2:7880
insecure: true
redis:
  address: 192.168.65.2:6379
This setup lets you try out all egress features, like room composites, track composites, and individual track recordings, all without needing cloud storage. If you have any questions or need a hand with anything, just let me know—I’m here to help! Sources: test/edge.go