LinuxCommandLibrary

pw-record

Record audio from PipeWire

TLDR

View documentation for the original command

$ tldr pw-cat
copy

SYNOPSIS

pw-record [OPTIONS] [FILE]

PARAMETERS

-m, --media-type <TYPE>
    Specifies the media type to record (e.g., 'audio', 'video').

-p, --properties <PROPS>
    Sets PipeWire properties for the recording client, e.g., 'media.role=foo'.

-d, --disconnect
    Automatically disconnects and exits when the recording source becomes idle or disappears.

-r, --rate <RATE>
    Sets the sample rate for audio recording (e.g., 48000 for 48kHz).

-c, --channels <CHANNELS>
    Sets the number of audio channels (e.g., 1 for mono, 2 for stereo).

-f, --format <FORMAT>
    Specifies the sample format (e.g., 's16' for 16-bit signed int, 'f32' for 32-bit float).

-v, --volume <VOLUME>
    Sets the recording volume level (0.0 to 1.0).

-P, --port <PORT_NAME>
    Connects to a specific PipeWire port by its name.

--target <NODE_ID>
    Connects to a specific PipeWire node by its ID for recording. Use pw-cli inspect to find IDs.

--duration <SECONDS>
    Specifies the maximum recording duration in seconds.

--latency <LATENCY>
    Sets the desired PipeWire processing latency.

-L, --record-latency <LATENCY>
    Sets the buffering latency for the recording stream.

--record-buffer <SIZE>
    Sets the size of the internal recording buffer.

--quality <QUALITY>
    Sets the encoding quality for lossy formats (0-100).

--device <NODE_ID>
    Alias for --target, specifying the device node ID to record from.

--remote <NAME>
    Connects to a PipeWire remote instance by its name.

--help
    Displays the help message and exits.

--version
    Displays version information and exits.

DESCRIPTION

pw-record is a command-line utility provided by the PipeWire project, designed for recording audio and/or video data directly from PipeWire streams. It acts as a client to the PipeWire daemon, connecting to specified sources or sinks within the PipeWire graph and capturing their media output to a file. This tool is valuable for various tasks, including testing PipeWire setups, capturing application audio/video output, or performing basic, ad-hoc media recordings.

It supports recording different media types (audio, video) and allows users to specify various parameters such as sample rate, number of channels, sample format, and recording duration. The actual output file format support depends on the underlying FFmpeg libraries that PipeWire is linked against, enabling popular formats like WAV, FLAC, Ogg, or even MP3/WebM if respective codecs are available. pw-record offers a straightforward way to interact with the PipeWire multimedia framework for capture operations.

CAVEATS

pw-record requires a running PipeWire daemon. Its ability to record specific media types and output file formats is dependent on how PipeWire was compiled and what FFmpeg libraries (and their codecs) are available on the system. Identifying the correct PipeWire node or port IDs for advanced recording scenarios often requires prior inspection using tools like pw-cli inspect or pw-top, which can make initial usage less intuitive for complex setups. It's primarily designed for basic recording tasks; for advanced audio/video processing or streaming, other PipeWire-integrated tools or applications might be more suitable.

FILE FORMAT AND CODEC SUPPORT

The specific audio and video file formats (e.g., WAV, FLAC, Ogg Vorbis, MP3, WebM) that pw-record can produce are determined by the FFmpeg libraries that PipeWire was compiled against. Availability of certain codecs (like MP3) depends on the system's FFmpeg installation and licensing considerations. If a desired format/codec is not supported, an error may occur, or a fallback format might be used.

TARGETING SPECIFIC STREAMS

To record from a particular application's output or a specific input device, users often need to identify its corresponding PipeWire node ID or port name. This can be done using pw-cli inspect or pw-top. Once identified, the --target (or --device) option with the node ID or --port with the port name can be used to direct pw-record to the correct source.

HISTORY

pw-record is an integral part of the PipeWire project, which emerged as a modern multimedia framework for Linux, aiming to unify and replace functionalities previously handled by separate servers like PulseAudio (for audio) and JACK (for pro-audio and video). Developed to provide a straightforward command-line interface for capturing media streams, pw-record allows users to interact with PipeWire's graph-based architecture directly. While it offers basic recording capabilities, its role is often complemented or, for simpler tasks, superseded by pw-cat, a more versatile PipeWire command-line utility capable of both playing and recording, thus simplifying the toolset for common media operations within the PipeWire ecosystem.

SEE ALSO

pw-play(1), pw-cat(1), pw-cli(1), pw-top(1), pipewire(1), ffmpeg(1)

Copied to clipboard