Audio and visual output

Raspberry Pi OS supports multiple audio output and display modes. This section summarises how to configure audio and display settings on your Raspberry Pi, including how to:

Change audio output

Raspberry Pi OS supports multiple audio output modes that you can choose from: HDMI, the 3.5 mm headphone jack (if your device has one), and USB audio devices. By default, your Raspberry Pi outputs audio to the first HDMI device. If no HDMI device is detected, it automatically routes audio to the headphone jack or a connected USB device. You can change where audio is played from the desktop GUI or from the command line.

Desktop

The audio output selector on your Raspberry Pi desktop allows you to choose between multiple audio devices connected to your Raspberry Pi. On newer Raspberry Pi devices, this can include audio through one of the HDMI ports or USB ports.

If you’ve connected an audio device through the jack on the back of a Raspberry Pi monitor, it still appears as HDMI in the list because the monitor is attached to the HDMI port on your Raspberry Pi.

To change the audio output destination through the desktop:

  1. Right-click the volume icon in the top-right corner of the system tray on your desktop. This opens the audio output selector.

  2. Select the audio output of the device that you want to use.

CLI
  1. List your audio devices. Open the Terminal on your Raspberry Pi and then run the following command:

    $ wpctl status
  2. Identify the target 'sink'. Look for a section labelled Sinks, which provides a list of available audio output devices. Each device has a numerical ID. The default is indicated by an asterisk (*).

  3. Change the default option. To switch to a different device run the following command, replacing <ID> with the number you identified in the previous step:

    $ wpctl set-default <ID>
  4. Verify the change. Run the status command again and check that there is an asterisk (*) next to your chosen device.

    $ wpctl status

Choose audio device profile

A device profile defines how an audio device is configured and what capabilities it exposes. Different profiles are optimised for different use cases. You can choose the device profile from the desktop and, on newer Raspberry Pi devices, from the command line.

Desktop
  1. Right-click the volume icon in the top-right corner of the system tray on your desktop.

  2. Select Device Profiles.

  3. Choose from one of the following options:

    • Off. Turns off audio output for the Raspberry Pi.

    • Digital Stereo. Outputs standard two-channel (left and right) audio. This is the default profile and works with most speakers, headphones, and monitors.

    • Pro Audio. Exposes the maximum number of channels across every audio device, allowing greater control over signal routing. We don’t recommend choosing this device profile unless you require fine-tuned control over audio output.

CLI

Newer versions of Raspberry Pi allow you to manage device profiles using pactl commands. To use pactl, you must first install pulseaudio. Then, to change the device profile through the command line:

  1. List your audio cards. Open the Terminal on your Raspberry Pi and then run the following command to list your audio devices:

    $ pactl list cards
  2. Identify your card and active profile. Search the output for your target audio device (card). The audio device is typically one you already have active on your Raspberry Pi and the ID is typically a short number. Check the ID for the profile that isn’t set to Active Profile: off.

  3. View available profiles. Under Profiles for the target audio device in the output, look for options such as off, output:hdmi-stereo, and pro-audio.

  4. Set the new profile. Set the device profile for that audio device using the following syntax, replacing <CARD_ID> and <PROFILE_NAME>: pactl set-card-profile <CARD_ID> <PROFILE_NAME>.

    For example:

    $ pactl set-card-profile 48 output:hdmi-stereo
  5. Verify the change. Verify that it worked by listing the audio devices again:

    $ pactl list cards

Configure display settings

With most HDMI monitors, Raspberry Pi OS uses the highest resolution and refresh rate supported by your Raspberry Pi and your monitor. Connect the cables before turning on your Raspberry Pi.

Table 1. Display capabilities of Raspberry Pi models
Models HDMI type Cable adapter Max displays Max resolution

Raspberry Pi Zero, Zero W, and Zero 2 W

Mini HDMI

Requires a mini-HDMI-to-HDMI cable or adapter

1

Depends on the display; usually up to 1920 x 1080 pixels

Raspberry Pi 4B and 400, and Compute Module 4

Dual micro HDMI

Requires a micro-HDMI-to-HDMI cable or adapter for each display you want to attach

2 (except CM4S)

Two 4K at 30 Hz or one 4K at 60 Hz

Raspberry Pi 5, 500, and 500+, and Compute Module 5

Dual micro HDMI

Requires a micro-HDMI-to-HDMI cable or adapter for each display you want to attach

2

Two 4K at 60 Hz

Raspberry Pi 4B, 400, and Compute Module 4, support either:

  • Two displays with resolution up to 3840 × 2160 pixels (4K; Ultra HD) at a 30 Hz refresh rate, or resolution up to 1920 × 1080 pixels (Full HD) at a 60 Hz refresh rate.

  • The display connected the HDMI0 port can support a resolution up to 3840 × 2160 pixels (4K; Ultra HD) at a 60 Hz refresh rate if you set the hdmi_enable_4kp60=1 flag in /boot/firmware/config.txt; the second display still supports a resolution up to 3840 × 2160 pixels (4K; Ultra HD) at a 30 Hz refresh rate or 1920 × 1080 pixels (Full HD) at a 60 Hz refresh rate.

