Skip to content

Unable to get HDMI Output with ALSA on rasberry pi 3B. #1828

Closed

Description

@aditya-gitte

What happened?

  • I am trying to get the output through the HDMI Port because that is the only type of input my soundbar supports. I have installed Shariport-sync using apt on rasbian os lite on RP3B.
    To check the name of the output port I ran shairport-sync -h which produces this output
Usage: shairport-sync [options...]
  or:  shairport-sync [options...] -- [audio output-specific options]

Options:
    -h, --help              show this help.
    -d, --daemon            daemonise.
    -j, --justDaemoniseNoPIDFile            daemonise without a PID file.
    -k, --kill              kill the existing shairport daemon.
    -V, --version           show version information.
    -c, --configfile=FILE   read configuration settings from FILE. Default is /etc/shairport-sync.conf.

The following general options are for backward compatibility. These and all new options have settings in the configuration file, by default /etc/shairport-sync.conf:
    -v, --verbose           -v print debug information; -vv more; -vvv lots.
    -p, --port=PORT         set RTSP listening port.
    -a, --name=NAME         set advertised name.
    -L, --latency=FRAMES    [Deprecated] Set the latency for audio sent from an unknown device.
                            The default is to set it automatically.
    -S, --stuffing=MODE set how to adjust current latency to match desired latency, where 
                            "basic" inserts or deletes audio frames from packet frames with low processor overhead, and 
                            "soxr" uses libsoxr to minimally resample packet frames -- moderate processor overhead.
                            "soxr" option only available if built with soxr support.
    -B, --on-start=PROGRAM  run PROGRAM when playback is about to begin.
    -E, --on-stop=PROGRAM   run PROGRAM when playback has ended.
                            For -B and -E options, specify the full path to the program, e.g. /usr/bin/logger.
                            Executable scripts work, but must have the appropriate shebang (#!/bin/sh) in the headline.
    -w, --wait-cmd          wait until the -B or -E programs finish before continuing.
    -o, --output=BACKEND    select audio output method.
    -m, --mdns=BACKEND      force the use of BACKEND to advertize the service.
                            if no mdns provider is specified,
                            shairport tries them all until one works.
    -r, --resync=THRESHOLD  [Deprecated] resync if error exceeds this number of frames. Set to 0 to stop resyncing.
    -t, --timeout=SECONDS   go back to idle mode from play mode after a break in communications of this many seconds (default 120). Set to 0 never to exit play mode.
    --statistics            print some interesting statistics -- output to the logfile if running as a daemon.
    --tolerance=TOLERANCE   [Deprecated] allow a synchronization error of TOLERANCE frames (default 88) before trying to correct it.
    --password=PASSWORD     require PASSWORD to connect. Default is not to require a password.
    --logOutputLevel        log the output level setting -- useful for setting maximum volume.
    -M, --metadata-enable   ask for metadata from the source and process it.
    --metadata-pipename=PIPE send metadata to PIPE, e.g. --metadata-pipename=/tmp/shairport-sync-metadata.
                            The default is /tmp/shairport-sync-metadata.
    -g, --get-coverart      send cover art through the metadata pipe.
    -u, --use-stderr        log messages through STDERR rather than the system log.

Available mDNS backends: 
    avahi

Available audio backends:
    alsa (default)
    pa
    jack
    pipe
    stdout
    dummy

Settings and options for the audio backend "alsa":
    -d output-device    set the output device, default is "default".
    -c mixer-control    set the mixer control name, default is to use no mixer.
    -m mixer-device     set the mixer device, default is the output device.
    -i mixer-index      set the mixer index, default is 0.
    hardware output devices:
      "hw:Headphones"
      "hw:vc4hdmi"

There are no settings or options for the audio backend "pa".

There are no settings or options for the audio backend "jack".

Settings and options for the audio backend "pipe":
    specify the pathname of the pipe to write to.

There are no settings or options for the audio backend "stdout".

There are no settings or options for the audio backend "dummy".
  • The required output is hw:vc4hdmi. So I went to the config file (/etc/shairport-sync.conf) and updated this info there along with the name of the speaker

// General Settings
general =
{
        name = "Kitchen"; // This means "Hostname" -- see below. This is the name the service will advertise to iTunes.
}
alsa = 
{
        output_device = "hw:vc4hdmi";
}
  • Next I when I connect to the device and try to play using airplay no sound is played. Here are the logs that shairport-sync -v shows
shairport-sync -v
         0.002857130 "shairport.c:1729" Started!
         0.000145721 "shairport.c:1756" software version: "3.3.7-libdaemon-OpenSSL-Avahi-ALSA-jack-pa-dummy-stdout-pipe-soxr-convolution-metadata-mqtt-dbus-mpris-sysconfdir:/etc"
         0.000025415 "shairport.c:1762" log verbosity is 1.
         0.000049373 "audio_alsa.c:1015" alsa: alsa_maximum_stall_time of 0.200000 sec.
         0.000056194 "audio_alsa.c:1299" alsa: disable_standby_mode is "never".
         0.000018697 "audio_alsa.c:1303" alsa: disable_standby_mode_silence_threshold is 0.040000 seconds.
         0.000020780 "audio_alsa.c:1305" alsa: disable_standby_mode_silence_scan_interval is 0.004000 seconds.
         0.000021197 "audio_alsa.c:1345" alsa: output device name is "hw:vc4hdmi".
         0.000232591 "shairport.c:1810" disable resend requests is off.
         0.000025780 "shairport.c:1811" diagnostic_drop_packet_fraction is 0.000000. A value of 0.0 means no packets will be dropped deliberately.
         0.000022238 "shairport.c:1815" statistics_requester status is 0.
         0.000018228 "shairport.c:1817" daemon status is 0.
         0.000019270 "shairport.c:1818" daemon pid file path is "/run/shairport-sync/shairport-sync.pid".
         0.000018332 "shairport.c:1820" rtsp listening port is 5000.
         0.000018020 "shairport.c:1821" udp base port is 6001.
         0.000017395 "shairport.c:1822" udp port range is 10.
         0.000017187 "shairport.c:1823" player name is "Kitchen".
         0.000017342 "shairport.c:1824" backend is "alsa".
         0.000017187 "shairport.c:1825" run_this_before_play_begins action is "(null)".
         0.000018072 "shairport.c:1826" run_this_after_play_ends action is "(null)".
         0.000017863 "shairport.c:1827" wait-cmd status is 0.
         0.000017447 "shairport.c:1828" run_this_before_play_begins may return output is 0.
         0.000018072 "shairport.c:1829" run_this_if_an_unfixable_error_is_detected action is "(null)".
         0.000018333 "shairport.c:1830" run_this_before_entering_active_state action is  "(null)".
         0.000017915 "shairport.c:1831" run_this_after_exiting_active_state action is  "(null)".
         0.000018020 "shairport.c:1832" active_state_timeout is  10.000000 seconds.
         0.000022030 "shairport.c:1833" mdns backend "(null)".
         0.000017343 "shairport.c:1835" interpolation setting is "auto".
         0.000017915 "shairport.c:1838" interpolation soxr_delay_threshold is 30.
         0.000017656 "shairport.c:1839" resync time is 0.050000 seconds.
         0.000018540 "shairport.c:1840" allow a session to be interrupted: 0.
         0.000017551 "shairport.c:1841" busy timeout time is 120.
         0.000017343 "shairport.c:1842" drift tolerance is 0.001995 seconds.
         0.000018801 "shairport.c:1843" password is "(null)".
         0.000016874 "shairport.c:1844" ignore_volume_control is 0.
         0.000017760 "shairport.c:1848" volume_max_db is not set
         0.000017342 "shairport.c:1849" volume range in dB (zero means use the range specified by the mixer): 0.
         0.000018958 "shairport.c:1851" volume_range_combined_hardware_priority (1 means hardware mixer attenuation is used first) is 0.
         0.000018644 "shairport.c:1855" playback_mode is 0 (0-stereo, 1-mono, 1-reverse_stereo, 2-both_left, 3-both_right).
         0.000018906 "shairport.c:1857" disable_synchronization is 0.
         0.000017342 "shairport.c:1858" use_mmap_if_available is 1.
         0.000017395 "shairport.c:1859" output_format automatic selection is enabled.
         0.000018176 "shairport.c:1863" output_rate automatic selection is enabled.
         0.000018176 "shairport.c:1867" audio backend desired buffer length is 0.200000 seconds.
         0.000019270 "shairport.c:1869" audio_backend_buffer_interpolation_threshold_in_seconds is 0.120000 seconds.
         0.000020155 "shairport.c:1871" audio backend latency offset is 0.000000 seconds.
         0.000018957 "shairport.c:1873" audio backend silence lead-in time is "auto".
         0.000017135 "shairport.c:1877" zeroconf regtype is "_raop._tcp".
         0.000017499 "shairport.c:1878" decoders_supported field is 1.
         0.000017395 "shairport.c:1879" use_apple_decoder is 0.
         0.000017082 "shairport.c:1880" alsa_use_hardware_mute is 0.
         0.000017499 "shairport.c:1884" no special mdns service interface was requested.
         0.000050362 "shairport.c:1887" configuration file name "/etc/shairport-sync.conf" resolves to "/etc/shairport-sync.conf".
         0.000022030 "shairport.c:1894" metadata enabled is 1.
         0.000017863 "shairport.c:1895" metadata pipename is "/tmp/shairport-sync-metadata".
         0.000018645 "shairport.c:1896" metadata socket address is "(null)" port 0.
         0.000018385 "shairport.c:1898" metadata socket packet size is "500".
         0.000017707 "shairport.c:1899" get-coverart is 1.
         0.000017239 "shairport.c:1902" mqtt is disabled.
         0.000017134 "shairport.c:1903" mqtt hostname is (null), port is 1883.
         0.000018072 "shairport.c:1904" mqtt topic is /Kitchen.
         0.000017134 "shairport.c:1905" mqtt will not publish raw metadata.
         0.000017760 "shairport.c:1906" mqtt will not publish parsed metadata.
         0.000018020 "shairport.c:1907" mqtt will not publish cover Art.
         0.000017447 "shairport.c:1908" mqtt remote control is disabled.
         0.000017394 "shairport.c:1912" convolution is 0.
         0.000017083 "shairport.c:1913" convolution IR file is "(null)"
         0.000017707 "shairport.c:1914" convolution max length 8192
         0.000017343 "shairport.c:1915" convolution gain is 0.000000
         0.000018384 "shairport.c:1917" loudness is 0.
         0.000016874 "shairport.c:1918" loudness reference level is -20.000000
         0.000176761 "rtsp.c:1665" metadata pipe name is "/tmp/shairport-sync-metadata".
         0.013374036 "dbus-service.c:1053" *warning: could not acquire a Shairport Sync native D-Bus interface "org.gnome.ShairportSync.i4441" on the system bus.
         0.000613090 "mpris-service.c:348" *warning: could not acquire an MPRIS interface named "org.mpris.MediaPlayer2.ShairportSync.i4441" on the system bus.
         0.003696771 "mdns_avahi.c:375" avahi_dacp_monitor_start Avahi DACP monitor successfully started
         1.492173982 "shairport.c:200" "soxr" interpolation has been chosen.
        17.618914231 "rtsp.c:1057" Connection 1: SETUP DACP-ID "2CE75D2E91F786E0" from 2405:201:1007:30c8:740f:c238:9f7a:4959 to 2405:201:1007:30c8:90a9:4485:d212:31f9 with UDP ports Control: 6001, Timing: 6002 and Audio: 6003.
ALSA lib conf.c:1970:(_snd_config_load_with_include) _toplevel_:18:1:Unexpected char
ALSA lib conf.c:3817:(config_file_open) /home/adipi/.asoundrc may be old or corrupted: consider to remove or fix it
ALSA lib conf.c:3739:(snd_config_hooks_call) function snd_config_hook_load returned error: Invalid argument
ALSA lib conf.c:4203:(snd_config_update_r) hooks failed, removing configuration
         0.015487141 "audio_alsa.c:441" *warning: alsa: error -22 ("Invalid argument") opening alsa device "hw:vc4hdmi".
ALSA lib conf.c:1970:(_snd_config_load_with_include) _toplevel_:18:1:Unexpected char
ALSA lib conf.c:3817:(config_file_open) /home/adipi/.asoundrc may be old or corrupted: consider to remove or fix it
ALSA lib conf.c:3739:(snd_config_hooks_call) function snd_config_hook_load returned error: Invalid argument
ALSA lib conf.c:4203:(snd_config_update_r) hooks failed, removing configuration
  • Am I missing something here? I don't have any preference for audio backends, so if there is something that handles HDMI output, please do suggest. Thank you in advance

Relevant log output

No response

System Information.

Device: Raspberry Pi 3B (1GB RAM)
OS: Raspberry pi os lite 32 bit (headless)

Configuration Information.

uname: Linux raspberrypi 6.1.21-v7+ #1642 SMP Mon Apr  3 17:20:52 BST 2023 armv7l GNU/Linux
shairport-sync -V: 3.3.7-libdaemon-OpenSSL-Avahi-ALSA-jack-pa-dummy-stdout-pipe-soxr-convolution-metadata-mqtt-dbus-mpris-sysconfdir:/etc

PulseAudio or PipeWire installed?

  • Check if your system uses a Sound Server.

How did you install Shairport Sync?

A package manager (apt, apt install, yum, pkg, etc.)

Check previous issues

  • Confirm

Activity

  1. MRIO commented on Mar 25, 2024

    @MRIO

    Howdy! I was able to get it working by using in General Settings the long name of the output device that is listed in aplay -L

    output_device = "hdmi:CARD=vc4hdmi1,DEV=0"; 
    
  2. mikebrady commented on Mar 25, 2024

    @mikebrady
    Owner

    Howdy! I was able to get it working by using in General Settings the long name of the output device that is listed in aplay -L

    output_device = "hdmi:CARD=vc4hdmi1,DEV=0"; 
    

    Thanks for this @MRIO. I tried it on my own Raspberry Pi 3B and had to make two small modifications before it would work:

    1. On my system, the card address is"hdmi:CARD=vc4hdmi,DEV=0", slightly different to yours. For reference, the version of the operating systems is:
      $ uname -a
      Linux RaspberryPi3B 6.1.0-rpi8-rpi-v8 #1 SMP PREEMPT Debian 1:6.1.73-1+rpt1 (2024-01-25) aarch64 GNU/Linux
      
    2. For Shairport Sync to work, the HDMI output had to be connected to a HDMI system (in my case a TV) and that system had to be powered up.
      One other thing is that the HDMI receiving system must be capable of accepting audio at 44,100 frames per second.

    The version of Shairport Sync in use is 3.3.7, which is pretty ancient; many improvements and important updates have been made since, so it would be well worthwhile updating to the latest.

  3. MRIO commented on Mar 25, 2024

    @MRIO

    Hi @mikebrady,
    FYI, differently than OP I'm running 4.3.2, and I was having the no sound issue on a pi4:

    $ uname -a Linux raspberrypi 6.6.22-v8+ #1746 SMP PREEMPT Wed Mar 20 17:19:49 GMT 2024 aarch64 GNU/Linux

    $ shairport-sync -V 4.3.2-2-g165431a8-AirPlay2-smi10-OpenSSL-Avahi-ALSA-soxr-sysconfdir:/etc

    Keep up the amazing work!

  4. aditya-gitte commented on Mar 29, 2024

    @aditya-gitte
    Author

    Hi @mikebrady and @MRIO, the above solution does work for me as well. Thanks a lot and keep up the amazing work!

  5. rayduui commented on May 9, 2024

    @rayduui

    Howdy! I was able to get it working by using in General Settings the long name of the output device that is listed in aplay -L

    output_device = "hdmi:CARD=vc4hdmi1,DEV=0"; 
    

    Step 1 Run shairport-sync -h

    You should see result, copy the device with hdmi, for me it's hw:vc4hdmi

    
    Settings and options for the audio backend "alsa":
        -d output-device    set the output device, default is "default".
        -c mixer-control    set the mixer control name, default is to use no mixer.
        -m mixer-device     set the mixer device, default is the output device.
        -i mixer-index      set the mixer index, default is 0.
        hardware output devices:
          "hw:Headphones"
          "hw:vc4hdmi"
    

    Step 2 Edit /etc/shairport-sync.conf, so you have the output device from step 1 (exclude hw:)

    alsa = 
    {
            output_device = "hdmi:CARD=vc4hdmi,DEV=0"; 
    }
    

    Step 3 Restart the service

    systemctl restart shairport-sync

  6. noudrine commented on Feb 19, 2025

    @noudrine

    Hello,

    I followed all the steps.
    I have sound coming out in HDMI with the command aplay -D default:vc4hdmi -f dat /usr/share/sounds/alsa/Noise.wav
    but nothing with shairport-sync.

    4.3.7-AirPlay2-smi10-OpenSSL-Avahi-ALSA-pa-soxr-sysconfdir:/etc
    
    inux Airplay 6.1.21-v7+ #1642 SMP Mon Apr  3 17:20:52 BST 2023 armv7l GNU/Linux
    

    What say aplay -L:

    root@Airplay:/# aplay -L
    null
        Discard all samples (playback) or generate zero samples (capture)
    default
        Default Audio Device
    sysdefault
        Default Audio Device
    hw:CARD=vc4hdmi,DEV=0
        vc4-hdmi, MAI PCM i2s-hifi-0
        Direct hardware device without any conversions
    plughw:CARD=vc4hdmi,DEV=0
        vc4-hdmi, MAI PCM i2s-hifi-0
        Hardware device with all software conversions
    default:CARD=vc4hdmi
        vc4-hdmi, MAI PCM i2s-hifi-0
        Default Audio Device
    sysdefault:CARD=vc4hdmi
        vc4-hdmi, MAI PCM i2s-hifi-0
        Default Audio Device
    hdmi:CARD=vc4hdmi,DEV=0
        vc4-hdmi, MAI PCM i2s-hifi-0
        HDMI Audio Output
    dmix:CARD=vc4hdmi,DEV=0
        vc4-hdmi, MAI PCM i2s-hifi-0
        Direct sample mixing device
    

    and shairport-sync -h

    Available audio backends:
        alsa (default)
        pa
    
    Settings and options for the audio backend "alsa":
        -d output-device    set the output device, default is "default".
        -c mixer-control    set the mixer control name, default is to use no mixer.
        -m mixer-device     set the mixer device, default is the output device.
        -i mixer-index      set the mixer index, default is 0.
        hardware output devices:
          "hdmi:vc4hdmi"
    
    There are no settings or options for the audio backend "pa".
    
  7. mikebrady commented on Feb 19, 2025

    @mikebrady
    Owner

    Thanks for the post. Could you post the result of:

    $ shairport-sync --displayConfig
    

    please?

  8. noudrine commented on Feb 19, 2025

    @noudrine
    Feb 19 13:30:00 Airplay shairport-sync:          0.003141927 "shairport.c:2133" >> Display Config Start.
    Feb 19 13:30:01 Airplay shairport-sync:          0.008614948 "shairport.c:2133"
    Feb 19 13:30:01 Airplay shairport-sync:          0.000183281 "shairport.c:2133" From "uname -a":
    Feb 19 13:30:01 Airplay shairport-sync:          0.000070260 "shairport.c:2133"  Linux Airplay 6.1.21-v7+ #1642 SMP Mon Apr  3 17:20:52 BST 2023 armv7l GNU/Linux
    Feb 19 13:30:01 Airplay shairport-sync:          0.016929688 "shairport.c:2133"
    Feb 19 13:30:01 Airplay shairport-sync:          0.000198958 "shairport.c:2133" From /etc/os-release:
    Feb 19 13:30:01 Airplay shairport-sync:          0.000074844 "shairport.c:2133"  Raspbian GNU/Linux 11 (bullseye)
    Feb 19 13:30:01 Airplay shairport-sync:          0.011454375 "shairport.c:2133"
    Feb 19 13:30:01 Airplay shairport-sync:          0.000176875 "shairport.c:2133" From /sys/firmware/devicetree/base/model:
    Feb 19 13:30:01 Airplay shairport-sync:          0.000065990 "shairport.c:2133"  Raspberry Pi 2 Model B Rev 1.1
    Feb 19 13:30:01 Airplay shairport-sync:          0.000167083 "shairport.c:2133"
    Feb 19 13:30:01 Airplay shairport-sync:          0.000066562 "shairport.c:2133" Shairport Sync Version String:
    Feb 19 13:30:01 Airplay shairport-sync:          0.000060365 "shairport.c:2133"  4.3.7-AirPlay2-smi10-OpenSSL-Avahi-ALSA-pa-soxr-sysconfdir:/etc
    Feb 19 13:30:01 Airplay shairport-sync:          0.000062812 "shairport.c:2133"
    Feb 19 13:30:01 Airplay shairport-sync:          0.000058803 "shairport.c:2133" Command Line:
    Feb 19 13:30:01 Airplay shairport-sync:          0.000056197 "shairport.c:2133"  /usr/local/bin/shairport-sync -X
    Feb 19 13:30:01 Airplay shairport-sync:          0.000155573 "shairport.c:2133"
    Feb 19 13:30:01 Airplay shairport-sync:          0.000084584 "shairport.c:2133" Configuration File:
    Feb 19 13:30:01 Airplay shairport-sync:          0.000056979 "shairport.c:2133"  /etc/shairport-sync.conf
    Feb 19 13:30:01 Airplay shairport-sync:          0.000050000 "shairport.c:2133"
    Feb 19 13:30:01 Airplay shairport-sync:          0.000578958 "shairport.c:2133" Configuration File Settings:
    Feb 19 13:30:01 Airplay shairport-sync:          0.000102188 "shairport.c:2133"  pw :
    Feb 19 13:30:01 Airplay shairport-sync:          0.000056562 "shairport.c:2133"  {
    Feb 19 13:30:01 Airplay shairport-sync:          0.000051042 "shairport.c:2133"  };
    Feb 19 13:30:01 Airplay shairport-sync:          0.000050417 "shairport.c:2133"  diagnostics :
    Feb 19 13:30:01 Airplay shairport-sync:          0.000047656 "shairport.c:2133"  {
    Feb 19 13:30:01 Airplay shairport-sync:          0.000047864 "shairport.c:2133"    log_output_to = "syslog";
    Feb 19 13:30:01 Airplay shairport-sync:          0.000048855 "shairport.c:2133"    log_verbosity = 2;
    Feb 19 13:30:01 Airplay shairport-sync:          0.000049322 "shairport.c:2133"  };
    Feb 19 13:30:01 Airplay shairport-sync:          0.000051303 "shairport.c:2133"
    Feb 19 13:30:01 Airplay shairport-sync:          0.000052239 "shairport.c:2133" >> Display Config End.
    Feb 19 13:30:01 Airplay shairport-sync:          0.000052865 "shairport.c:2135" >> Goodbye!
    Feb 19 13:30:01 Airplay shairport-sync:          0.000081614 "shairport.c:1596" exit function called...
    Feb 19 13:30:01 Airplay shairport-sync:          0.000062969 "shairport.c:1606" Stopping the activity monitor.
    Feb 19 13:30:01 Airplay shairport-sync:          0.000047344 "shairport.c:1608" Stopping the activity monitor done.
    Feb 19 13:30:01 Airplay shairport-sync:          0.000075312 "shairport.c:1733" normal exit
    
  9. noudrine commented on Feb 19, 2025

    @noudrine

    I have do some other tests:

    $ speaker-test -c 2 -r 48000 -F S16_LE -D hdmi:CARD=vc4hdmi,DEV=0  # ==> working 
    
    $ speaker-test -c 2 -r 44100 -F S16_LE -D hdmi:CARD=vc4hdmi,DEV=0 # ==> not working
    
  10. mikebrady commented on Feb 20, 2025

    @mikebrady
    Owner

    Thanks for the updates, which are edited slightly for layout.

    Do you have a firewall running anywhere -- on the Pi itself or on your network? If you have, then perhaps you could temporarily disable it completely for testing.

    Then, could you try:

    $ shairport-sync -v --statistics
    

    please.

    Try to play something and wait for a minute or two. If you could post the results, it would be very useful.

    Ensure the AirPlay volume (on your iPhone, etc.) is raised and, in another terminal window, see if there is a mixer on the default output -- use alsamixer or similar to check. If so, ensure it's unmuted and turned up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions