Keyboard shortcuts

Press ← or → to go to the previous or next page

Press S or / to search the docs

Press ? to show this help

Press Esc to hide this help

Reference

irl reference

The irl binary is in the iroh-live-cli crate. It has seven commands: devices, publish, watch, call, room, record, and run.

Every feature is on by default, and the Linux-only ones compile to nothing on macOS and Windows. The features reference lists them. record and run never open a window.

Every command reads its key from IROH_SECRET when it is set, so its tickets survive a restart, and its log filter from RUST_LOG. Without RUST_LOG, only errors are logged. See Environment variables.

Every command stops on Ctrl+C, also with its window hidden. The first Ctrl+C leaves rooms, closes the broadcasts and then the endpoint, so peers learn at once that the node is gone. A second Ctrl+C exits at once, and the process exits anyway if the shutdown takes longer than five seconds.

irl devices

Lists the cameras, displays, and audio devices of this machine. Each line starts with the identifier that --video, --audio, and --audio-output take.

Windows and applications are listed on macOS only. On Linux the desktop portal’s picker comes first in the displays and windows sections, as screen:portal and window:portal. The X11 displays follow it, or a note when they cannot be listed. The audio outputs section needs the playback feature. A build with the rpicam feature adds a Raspberry Pi camera section, from rpicam-vid --list-cameras.

irl publish

Publishes a capture device or a media file, and prints a ticket and its QR code for irl watch.

Sources

A source specifier names a kind of source and, optionally, a device of that kind. The platform picks the capture backend. iroh_live::media::spec parses and opens the same specifiers in a program.

--videoMeaning
camThe default camera. This is the default
cam:<id>A camera, by the id irl devices prints
screen, screen:<id>A whole display
window:<id>One window (macOS)
app:<id>Every window of one application (macOS)
rpicamThe Raspberry Pi camera through rpicam-vid, encoded by the Pi’s hardware. Needs the rpicam feature
rpicam:rawThe Raspberry Pi camera’s raw pictures, encoded here. Needs the rpicam feature
file:<path>[:loop]An MP4 file, plain or fragmented, published as it is, or decoded and encoded with --reencode. Its audio comes along unless --audio is given, and a file without video publishes its audio alone
test, test:timingThe timing pattern: a sweeping bar, stripes, a frame counter, a clock, and a marker that flashes with the test tone’s beep
test:gradientA moving gradient
test:bounceA white square bouncing left and right on a background that drifts through the hues
noneNo video
--audioMeaning
mic, mic:<id>A microphone. mic is the default
systemEverything the machine plays (macOS)
file:<path>[:loop]A WAV, MP3 or MP4 file, decoded and encoded
test, test:beepsA beep every second, in step with the timing pattern’s marker
test:toneA continuous sine tone
noneNo audio

Any other --audio value is taken as a device name, so an ALSA name such as hw:0,1 works as written.

On Linux with the pipewire feature, cam opens PipeWire’s default camera, which other applications can share. screen opens the desktop portal’s picker, the only screen capture that works on Wayland. The CLI stores the portal’s grant in iroh-live/portal/ under $XDG_CONFIG_HOME, or ~/.config without it, so on a compositor that keeps grants the next run shares the same screen without asking. Stopping the share from the desktop deletes the grant. When PipeWire’s camera does not open, cam falls back to /dev/video0. On X11, screen falls back to the X11 display unless the user declined the picker.

Flags

Capture and encoding:

FlagDescription
--video <SPEC>Video source (default: cam)
--audio <SPEC>Audio source (default: mic, or the audio of a file: video, which in irl call replaces the microphone)
--reencodeDecode a file: video and encode it like a camera. Without it the file’s H.264 and AAC go out as they are, see Publish a file. Every encoding flag below turns it on, as does --preview. For the file’s own audio, so do --audio-codec and --audio-bitrate
--no-reencodePublish a file: video as it is, and fail if an encoding flag or --preview is given or the file is not H.264 or AAC
--test-sourcePublish --video test --audio test, overriding both flags
--codec <CODEC>h264 (default) or h265. H.265 needs a hardware encoder
--encoder <KIND>auto (default), hardware (hw), software (sw), or one backend: videotoolbox, mediafoundation, mediacodec, nvenc, vaapi, v4l2, openh264
--renditions <LIST>The ladder, comma-separated. A rendition is <height>p, <width>x<height>, or <name>:<width>x<height>, with an optional @<fps>. A bare name encodes at the source’s size. Default: one rendition named video at the source’s size
--keyframe-interval <SECONDS>Seconds between keyframes (default: 2). A viewer waits up to this long for a first picture, and a rendition switch waits as long. Use 1 for a call or a demo
--bitrate <BITS_PER_SECOND>Target video bitrate of the largest rendition. Smaller renditions get a share by pixel count. Omit to derive one from the resolution
--width, --heightRequested capture size. The device picks its nearest mode. A file: video keeps its size, and the two size its one rendition
--fpsRequested capture frame rate, see below
--no-cursorHide the pointer in screen, window, and application capture
--audio-codec <CODEC>opus (default) or pcm
--audio-bitrate <BITS_PER_SECOND>Target audio bitrate. Opus only

