1
Fork 0
pipewire/README.md

218 lines
6.9 KiB
Markdown
Raw Permalink Normal View History

# PipeWire
2020-06-19 14:41:42 +03:00
[PipeWire](https://pipewire.org) is a server and user space API to
deal with multimedia pipelines. This includes:
- Making available sources of video (such as from a capture devices or
application provided streams) and multiplexing this with
clients.
- Accessing sources of video for consumption.
- Generating graphs for audio and video processing.
Nodes in the graph can be implemented as separate processes,
communicating with sockets and exchanging multimedia content using fd
passing.
2020-05-01 21:29:40 +03:00
## Building and installation
2020-08-12 21:10:47 +03:00
The preferred way to install PipeWire is to install it with your
2020-05-01 21:29:40 +03:00
distribution package system. This ensures PipeWire is integrated
into the rest of your system for the best experience.
If you want to build and install PipeWire yourself, refer to
2020-06-11 22:18:32 +03:00
[install](INSTALL.md) for instructions.
2020-05-01 21:29:40 +03:00
## Usage
The most important purpose of PipeWire is to run your favorite apps.
2021-01-05 19:19:20 +02:00
Some applications use the native PipeWire API, such as most compositors
(gnome-shell, wayland, ...) to implement screen sharing. These apps will
just work automatically.
2020-05-01 21:29:40 +03:00
Most audio applications can use either ALSA, JACK or PulseAudio as a
backend. PipeWire provides support for all 3 backends. Depending on how
2020-06-23 01:56:54 +03:00
your distribution has configured things this should just work automatically
2020-05-01 21:29:40 +03:00
or with the provided scripts shown below.
PipeWire can use environment variables to control the behaviour of
applications:
* `PIPEWIRE_DEBUG=<level>` to increase the debug level (or use one of
`XEWIDT` for none, error, warnings, info,
debug, or trace, respectively).
2020-06-11 22:18:32 +03:00
* `PIPEWIRE_LOG=<filename>` to redirect log to filename
* `PIPEWIRE_LOG_SYSTEMD=false` to disable logging to systemd journal
2020-08-02 21:13:29 +03:00
* `PIPEWIRE_LATENCY=<num/denom>` to configure latency as a fraction. 10/1000
configures a 10ms latency. Usually this is
2020-09-18 21:53:06 +03:00
expressed as a fraction of the samplerate,
2020-08-02 21:13:29 +03:00
like 256/48000, which uses 256 samples at a
samplerate of 48KHz for a latency of 5.33ms.
This function does not attempt to configure
the samplerate.
* `PIPEWIRE_RATE=<num/denom>` to configure a rate for the graph.
* `PIPEWIRE_QUANTUM=<num/denom>` to configure latency as a fraction and a
samplerate. This function will force the graph samplerate to
`denom` and force the specified `num` as the buffer size.
* `PIPEWIRE_NODE=<id>` to request a link to the specified node. The
id can be a node.name or object.serial of the target node.
2020-05-01 21:29:40 +03:00
### Using tools
2020-06-11 22:18:32 +03:00
`pw-cat` can be used to play and record audio and midi. Use `pw-cat -h` to get
some more help. There are some aliases like `pw-play` and `pw-record` to make
2020-05-01 21:29:40 +03:00
things easier:
```
2020-05-01 21:29:40 +03:00
$ pw-play /home/wim/data/01.\ Firepower.wav
```
2020-05-01 21:29:40 +03:00
### Running JACK applications
2021-01-05 19:19:20 +02:00
Depending on how the system was configured, you can either run PipeWire and
2020-05-01 21:29:40 +03:00
JACK side-by-side or have PipeWire take over the functionality of JACK
completely.
In dual mode, JACK apps will by default use the JACK server. To direct a JACK
2020-06-11 22:18:32 +03:00
app to PipeWire, you can use the `pw-jack` script like this:
```
2020-05-02 11:16:03 +03:00
$ pw-jack <appname>
```
2020-06-11 22:18:32 +03:00
If you replaced JACK with PipeWire completely, `pw-jack` does not have any
2020-08-12 21:10:47 +03:00
effect and can be omitted.
2020-05-01 21:29:40 +03:00
2021-04-28 21:29:44 +03:00
JACK applications will automatically use the buffer-size chosen by the
2021-02-18 17:18:15 +02:00
server. You can force a maximum buffer size (latency) by setting the
`PIPEWIRE_LATENCY` environment variable like so:
```
PIPEWIRE_LATENCY=128/48000 jack_simple_client
```
Requests the `jack_simple_client` to run with a buffer of 128 or
less samples.
2020-05-01 21:29:40 +03:00
### Running PulseAudio applications
2020-11-27 18:16:57 +02:00
PipeWire can run a PulseAudio compatible replacement server. You can't
2021-01-05 19:19:20 +02:00
use both servers at the same time. Usually your package manager will
2020-11-27 18:16:57 +02:00
make the server conflict so that you can only install one or the
other.
2021-01-05 19:19:20 +02:00
PulseAudio applications still use the regular PulseAudio client
libraries and you don't need to do anything else than change the
2020-11-27 18:16:57 +02:00
server implementation.
2020-05-01 21:29:40 +03:00
2020-11-27 18:16:57 +02:00
A successful swap of the server can be verified by checking the
output of
2020-05-01 21:29:40 +03:00
```
2020-11-27 18:16:57 +02:00
pactl info
```
It should include the string:
```
...
Server Name: PulseAudio (on PipeWire 0.3.x)
...
2020-05-01 21:29:40 +03:00
```
2021-02-18 17:18:15 +02:00
You can use pavucontrol to change profiles and ports, change volumes
or redirect streams, just like with PulseAudio.
2020-05-01 21:29:40 +03:00
### Running ALSA applications
If the PipeWire alsa module is installed, it can be seen with
```
2020-05-01 21:29:40 +03:00
$ aplay -L
```
2020-05-01 21:29:40 +03:00
2021-01-05 19:19:20 +02:00
ALSA applications can then use the `pipewire:` device to use PipeWire
2020-05-01 21:29:40 +03:00
as the audio system.
### Running GStreamer applications
2020-06-11 22:18:32 +03:00
PipeWire includes 2 GStreamer elements called `pipewiresrc` and
2020-09-18 21:53:06 +03:00
`pipewiresink`. They can be used in pipelines such as this:
2020-05-01 21:29:40 +03:00
```
$ gst-launch-1.0 pipewiresrc ! videoconvert ! autovideosink
```
Or to play a beeping sound:
```
$ gst-launch-1.0 audiotestsrc ! pipewiresink
```
2021-01-05 19:19:20 +02:00
PipeWire provides a device monitor as well so that
2020-05-01 21:29:40 +03:00
```
$ gst-device-monitor-1.0
```
2021-01-05 19:19:20 +02:00
shows the PipeWire devices and applications like cheese will
2020-05-01 21:29:40 +03:00
automatically use the PipeWire video source when possible.
### Inspecting the PipeWire state
2021-05-09 16:29:59 +03:00
To inspect and manipulate the PipeWire graph via GUI, you can use [Helvum](https://gitlab.freedesktop.org/ryuukyu/helvum).
Alternatively, you can use use one of the excellent JACK tools, such as `Carla`,
2021-01-05 19:19:20 +02:00
`catia`, `qjackctl`, ...
2021-05-09 16:29:59 +03:00
However, you will not be able to see all features like the video
ports.
2020-05-01 21:29:40 +03:00
2020-06-11 22:18:32 +03:00
`pw-mon` dumps and monitors the state of the PipeWire daemon.
2020-05-01 21:29:40 +03:00
2020-09-18 21:53:06 +03:00
`pw-dot` can dump a graph of the pipeline, check out the help for
2020-05-01 21:29:40 +03:00
how to do this.
2021-02-18 17:18:15 +02:00
`pw-top` monitors the real-time status of the graph. This is handy to
find out what clients are running and how much DSP resources they
use.
`pw-dump` dumps the state of the PipeWire daemon in JSON format. This
can be used to find out the properties and parameters of the objects
in the PipeWire daemon.
2020-09-18 21:53:06 +03:00
There is a more complicated tool to inspect the state of the server
2021-04-21 17:40:56 +03:00
with `pw-cli`. This tool can be used interactively or it can execute
2020-05-01 21:29:40 +03:00
single commands like this to get the server information:
```
$ pw-cli info 0
```
2020-06-19 14:41:42 +03:00
## Documentation
2022-03-24 21:58:48 +02:00
Find tutorials and design documentation [here](doc/index.dox).
2020-06-19 14:41:42 +03:00
2020-11-27 18:16:57 +02:00
The (incomplete) autogenerated API docs are [here](https://docs.pipewire.org).
2020-06-19 14:41:42 +03:00
2021-02-17 15:02:27 +02:00
The Wiki can be found [here](https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/home)
2020-06-11 22:18:32 +03:00
## Contributing
2021-05-14 13:09:33 +03:00
PipeWire is Free Software and is developed in the open. It is mostly
licensed under the [MIT license](COPYING). Check [LICENSE](LICENSE) for
more details about the exceptions.
2020-06-11 22:18:32 +03:00
2020-06-12 08:40:28 +03:00
Contributors are encouraged to submit merge requests or file bugs on
[gitlab](https://gitlab.freedesktop.org/pipewire).
2020-06-11 22:18:32 +03:00
2021-05-26 16:48:13 +03:00
Join us on IRC at #pipewire on [OFTC](https://www.oftc.net/).
2020-06-11 22:18:32 +03:00
We adhere to the Contributor Covenant for our [code of conduct](CODE_OF_CONDUCT.md).
2021-02-03 11:34:07 +02:00
[Donate using Liberapay](https://liberapay.com/PipeWire/donate).
## Getting help
You can ask for help on the IRC channel (see above). You can also ask
questions by [raising](https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/new)
a gitlab issue.