Livekit for livestream

Why We Use LiveKit for Live Streaming

Technical architecture decision | Last updated: November 2, 2026

1. Overview

We use LiveKit because our streaming product is fundamentally a web application.

Our stream layout, overlays, recitation text, and other visual elements are built as React components. We need a streaming infrastructure that can broadcast this exact web page to YouTube while providing multi-camera support, rooms, and real-time remote control.

LiveKit is the best fit for our architecture because it brings all these capabilities together in one open-source stack.

Other alternatives either:

  • Require us to rebuild our existing HTML/CSS overlays.

  • Break the consistency between Studio preview and the actual broadcast.

  • Require significant changes to our existing Studio architecture.

  • Introduce additional infrastructure without providing meaningful cost savings.

With LiveKit, we can keep our existing Studio implementation while choosing between self-hosted infrastructure and LiveKit Cloud.


2. What We Currently Use LiveKit For

The following table documents the features currently implemented in our product and where they are integrated into the codebase.

Feature How LiveKit Provides It Implementation
Web page broadcasting RoomComposite Egress opens our custom layout page in headless Chrome using custom_base_url and encodes it into a video stream. livekit_client.start_stream_egress, LiveLayoutPage.tsx
Identical preview and broadcast Both Studio preview and the egress page render the same LiveLayout component. LiveLayout.tsx
Rich HTML/CSS overlays Supports text, images, QR codes, lower thirds, recitation text, tickers, and custom fonts. LiveLayout.tsx, OverlaysPanel.tsx, overlayStyle
Tibetan and Chinese text Chromium handles complex script rendering, including Tibetan stacked characters. Layout page
Real-time scene and overlay updates Backend updates room metadata, and the layout reacts to RoomMetadataChanged events. update_room_metadata, LiveLayoutPage.tsx
Live recitation line Studio publishes the current line through a reliable data channel topic. useLiveRoom.ts, LIVE_LINE_TOPIC
Multiple cameras Each camera joins as a participant and publishes its own video track. CamerasPanel.tsx, CameraSwitcher.tsx
Phone as a camera A phone joins the room through a camera-only token. PhoneCameraPage.tsx, camera_token
Screen sharing Native screen-sharing and screen-sharing audio support. publisher_token
Remote overlay controller A separate controller link can update broadcast data without viewing or publishing video. controller_token, live-control/
Role-based access Signed JWT tokens provide separate permissions for publishers, cameras, controllers, and administrators. livekit_client.py
Multiple YouTube destinations One egress encodes the stream once and sends it to multiple RTMP destinations. start_stream_egress(rtmp_urls=[...])
Dynamic RTMP destinations Destinations can be added or removed during an active stream using UpdateStream. update_stream_urls
Quality presets Supports predefined H.264 encoding configurations, including 1080p30 and 720p30. _EGRESS_PRESETS
Failure notifications Signed webhooks notify the backend when an egress fails. verify_webhook, live_studio_service.py
Room lifecycle management Rooms can be created, deleted, automatically closed, and have participants removed. create_room, delete_room, remove_participant
Network resilience Built-in reconnection, connection-quality monitoring, and TURN support. useLiveRoom.ts

3. Alternatives We Evaluated

We evaluated several approaches based on their ability to preserve our existing Studio, support custom overlays, scale to multiple simultaneous broadcasts, and control infrastructure costs.

Comparison

Solution Existing Overlays Migration Effort Estimated Cost Decision
LiveKit (Self-hosted) Fully supported None ~$0.60/stream-hour + ~$800/month fixed infrastructure Selected for scale
LiveKit Cloud Fully supported Minimal; change URL and credentials ~$0.90–$1.20/stream-hour, starting at $50/month Selected for low volume
MediaMTX + FFmpeg Not natively supported High; rebuild overlays and scene management ~$0.10–$0.15/stream-hour for encoding CPU, excluding shared infrastructure costs Rejected
Daily / 100ms / Agora Partially supported High; port layouts to vendor-specific systems Similar usage-based pricing model Rejected
AWS IVS Real-Time Partially supported High AWS-managed pricing Rejected
Browser compositing + cloud restream Fully supported Medium Lowest infrastructure cost Rejected for now
Custom mediasoup / Janus + GStreamer Only after rebuilding Very high; potentially months Similar compute requirements Rejected

