You are not logged in.
My systemd service run smplayer and it output sound through device 0: ALC892 Analog but there is only HDMI connected to my computer. How can I set systemd config to play sound through HDMI?
[Unit]
Description=bot
After=syslog.target network.target sound.target
[Service]
Environment=DISPLAY=:0
Type=simple
User=myname
Group=users
ExecStart=/opt/bot/bot.sh
[Install]
WantedBy=default.target
$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC892 Analog [ALC892 Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 1: ALC892 Digital [ALC892 Digital]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 7: HDMI 1 [HDMI 1]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 8: HDMI 2 [HDMI 2]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 9: HDMI 3 [HDMI 3]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 10: HDMI 4 [HDMI 4]
Subdevices: 1/1
Subdevice #0: subdevice #0
Offline
systemd does many things, but sound config is not one of them.
I'd like to know what alsa sees as default output device, pleas post aplay --list-pcms
Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.
clean chroot building not flexible enough ?
Try clean chroot manager by graysky
Offline
pleas post aplay --list-pcms
$ aplay --list-pcms
null
Discard all samples (playback) or generate zero samples (capture)
samplerate
Rate Converter Plugin Using Samplerate Library
speexrate
Rate Converter Plugin Using Speex Resampler
jack
JACK Audio Connection Kit
oss
Open Sound System
pipewire
PipeWire Sound Server
pulse
PulseAudio Sound Server
speex
Plugin using Speex DSP (resample, agc, denoise, echo, dereverb)
upmix
Plugin for channel upmix (4,6,8)
vdownmix
Plugin for channel downmix (stereo) with a simple spacialization
default
Default ALSA Output (currently PulseAudio Sound Server)
sysdefault:CARD=PCH
HDA Intel PCH, ALC892 Analog
Default Audio Device
front:CARD=PCH,DEV=0
HDA Intel PCH, ALC892 Analog
Front output / input
surround21:CARD=PCH,DEV=0
HDA Intel PCH, ALC892 Analog
2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=PCH,DEV=0
HDA Intel PCH, ALC892 Analog
4.0 Surround output to Front and Rear speakers
surround41:CARD=PCH,DEV=0
HDA Intel PCH, ALC892 Analog
4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=PCH,DEV=0
HDA Intel PCH, ALC892 Analog
5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=PCH,DEV=0
HDA Intel PCH, ALC892 Analog
5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=PCH,DEV=0
HDA Intel PCH, ALC892 Analog
7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=PCH,DEV=0
HDA Intel PCH, ALC892 Digital
IEC958 (S/PDIF) Digital Audio Output
hdmi:CARD=PCH,DEV=0
HDA Intel PCH, HDMI 0
HDMI Audio Output
hdmi:CARD=PCH,DEV=1
HDA Intel PCH, HDMI 1
HDMI Audio Output
hdmi:CARD=PCH,DEV=2
HDA Intel PCH, HDMI 2
HDMI Audio Output
hdmi:CARD=PCH,DEV=3
HDA Intel PCH, HDMI 3
HDMI Audio Output
hdmi:CARD=PCH,DEV=4
HDA Intel PCH, HDMI 4
HDMI Audio Output
usbstream:CARD=PCH
HDA Intel PCH
USB Stream Output
I tried to set in /etc/pulse/default.pa but it did not result.
set-default-sink output alsa_output.pci-0000_00_0e.0.hdmi-stereo
Offline
Pulseaudio is not running by the time you start smplayer. What's your actual intention here? What's the content of your script? If you just want an "autostart" when you log in make the service an --user service. https://wiki.archlinux.org/title/Systemd/User
[Unit]
Description=bot
After=pulseaudio.service
[Service]
Type=simple
ExecStart=/opt/bot/bot.sh
[Install]
WantedBy=default.target
put it into a systemd user service location like described in the linked article and enable it with
systemctl --user enable bot.service
if you really want to run this as a systemd service regardless of the logged in user you'd need to change the default device of mplayer/smplayer so it uses hw:0,3
Online
Pulseaudio is not running by the time you start smplayer. What's your actual intention here? What's the content of your script? If you just want an "autostart" when you log in make the service an --user service.
It is a telegram bot who play some videos by command in current desktop session. Also it implements some other stuff like monitoring so it's better to start before user log in.
So is there is no options to set audio output in systemd like Display:0, I suppose there are two ways:
1. set default audio to HDMI in whole system.
2. find a way to set up HDMI in smplayer config or by command when run some videos.
I will try to manage them. Thank you!
Offline
If it's for the current desktop session then running it as part of the current desktop session via an user service is definitely the better approach and this will make sure you can actually connect to a pulse server that then has the correct default setup.
Online
If it's for the current desktop session then running it as part of the current desktop session via an user service is definitely the better approach and this will make sure you can actually connect to a pulse server that then has the correct default setup.
Really when service running as -user, sound work correct. Thank you guys!
SOLVED
Offline