Ubuntu – How to change audio output to HDMI from command line

command linehdmilaptopsound


This thread suggests pacmd list-sinks and switching to a different sink with pacmd set-default-sink "SINKNAME", but my laptop only appears to have 1 sink, so that didn't help me.

This thread suggests pacmd list-cards which shows hdmi-output-0: HDMI / DisplayPort right at the bottom of the output, and that looks right, but it still says Failure: No such entity when I run pactl set-card-profile 0 output:hdmi-output or pactl set-card-profile 0 output:hdmi-output-0

Best Answer

The OP posted the solution in his question:

While writing this I found the solution:

This command makes it easier to see what my actual output options are:

pacmd list-cards | grep output\:

That way of looking at the output of pacmd list-cards made me realize that the actual wording for my output is not output:hdmi-output but instead output:hdmi-stereo

This command is what worked for me:

pactl set-card-profile 0 output:hdmi-stereo

This is how I switched back to my laptop's internal speakers:

pactl set-card-profile 0 output:analog-stereo

This is how I changed the volume via command line:

amixer -D pulse sset Master 50%

This is just a smiley face:

Related Question