Why We Rejected the Alternatives

MediaMTX + FFmpeg

FFmpeg cannot directly render our React-based HTML/CSS layouts. We would need to rebuild our overlays using FFmpeg filters or another rendering pipeline.

This creates additional complexity for:

  • Dynamic overlay positioning and resizing.

  • Real-time scene changes.

  • Tibetan and Chinese text rendering.

  • Maintaining consistency between preview and broadcast.

It may reduce browser-rendering CPU costs, but the underlying encoding and bandwidth requirements remain.

Daily, 100ms, and Agora

These platforms provide managed real-time communication infrastructure, but we would need to adapt our Studio and broadcast architecture to their respective layout and egress systems.

This introduces vendor dependency without a significant architectural advantage.

AWS IVS Real-Time

IVS offers managed real-time video infrastructure, but its composition and output capabilities do not directly match our YouTube RTMP broadcasting workflow. It would require further integration or architectural changes.

Browser compositing + cloud restream

This approach renders the broadcast directly in the host’s browser and forwards it to a cloud restreaming service.

Although it can reduce infrastructure costs, the broadcast becomes dependent on the host’s computer, browser tab, and internet connection. A browser crash or network interruption can terminate the broadcast.

Building our own with mediasoup / Janus + GStreamer

This would give us flexibility, but we would essentially be rebuilding functionality that LiveKit already provides, increasing development and maintenance costs.


4. Why LiveKit Is the Best Fit

4.1 Our Product Is a Web Page

Our broadcast is not a traditional video production pipeline.

It is a React application containing:

  • Dynamic overlays.

  • Recitation text.

  • Images and QR codes.

  • Custom fonts and typography.

  • Live scene configurations.

  • Interactive visual elements.

LiveKit’s RoomComposite Egress allows us to broadcast this web application directly.

This means we do not need to maintain a separate rendering system for the broadcast.

4.2 One Stack Covers the Entire Workflow

LiveKit provides the infrastructure for:

  • Real-time rooms and participants.

  • Multiple cameras and screen sharing.

  • Data channels and room metadata.

  • Role-based authentication.

  • Browser-based compositing.

  • RTMP broadcasting.

  • Multiple streaming destinations.

  • Webhooks and lifecycle management.

Using separate services would require integrating and maintaining several independent systems.

4.3 Open Source and No Infrastructure Lock-in

LiveKit is open source under the Apache 2.0 license.

We can:

  • Self-host LiveKit and Egress for greater infrastructure control.

  • Use LiveKit Cloud when we want managed infrastructure.

  • Move between self-hosted and cloud deployments without rewriting our Studio.

This gives us flexibility to optimize costs as the product grows.

4.4 Designed for Horizontal Scaling

LiveKit Egress workers can distribute streaming jobs using Redis.

We can add more Egress workers as the number of simultaneous broadcasts increases.

Our self-hosted architecture can therefore scale independently of the Studio application.

See: livekit-egress-from-scratch.md

4.5 Alternative Solutions Do Not Eliminate the Main Costs

Regardless of the streaming technology, server-side broadcasting requires:

  1. Video encoding for each independent broadcast.

  2. Network bandwidth to deliver the stream to YouTube.

  3. Infrastructure to manage concurrent streams.

Changing from LiveKit to another server-side solution does not eliminate these costs.

The main potential saving from FFmpeg is reducing the CPU overhead of rendering a browser page, but this comes with the cost of rebuilding our existing overlay system.


5. Trade-offs and Limitations

LiveKit is the best fit for our current architecture, but it comes with operational trade-offs.