Transport:

FlagDescription
--name <NAME>Broadcast name, as the ticket carries it (default: hello)
--relay <ENDPOINT_ID>Also push the broadcast to this media relay
--no-serveAccept no incoming sessions and print no ticket. Only useful with --relay
--no-qrDo not print the QR code

Window:

FlagDescription
--previewOpen a window that shows what is published. A file: video is decoded for it, as under --reencode, so --no-reencode refuses it
--fullscreenStart the preview window in fullscreen

A backend name is the only backend tried: if it is missing, the command fails and does not fall back to software. Some backends need a feature: vaapi, nvidia (for nvenc), and v4l2. A backend this build lacks fails when the encoder opens. Platform support says which platform has which.

--relay attaches the node to the media relay and redials it when the session drops. Every broadcast of the node with the Granted audience goes to the media relay. The link only publishes: it does not add the media relay’s routes to this node’s route table. The command prints the path at which viewers find the broadcast on the media relay. Use a media relay that keeps each publisher to its own paths, as iroh-live-relay does. On one where anyone may publish anywhere, a viewer can be served a forgery.

--preview draws the frames that go to the encoders, so it decodes nothing. --video rpicam cannot be previewed, because its frames arrive encoded. A file: video is decoded and encoded under --preview, as under --reencode.

--video rpicam publishes the H.264 that the Pi’s hardware encoder produced. It refuses --codec h265, any --encoder other than auto, and more than one rung in --renditions. --width, --height, --fps, and --bitrate become rpicam-vid arguments. Use --video rpicam:raw to encode the pictures here.

Frame rate

--fps sets the capture rate for the whole ladder. An @<fps> suffix on a rung, as in --renditions 720p@60, also sets the capture rate. A ladder is captured once and every rung gets the same frames, so the highest @<fps> wins. With --renditions high:1280x720@60,low:640x360@30, both rungs encode at 60, and the log warns about low. Where --fps and a rung disagree, --fps wins.

With neither, the capture asks for 30. A device that cannot reach the requested rate uses its nearest rate. On macOS a camera ignores the requested rate, so nothing is requested there by default.

The log names the rate and where it came from:

INFO capture frame rate requested. The device runs at the nearest rate it supports fps=60 origin="--renditions"

origin is --fps, --renditions, --fps, capping the ladder, default, or device. Each rung logs the rate the device delivers on its publishing video rendition line.

irl watch

Subscribes to a broadcast and plays it. irl play is an alias.

FlagDescription
<TICKET>The ticket irl publish printed
--endpoint-id <ID>The publisher’s endpoint id, instead of a ticket. Needs --name
--name <NAME>The broadcast name, with --endpoint-id
--no-videoPlay audio only. No window opens
--rendition <NAME>Play this rendition only, instead of adapting to the link
--fullscreenStart in fullscreen
--scanRead the ticket from a QR code held up to the camera
--scan-camera <SPEC>The camera --scan reads: cam, cam:<id>, or rpicam
--decoder <KIND>auto (default), hardware (hw), software (sw), or one backend: videotoolbox, mediafoundation, mediacodec, nvdec, vaapi, v4l2, openh264
--latency <MODE>realtime, balanced (default), or smooth
--audio-output <ID>Play through this device, by the id irl devices prints. Needs playback

With --scan, the window opens on the camera picture and connects as soon as it reads a ticket. The window always has a Scan button, so a player started with a ticket can switch to another. Without --scan-camera, the scanner uses the Raspberry Pi camera if the build has rpicam and rpicam-vid is installed, and the default camera otherwise. On a Pi, /dev/video0 is the raw sensor and never delivers a picture, which is why the default camera is not the first choice there. Pass --scan-camera cam on a Pi with a USB webcam. If a camera opens and sends nothing for five seconds, the window says so.

