How to use the command `wf-recorder` (with examples)
- Linux
- December 17, 2024
wf-recorder
is a tool specifically designed for the Wayland display server protocol, allowing users to record their screen activities seamlessly. By providing features such as optional audio recording and customizable screencast areas, wf-recorder
is a versatile utility for creating video captures of your desktop environment. Whether you’re making tutorials, demonstrating software, or saving video calls, wf-recorder
can cater to those needs on Wayland systems.
Record storing to an MP4 file
Code:
wf-recorder --file=output.mp4
Motivation:
Recording your screen is a crucial task for various professional and personal reasons. Whether you’re creating a software demo, troubleshooting an issue, or saving an online seminar for later viewing, wf-recorder
provides a straightforward way to record your screen and store it directly into an MP4 file, a widely-used video format. This command captures the entire screen output and saves it to a specified file, making it easy to share or view later.
Explanation:
wf-recorder
: This is the command itself and serves as the entry point for accessing its numerous functionalities.--file=output.mp4
: This flag indicates that the output of the recording should be saved to a file namedoutput.mp4
. MP4 is a versatile video format that can be played on virtually any device or media player, which makes it perfect for general use.
Example Output:
After executing this command, the tool will initiate the recording process, capturing all activities on your screen. Once you’re done recording, you would typically end the process by pressing Ctrl-C, at which point the MP4 file output.mp4
will be available in your working directory, containing your screencast.
Record including audio, both with mic and system sounds
Code:
wf-recorder --audio --file=/path/to/file_with_audio.webm
Motivation:
In many instances, screen recordings are significantly enhanced by the inclusion of audio. Whether it’s narrating a tutorial, recording a video call, or capturing system sounds from a software demonstration, having voice and sound can drastically improve the effectiveness of the recording. wf-recorder
offers the option to include both microphone input and system sounds in the recording, ensuring that no pertinent information is lost.
Explanation:
wf-recorder
: As before, this is the primary command used to engage its recording capabilities.--audio
: This flag specifies that the recording should include audio input. By default, this will capture sounds captured by the system and microphone, allowing for comprehensive audio recording alongside the video.--file=/path/to/file_with_audio.webm
: Similar to the previous example, this argument directs the command to store the recording in the specified path asfile_with_audio.webm
. The WebM format is often used for high-quality media files intended for use on the web.
Example Output:
Once this command is executed and the recording session is concluded with Ctrl-C, you’ll find the file_with_audio.webm
in the specified directory. This file will contain both the visual screen activity and audio recording, presenting a complete multimedia experience suitable for a wide array of purposes.
Select and record a portion of the screen using slurp
Code:
wf-recorder -g "$(slurp)"
Motivation:
Sometimes, you need to focus on a specific part of your screen while recording. For instance, when highlighting features within a particular application or avoiding unnecessary elements on the screen, recording only a screen segment can greatly enhance clarity and viewer engagement. slurp
is a utility that works with wf-recorder
to facilitate this selective recording, offering precision in defining the area to be recorded.
Explanation:
wf-recorder
: The main command, initiating the recording process.-g "$(slurp)"
: The-g
flag is used to specify the geometry of the recording area.$(slurp)
is a sub-command execution whereslurp
, a separate utility, is employed to visually select the area on the screen to be recorded. The coordinates and size of the selected portion are then passed towf-recorder
to limit the recording scope.
Example Output:
When the command runs, you’ll be prompted to use your cursor and designate a section of your screen as the recording area. Once defined and the process is stopped using Ctrl-C, the default recording.mp4
file is generated, containing just the activity of the chosen portion of the screen.
Conclusion:
wf-recorder
is a powerful and flexible tool tailored for the Wayland environment, making screen and audio recording tasks straightforward and efficient. With its capability to output to popular formats, include audio, and even focus on specific screen areas with the help of slurp
, it provides users with the comprehensive features needed for various recording scenarios. Ensuring your recordings are exactly how you intend them to be is simple and effective with wf-recorder
.