Trade-off Impact Mitigation
Chrome rendering is CPU-intensive Approximately 3–4 vCPUs per 1080p stream in our current planning estimates. Use 720p where 1080p is unnecessary and optimize browser rendering.
Self-hosting requires operations We must manage Egress workers, autoscaling, monitoring, upgrades, and failures. Use LiveKit Cloud when operational overhead becomes too high.
Control plane is currently a single instance A control-plane failure could affect new sessions and management operations. Introduce multi-node deployment with shared Redis when high availability is required.

6. YouTube Streaming Limits

These limitations come from YouTube, not LiveKit. Switching streaming infrastructure will not remove them.

YouTube Limitation What It Means for Us
10 active live streams per channel To run 20 simultaneous broadcasts, we need at least two YouTube channels, assuming this limit applies to our account configuration.
3 active streams per stream key This does not currently affect us because our backend creates a new, single-use stream key for each broadcast (isReusable: False).
Daily stream creation limit YouTube applies daily creation restrictions, but the exact limit is not publicly specified.
YouTube Data API quota The default quota is 10,000 units/day. Each go-live operation currently makes approximately three write calls per channel.

Important: YouTube account-level limits and API quotas should be verified against the actual accounts and API project before increasing production concurrency.


7. When Should We Reconsider LiveKit?

We should revisit this architectural decision when one of the following conditions occurs:

Trigger Possible Action
Monthly LiveKit Cloud or AWS infrastructure costs exceed ~$1,500. Re-evaluate Cloud versus self-hosted infrastructure and alternative encoding pipelines.
We no longer need dynamic HTML/CSS overlays. Consider an FFmpeg-based broadcasting pipeline.
Hosts can reliably broadcast from powerful desktop machines with stable internet. Reconsider browser-based compositing and cloud restreaming.
We need higher availability for broadcast management. Move the LiveKit control plane to a multi-node architecture.

8. Final Decision

We chose LiveKit because it matches how our streaming product is built.

Our Studio is a browser-based production environment, not just a video publisher. LiveKit allows us to use the same React components for preview and broadcasting while supporting multiple cameras, remote controllers, real-time overlays, and YouTube RTMP output.

Moving to another solution would mean rebuilding parts of our existing product without necessarily reducing the most significant infrastructure costs.

For our current requirements, LiveKit provides the best balance of:

  • Product flexibility.

  • Development speed.

  • Real-time capabilities.

  • Infrastructure scalability.

  • Cost control.

  • Long-term ownership.

Our strategy: Use LiveKit Cloud when operational simplicity matters and self-hosted LiveKit when concurrency and cost justify managing our own infrastructure.


9. References

Document owner: Streaming Engineering Team

Live Streaming Cost: LiveKit Cloud vs Self-Hosted

Cost comparison and infrastructure planning | Last updated: November 2, 2026

Short answer

At our current usage of approximately 2–3 simultaneous streams, keeping our existing self-hosted EC2 instance or moving to LiveKit Cloud costs roughly the same.

Recommendation: Keep the existing EC2 setup for now. There is no need to build autoscaling infrastructure yet. Consider self-hosted autoscaling when we regularly handle around 8–10 or more simultaneous streams.


1. Monthly Cost Comparison

The following estimates assume 10 streaming hours per day, 30 days per month, with all streams running simultaneously during those hours.

Simultaneous Streams LiveKit Cloud Self-Hosted (Single EC2) Self-Hosted (Autoscaling)
2 $760–870 ~$800 (~$420 at 720p) Not needed
3 $1,120–1,190 ~$880 Not needed
10 $3,080–3,380 Not supported on one server ~$2,630
20 $5,780–6,680 Not supported on one server ~$3,800–4,160

All figures are approximate monthly USD estimates.

Important: LiveKit Cloud estimates include a range because we need to confirm whether outgoing stream traffic to YouTube is billed as data transfer. This should be clarified with LiveKit before making a final budget decision.

What this comparison tells us

  • At 2–3 simultaneous streams, the existing EC2 infrastructure is already competitive.

  • LiveKit Cloud becomes attractive when we want to avoid managing servers.

  • At higher concurrency, self-hosted autoscaling becomes more economical.

  • At 20 simultaneous streams, autoscaling could save approximately $1,600–2,900 per month compared with LiveKit Cloud.