Without --rendition, the player picks renditions from the link that serves the broadcast, a direct session or a media relay. A switch opens the new decoder next to the current one, so the picture does not go blank. The window has a combo box to switch between adaptive and fixed renditions.

A backend passed to --decoder is the only one tried. The window’s decoder combo box changes the decoder during playback, in the same way as a rendition switch. On a Raspberry Pi 4, auto picks the V4L2 hardware decoder, which adds latency. See Publish from a Raspberry Pi.

--latency sets how long the player holds each frame before it shows it, and how far behind it may fall before it skips ahead:

--latencyHolds each frame at leastSkips ahead atFor
realtime60 ms100 msConversations
balanced100 ms150 msThe default
smooth400 ms600 msWatching over Wi-Fi or a mobile link

The player holds a frame longer when the catalog or the measured audio jitter asks for more. Tune quality and latency shows the same settings from Rust.

irl call

Opens a one-to-one video call. Both sides publish their camera and microphone as the broadcast call and subscribe to the other’s.

FlagDescription
<TICKET>The peer’s call ticket. Omit to wait for a call
--decoder <KIND>As for irl watch
--latency <MODE>As for irl watch
--scan-camera <SPEC>The camera the scan screen reads, as for irl watch
--no-qrDo not print the QR code
--fullscreenStart in fullscreen

Every capture and encoding flag of irl publish applies too, and describes what this node sends. --decoder and --latency describe how the peer’s side plays.

The window starts on a waiting screen. It shows this node’s ticket, a box to paste the peer’s ticket into, and the local camera. Scanning the other side’s QR code also places the call. Once connected, the peer fills the window and the local camera moves to a corner. Hanging up on either side returns both windows to the waiting screen.

irl watch can play one side of a call, since it is an ordinary broadcast named call.

irl room

Joins a room with several members. It publishes this node’s camera and microphone into the room, shows the others in a grid, and has a chat panel.

FlagDescription
<TICKET>The room ticket. Omit to open a new room
--display-name <NAME>The name the others see (default: this node’s short endpoint id)
--decoder <KIND>As for irl watch
--latency <MODE>As for irl watch
--no-qrDo not print the QR code
--fullscreenStart in fullscreen

Every capture and encoding flag of irl publish applies too.

Every member subscribes to every other, so rooms suit small groups. The ticket a window prints lists this node as the bootstrap member, so pass that one on to the next member.

Chat is one more broadcast in the room, named chat. Its chat track is a JSON window in the format @moq/room reads. The window holds the last ten seconds of messages, so a member who joins sees what was said in that time.

A tile disappears when its broadcast closes or its session drops. It comes back if the member still lists the broadcast. A member who publishes nothing gets no tile. See Rooms.

irl record

Subscribes to a broadcast and writes it to a file. It does not decode: the encoded frames go straight into the container.

FlagDescription
<TICKET>The ticket irl publish printed
--endpoint-id <ID>The publisher’s endpoint id, instead of a ticket. Needs --name
--name <NAME>The broadcast name, with --endpoint-id
-o, --output <PATH>The file to write (default: recording.mp4)
--format <FMT>fmp4 or mkv, overriding the extension of --output
--rendition <NAME>Record this video rendition only
--duration <SECONDS>Stop after this long. Omit to record until Ctrl+C
--max-age <MILLISECONDS>How long to wait for a stalled group before skipping it (default: 2000)

The extension picks the container: .mp4, .m4v, and .m4s are fragmented MP4, and .mkv and .webm are Matroska. Other extensions need --format. Both containers are fragmented, so a recording that was interrupted or killed plays up to the last fragment written.

Without --rendition, the file has one video track per rendition.

irl run

Runs a session from a TOML file: one endpoint that publishes several broadcasts, subscribes to others, and records any of them. Use it when several broadcasts must share one endpoint id. Separate irl publish and irl watch processes would each bind their own endpoint, and so print tickets with different endpoint ids.

irl run session.toml

The session opens no window. A [[recv]] block plays audio and can record.

# Optional. Keeps the endpoint id, and so the tickets, across runs. The key is
# stored at <config dir>/iroh-live/secret_keys/<name>.key.
secret_key_name = "studio"