Raspberry Pi 5, 500, 500+, and Compute Module 5 support two displays with resolution up to 3840 × 2160 pixels (4K; Ultra HD) at a 60 Hz refresh rate with no additional configuration. You can adjust your display resolution and screen orientation through the desktop and through the console.

Raspberry Pi OS Bookworm was the final version to support raindrop or arandr to configure display behaviours.

The command line instructions apply specifically to Raspberry Pi OS Lite or systems operating without a graphical desktop environment. If you’re using a desktop GUI, follow the desktop instructions instead.

On systems without a desktop environment (running in console mode), display settings must be configured manually. Recent Raspberry Pi OS versions allow you to use Kernel Mode Setting (KMS) to configure display settings. This is done by adding the video= parameter to your kernel command line file (cmdline.txt). For more information about this file, see Configure the kernel command line.

Desktop
  1. Select the Raspberry Pi icon in the top-left corner of the system tray and then go to Preferences > Control Centre.

  2. Open the Screens tab in the left-side menu.

  3. Select the screen that you want to configure by one of the following methods:

    • Right-click the box representing the screen that you want to configure.

    • Open the Screens dropdown menu and select the screen you want to configure.

  4. Choose one of the following properties to configure:

    • Resolution. Choose a screen resolution (for example, 1920 × 1080).

    • Frequency. Choose a refresh rate (for example, 60 Hz).

    • Orientation. Choose between Normal, Left, Inverted, and Right.

    • Scaling. Choose between 1.0, 1.5, 2.0, and 3.0 times the scale of the original screen.

  5. Select Apply in the bottom-right corner of the Control Centre. Your changes are displayed for 10 seconds and you’re asked to confirm that the changes are correct before continuing.

  6. To confirm your changes, select OK. If you don’t confirm the changes, the screen reverts back to its previous setting.

CLI (basic resolution)

Use the following format to specify the display, resolution, and refresh rate, replacing <display> with the display port, <width>x<height with the screen resolution, and <refresh_rate> with the refresh rate in Hz:

$ video=<display>:<width>x<height>M@<refresh_rate>

For example, video=HDMI-A-1:1920x1080M@60 translates to: use the HDMI-A-1 display at 1920 by 1080 resolution with a 60 Hz refresh rate.

If you don’t specify a resolution, your Raspberry Pi tries to guess it based on your monitor’s Extended Display Identification Data (EDID). It automatically chooses the best resolution supported by your display based on information in the Linux kernel.

Your display port can be any of the following:

  • HDMI-A-1: The first HDMI display output (often called HDMI 1 in software). On a Raspberry Pi 4B and 5, this corresponds to the HDMI port labelled HDMI0 on the board silkscreen; on single-HDMI models, this corresponds to the HDMI port labelled HDMI.

  • HDMI-A-2: The second HDMI display output (often called HDMI 2 in software). On a Raspberry Pi 4B and 5, this corresponds to the HDMI port labelled HDMI1 on the board silkscreen.

  • DSI-1: DSI or DPI.

  • Composite-1: Composite.

CLI (rotation and reflection)

Rotation and reflection parameters must be explicitly specified by extending the basic resolution configuration with additional parameters, which follow standard Linux framebuffer options.

Add the following to your basic resolution configuration:

  • rotate=<number>, replacing <number> with a rotation angle in degrees (for example, 90 degrees) to rotate the display output. All connected displays share the same rotation settings.

  • reflect_<axis> replacing <axis> with x, y, or xy to mirror the display horizontally, vertically, or both.

    For example, video=HDMI-A-1:1920x1080M@60,rotate=90,reflect_x translates to: use the HDMI-A-1 display at 1920 by 1080 resolution with a 60 Hz refresh rate, rotated 90 degrees and horizontally mirrored.

    When using console mode with multiple displays, all connected displays share the same rotation settings.

Configure screen blanking

You can configure your Raspberry Pi to blank the screen after a period of inactivity. When screen blanking is enabled, Raspberry Pi OS defaults to blanking the screen after ten minutes (600 seconds) of inactivity.

You can configure screen blanking through the desktop GUI, using the raspi-config TUI, and from the command line. After enabling screen blanking you can optionally modify the inactivity timeout by editing a configuration file.

Desktop
  1. Select the Raspberry Pi icon in the top-left corner of the system tray and go to Preferences > Control Centre.

  2. Open the Display tab in the left-side menu.

  3. Use the toggle to turn Screen Blanking on or off.

    When you turn on Screen Blanking using the toggle, an autostart file is created in /home/<username>/.config/labwc/. The inactivity period defaults to 10 minutes (600 seconds) and you can edit this file to change the timeout, as described below.

  4. Select Close in the bottom-right corner of the Control Centre.

raspi-config
  1. Open the Terminal and run sudo raspi-config.

  2. Use the keyboard to navigate to and select 2 Display Options > D2 Screen Blanking.

  3. Select Yes or No in response to the question Would you like to enable screen blanking?

  4. Select <OK> and then <Finish> when you’re done.

CLI

You can control screen blanking from the command line using the consoleblank kernel parameter.