2. Where the Money Goes

2.1 LiveKit Cloud

Reference: LiveKit Pricing

Item Estimated Price
Ship plan $50/month
Ship included usage 600 minutes
Scale plan $500/month
Scale included usage 8,000 minutes
Additional stream minute (Ship) $0.02
Additional stream minute (Scale) $0.015
One stream for one hour (Ship) $1.20
One stream for one hour (Scale) $0.90
Free plan 60 minutes/month

The Ship plan supports up to 100 concurrent streams according to the pricing assumptions used in this comparison.

How pricing works: Each active egress stream contributes to usage. For example, 3 simultaneous streams running for 10 hours generate 30 stream-hours per day.

The Scale plan has a higher base price but a lower per-minute rate, making it more economical at higher usage.

2.2 Self-Hosted on AWS

Region: Singapore | On-demand pricing estimates

Infrastructure Estimated Monthly Cost
Existing server: c7i.4xlarge (always running) ~$660
Smaller dedicated server: c7i.xlarge ~$170
Additional Egress worker: c7i.4xlarge (approximately 3 streams) ~$0.90/hour while running
YouTube data transfer (1080p) ~$0.24/stream-hour
Monitoring, secrets and autoscaler ~$15/month

Main cost components:

  1. Compute: EC2 instances running LiveKit and Egress.

  2. Encoding: CPU resources consumed by browser rendering and video encoding.

  3. Bandwidth: Outgoing video traffic delivered to YouTube.

  4. Operations: Monitoring, autoscaling, secrets management and maintenance.

The main advantage of self-hosting is that we control when additional Egress workers are running. During periods without broadcasts, unnecessary workers can be shut down.


3. Operational Effort: How Much Work Is Required?

Cost is not the only consideration. We also need to account for the engineering effort required to maintain each deployment.

Category LiveKit Cloud Self-Hosted (Single EC2) Self-Hosted (Autoscaling)
Initial setup 1–2 hours Already implemented 2–4 working days
Ongoing maintenance Minimal infrastructure maintenance ~1 hour/month ~2–4 hours/month
Upgrades Managed by LiveKit We manage upgrades We manage worker images and upgrades
Monitoring Cloud-managed infrastructure We monitor our server We monitor workers, alarms and scaling
Failure handling LiveKit manages infrastructure issues We investigate and fix issues We investigate and fix issues
Required skills No new infrastructure skills Docker, basic Linux Docker, Linux, AWS (EC2, Auto Scaling, IAM, Lambda)

3.1 Autoscaling Implementation Effort

If we decide to implement self-hosted autoscaling, the estimated work is:

Implementation Phase Estimated Time
Inspect existing server and deployment 1 hour
Configure networking, Elastic IP, secrets and IAM roles 2–3 hours
Configure Redis access (short maintenance window) 1 hour
Build and test one Egress worker 3–4 hours
Prepare worker image and Auto Scaling Group 2–3 hours
Implement scaler Lambda and CloudWatch alarms 3–4 hours
Cut over, downsize and monitor 1 hour + observation period

Total estimated engineering effort: 2–4 working days, excluding extended testing and troubleshooting.

Reference: Self-hosted Egress Autoscaling Runbook


4. Which Option Should We Choose?

Based on our expected streaming volume, the following is the recommended approach.

Our Situation Recommended Option Reason
1–3 simultaneous streams Existing self-hosted EC2 Already implemented and cost-competitive
4–7 simultaneous streams LiveKit Cloud Avoid additional infrastructure complexity
8–10+ simultaneous streams regularly Self-hosted with autoscaling Better cost efficiency at higher concurrency
Occasional high-volume events LiveKit Cloud Pay according to actual usage without maintaining idle workers

Recommended Strategy

Current recommendation Continue with the existing EC2 instance.

There is no strong financial reason to invest engineering time in autoscaling at our current concurrency.

We should revisit the architecture when the number of simultaneous streams increases consistently.

The important distinction is between occasional peak traffic and regular high concurrency. We should not build and maintain autoscaling infrastructure just to support a few occasional large events.


