This repo uses Git LFS for embedded video resources. Please ensure git-lfs is installed on your machine.
git clone https://github.com/livekit/livekit-cli
make install
Usage
See lk --help for a complete list of subcommands. The --help flag can also be used on any subcommand for more information.
Set up your project (new)
The quickest way to get started is to authenticate with your LiveKit Cloud account and link an existing project. If you haven't created an account or project yet, head here first. Then run the following:
lk cloud auth
Follow the URL to login in the browser and choose your project to link. When you return to your terminal, you'll have the option to use this project as the default.
When a default project is set up, you can omit url, api-key, and api-secret when using the CLI. You can also set up multiple projects, and temporarily switch the active project used with the --project flag, or persistently using lk project set-default.
The LiveKit CLI can help you bootstrap applications from a number of convenient template repositories, using your project credentials to set up required environment variables and other configuration automatically. To create an application from a template, run the following:
lk app create --template <template_name> my-app
Then follow the CLI prompts to finish your setup.
For a list of all available templates, run:
lk app list-templates
See the LiveKit Templates Index for details about templates, and for instructions on how to contribute your own.
Publishing to a room
Publish demo video track
To publish a demo video as a participant's track, use the following:
This will publish the pre-encoded .ivf and .ogg files to the room, indicating video FPS of 23.98. Note that the FPS only affects the video; it's important to match video framerate with the source to prevent out of sync issues.
Note: For files uploaded via CLI, expect an initial delay before the video becomes visible to the remote viewer. This delay is attributed to the pre-encoded video's fixed keyframe intervals. Video encoded with LiveKit client SDKs do not have this delay.
Publish from FFmpeg
It's possible to publish any source that FFmpeg supports (including live sources such as RTSP) by using it as a transcoder.
This is done by running FFmpeg in a separate process, encoding to a Unix socket. (not available on Windows).
lk can then read transcoded data from the socket and publishing them to the room.
You should now see both video and audio tracks published to the room.
Publish from TCP (i.e. gstreamer)
It's possible to publish from video streams coming over a TCP socket. lk can act as a TCP client. For example, with a gstreamer pipeline ending in ! tcpserversink port=16400 and streaming H.264.
Using unix sockets, it's also possible to publish streams from your application. The tracks need to be encoded into
a format that WebRTC clients could playback (VP8, H.264, and Opus).
Once you are writing to the socket, you could use ffplay to test the stream.
In order to speed up the development cycle of your recording templates, we provide a sub-command test-egress-template that
helps you to validate your templates.
The command will spin up a few virtual publishers, and then simulate them joining your room
It'll then open a browser to the template URL, with the correct parameters filled in.
The above simulates 5 concurrent speakers, each playing back a pre-recorded audio sample at the same time.
In a meeting, typically there's only one active speaker at a time, but this can be useful to test audio capabilities.
Head over to the example web client and paste in the token, you can see the simulated tracks published by the load tester.
Running on a cloud VM
Due to bandwidth limitations of your ISP, most of us wouldn't have sufficient bandwidth to be able to simulate 100s of users download/uploading from the internet.
We recommend running the load tester from a VM on a cloud instance, where there isn't a bandwidth constraint.
To make this simple, make will generate a linux amd64 binary in bin/. You can scp the binary to a server instance and run the test there.
Configuring system settings
Prior to running the load tests, it's important to ensure file descriptor limits have been set correctly. See Performance tuning docs.
On the machine that you are running the load tester, they would also need to be applied:
This package defines the configuration file associated with LiveKit templates, which include instructions for package setup and development in both Playground mode and local dev.
This package defines the configuration file associated with LiveKit templates, which include instructions for package setup and development in both Playground mode and local dev.