Unlike the screen blanking setting modified by the Control Centre and raspi-config, which only affects desktop sessions, the consoleblank parameter applies when your Raspberry Pi is running with a monitor and keyboard in a text-only terminal session. By setting consoleblank in the kernel command line, you can specify how long the console waits before turning off the screen.

  1. Use the following command to open /boot/firmware/cmdline.txt in a text editor as an administrator:

    $ sudo nano /boot/firmware/cmdline.txt
  2. Set the number of seconds before Raspberry Pi OS blanks the console. All parameters must remain on a single line. You can:

    • Set how many seconds of inactivity before the screen blanks. For example, adding consoleblank=600 blanks the screen after 600 seconds (10 minutes) of inactivity.

    • Add consoleblank=0 to never blank the screen.

  3. Use the following command to reboot the Raspberry Pi so that the changes take effect:

    $ sudo reboot

    After reboot, the console blanking timeout follows your new setting.

    You can display the current console blank time (in seconds) with the following command:

    $ cat /sys/module/kernel/parameters/consoleblank

Change the screen blanking timeout

You can change the screen blanking timeout by editing the autostart file in /home/<username>/.config/labwc:

  1. In a text editor, open /home/<username>/.config/labwc/autostart, replacing <username> with your actual username.

  2. Edit timeout 600 to the appropriate timeout in seconds (for example, timeout=300 for 5 minutes). The minimmum timeout is one second.

  3. Save the file and exit the editor.

  4. Reboot your Raspberry Pi for the change to take effect.

If your monitor immediately wakes back up after blanking (displaying "NO SIGNAL" and then returning), append vc4.force_hotplug=1 to the single line in /boot/firmware/cmdline.txt to prevent spurious hotplug wakeups.

Turn a display on or off in Wayland

On Wayland desktop sessions, you can turn an attached display on or off directly using wlr-randr:

+ . Connect to the device using SSH. . Run the following commands to turn off the display connected to HDMI0:

+

$ export WAYLAND_DISPLAY=wayland-1
$ wlr-randr --output HDMI-A-1 --off
  1. Run the following commands to turn the display on again:

    $ export WAYLAND_DISPLAY=wayland-1
    $ wlr-randr --output HDMI-A-1 --on

Configure cursor visibility

There is no global setting to change cursor visibility, but graphical applications running on Wayland can hide the cursor programmatically within their own windows (for example, in Pygame through pygame.mouse.set_visible(0)).

Configure video output

For flagship models of Raspberry Pi, you can use the interactive raspi-config TUI to configure video output to be composite video or HDMI. Enabling composite video output disables HDMI output for all models except Raspberry Pi 5. To enable or disable composite video output using the interactive raspi-config TUI:

  1. Open the Terminal and run sudo raspi-config.

  2. Use the keyboard to navigate to and select 2 Display Options > D4 Composite.

  3. Select Yes or No in response to the question Would you like composite video output to be enabled?

  4. Select <OK> to confirm this choice.

  5. Select <Finish> when you’re done.

  6. Reboot your Raspberry Pi for the change to take effect.

Configure onscreen keyboard

You can configure your Raspberry Pi to show an onscreen keyboard and choose which screen this keyboard is displayed on through the desktop GUI and using the interactive raspi-config TUI. In the raspi-config TUI, the following settings are configured separately:

  • Go to D6 Onscreen Keyboard to enable or disable the onscreen keyboard.

  • Go to D7 Keyboard to specify which screen the onscreen keyboard is displayed on.

Desktop
  1. Select the Raspberry Pi icon in the top-left corner of the system tray and then go to Preferences > Control Centre.

  2. Open the Display tab in the left-side menu.

  3. Choose one of the following options from the On-screen keyboard dropdown menu:

    • Enabled always, which means the keyboard is always onscreen.

    • Enabled if touchscreen found, which means the keyboard is onscreen when a touchscreen is attached to your Raspberry Pi.

    • Disabled, which means the keyboard isn’t on screen.

  4. If you have more than one screen attached to your Raspberry Pi, choose a screen to display your keyboard on from the On-Screen Keyboard Location dropdown menu.

  5. Select Close in the bottom-right corner of the Control Centre.

raspi-config (enable or disable)
  1. Open the Terminal and run sudo raspi-config.

  2. Use the keyboard to navigate to and select 2 Display Options > D6 Onscreen Keyboard.

  3. Choose between one of the following options:

    • S1 Always On, which means the keyboard is always on screen.

    • S2 Autodetect, which means the keyboard is on screen when a touchscreen is attached to your Raspberry Pi.

    • S3 Always Off, which means the keyboard isn’t on screen.

  4. Select <OK> and then <OK> again to confirm your choice.

  5. Select <Finish> when you’re done.

raspi-config (specify screen)
  1. Open the Terminal and run sudo raspi-config.

  2. Use the keyboard to navigate to and select 2 Display Options > D6 Onscreen Keyboard.

  3. Choose the display on which you want your keyboard to appear.

  4. Select <OK> and then <OK> again to confirm your choice.

  5. Select <Finish> when you’re done.