5. Cost Optimization Opportunities

There are two straightforward ways to reduce costs regardless of which deployment approach we choose.

5.1 Use 720p Where 1080p Is Not Required

A 1080p stream requires more CPU and bandwidth than a 720p stream.

For self-hosted infrastructure, moving suitable broadcasts to 720p can significantly reduce resource consumption.

Potential benefits:

  • Lower Egress CPU usage.

  • Reduced EC2 instance requirements.

  • Lower outgoing bandwidth costs.

  • Ability to accommodate more streams per worker.

Our estimated savings are approximately 50% for the relevant server and bandwidth costs, depending on actual encoding settings and workload.

5.2 Optimize Self-Hosted Infrastructure

For self-hosted deployments:

  • Shut down additional Egress workers outside streaming hours.

  • Use autoscaling to add workers only when required.

  • Consider a 1-year AWS Savings Plan once usage becomes predictable.

  • Optimize instance sizes based on actual CPU and memory consumption.

  • Monitor resource utilization using docker stats during real broadcasts.

A Savings Plan could reduce always-on compute costs by approximately 30%, depending on the selected commitment and AWS pricing.


6. Important Limits to Remember

Some limitations are imposed by YouTube or the service provider rather than our infrastructure.

Platform Limitation Impact
YouTube 10 active live streams per channel (planning assumption) 20 simultaneous streams would require at least two channels.
LiveKit Cloud Free 60 minutes/month under the pricing assumptions used here Not suitable for our regular production usage.

These limits should be verified against the actual account configuration and current provider documentation before production planning.


7. Cost Calculation Assumptions

To make the comparison transparent, these are the assumptions behind the estimates.

Parameter Assumption
Daily streaming duration 10 hours
Monthly operating days 30 days
Video quality 1080p30
Egress type RoomComposite
CPU requirement ~3.5 vCPU per 1080p stream (planning estimate, not yet measured)
AWS region Singapore
AWS pricing Approximate on-demand estimates
LiveKit Cloud pricing Pricing assumptions checked November 2, 2026
Staff engineering costs Excluded
Cloud room connection charges Not included in Cloud estimates

Important Validation Tasks

Before finalizing the infrastructure budget, we should:

  1. Measure actual CPU usage for one 1080p stream using docker stats.

  2. Confirm the maximum number of streams our current EC2 instance can reliably support.

  3. Confirm LiveKit Cloud’s outgoing data-transfer charges for YouTube RTMP.

  4. Verify AWS EC2 and bandwidth pricing using the AWS Pricing Calculator.

  5. Test 720p resource consumption against our current 1080p configuration.

The current CPU estimate of 3.5 vCPU per stream is a planning assumption, not a confirmed benchmark.


8. Final Recommendation

For our current usage, keeping the existing self-hosted EC2 deployment is the most practical decision.

We already have the infrastructure running, and its estimated cost is comparable to LiveKit Cloud at 2–3 simultaneous streams.

Moving to LiveKit Cloud would primarily provide operational convenience rather than substantial cost savings.

Building autoscaling infrastructure now would introduce unnecessary engineering and maintenance overhead.

Our proposed direction:

  • Today: Continue with the existing EC2 deployment.

  • Medium usage: Consider LiveKit Cloud when operational simplicity becomes more valuable.

  • High concurrency: Implement self-hosted Egress autoscaling when we consistently reach 8–10 or more simultaneous streams.

This approach allows us to avoid unnecessary infrastructure complexity today while retaining a clear path to scale economically.


9. Related Documents

Document owner: Streaming Engineering Team

One cost item worth adding: self-hosted EC2 also pays AWS data transfer out for every stream sent to YouTube, and that can be material at 10–20 concurrent streams. The comparison should include it alongside instance and egress compute. Also get LiveKit Cloud’s RTMP/egress data billing confirmed in writing, since the range in your table depends on it. At 2–3 streams the gap may stay small, but at higher concurrency the self-hosted advantage could shrink once bandwidth is counted.