[[send]]
name = "camera"              # broadcast name
video = "cam"                # the other keys are `irl publish` flags,
audio = "mic"                # with the same defaults
codec = "h264"
encoder = "auto"
renditions = ["low:320x180", "720p"]
bitrate = 3_000_000
width = 1280
height = 720
fps = 30
no_cursor = false
audio_codec = "opus"
audio_bitrate = 96_000

[[send]]
name = "screen"
video = "screen"
audio = "none"

[[recv]]
name = "friend"
ticket = "ilv1:..."         # as `irl publish` printed it
audio_output = "default"     # or "none"
record = "friend.mp4"        # optional, the extension picks the container
rendition = "low"            # optional, the rendition to record

A [[send]] block needs only name, and a [[recv]] block needs name and ticket. A [[send]] block with a file: video decodes it under reencode = true, or an encoding key such as renditions. An unknown key is an error.

A block that fails to start is reported, and the rest of the session runs. Ctrl+C ends the session and finishes every recording before the endpoint closes.

Without secret_key_name, the session reads its key from IROH_SECRET, as the other commands do. The keys of a [[send]] block are the flags of irl publish.

Examples

Publish the default camera and microphone:

irl publish

Publish the timing pattern and the beeps, without any devices:

irl publish --test-source

Photograph the publisher’s screen and the player together, and the difference between the two clocks is the latency. The marker is lit while each beep sounds, so A/V sync is visible too.

Publish a camera as a ladder of two renditions, captured at 60 frames per second:

irl publish --video cam:/dev/video0 --renditions low:320x180,720p@60

Publish an MP4 file as it is, looping, or re-encoded into a ladder:

irl publish --video file:recording.mp4:loop
irl publish --video file:recording.mp4 --reencode --renditions 720p,360p

Watch a broadcast:

irl watch <TICKET>

Wait for a call on one machine, and call it from another:

irl call
irl call <TICKET>

Open a room, and join it from two more machines:

irl room --display-name alice
irl room --display-name bob <TICKET>
irl room --display-name carol <TICKET>

Record ten seconds of a broadcast:

irl record <TICKET> -o clip.mp4 --duration 10

Environment variables

irl and the library read these variables. Files lists the files that irl writes. The media relay’s variables are in the iroh-live-relay reference.

VariableRead byEffect
IROH_SECRETirl, EndpointConfig::from_env(), the examples and demosThe endpoint’s secret key. Keeps the endpoint id, and so the tickets, across restarts
RUST_LOGirl, iroh-live-relay, the examplesThe log filter, see below

IROH_SECRET

The value is a secret key as 64 hex characters. Make one with:

export IROH_SECRET=$(openssl rand -hex 32)

Without it, every start makes a new key and so a new endpoint id. A value that is not a key fails with EndpointError::SecretKey. The key is a secret: whoever has it can act as this endpoint, and receive what peers send to it.

irl run takes secret_key_name in its session file instead, see irl run. An application can also keep its key in a file with iroh_live::load_or_create_secret_key(path).

RUST_LOG

RUST_LOG takes a tracing filter: a default level, and levels per crate or module, separated by commas. Without it, irl and the examples log only errors, and the media relay logs at info.

RUST_LOG=info irl publish
RUST_LOG=warn,iroh_live=debug irl watch <TICKET>

Useful filters:

To seeFilter
What irl does: capture rates, encoders, renditions, connectionsinfo
Sessions, admission and policy decisionsiroh_live_node=debug
Each link sample: round trip, loss, whether the path goes through an iroh relayiroh_live_node::link=trace
Why the player switched renditions, and playout delay changesmoq_ext_player=trace,moq_ext_adaptive=debug
Encoder start and failuremoq_ext_publisher=debug
Room membershipiroh_live_rooms=debug
iroh’s connectivity: hole punching, iroh relaysiroh=debug
MoQ sessions and subscriptionsmoq_net=debug

trace is verbose. Prefer it for one module, not as the default level.

Files

<config dir> is the platform’s config directory, such as ~/.config on Linux.

FileWritten byHolds
<config dir>/iroh-live/secret_keys/<name>.keyirl run with secret_key_nameA stored secret key, made on first use
<config dir>/iroh-live/portal/screen.token, window.tokenirl publish --video screen or window on LinuxThe desktop portal’s restore token, so a later run can skip the picker

On Unix, each file is readable by its user only.

On Android, the demo sends the same logs to logcat, see Use iroh-live on Android.