How to start mplayer with radio (.pls) url over ssh and have it play?
All, I know little about audio, but I'm trying to help my kids configure a radio stream. I normally use this media box via X desktop, but wanted to just play the stream via mplayer starting it over ssh -- that didn't work no matter what -ao I specify. However, if I open an x-term on the box from the desktop and enter the same url there - presto, the sound plays, and everything works. Since I normally use this box headless, how do I start mplayer over ssh and have the sound play on the remote box? Entering the following through the x-term from the desktop works just fine: mplayer -loop 0 -playlist http://playerservices.streamtheworld.com/pls/KDAQHD2.pls (it's classical) Is there a config somewhere where I can tell it to start mplayer the same from ssh as it does when started from the desktop? Following troubleshooting from the Sound Wiki, running 'pactl list sinks' over ssh while the desktop is playing the audio stream, I get: $ pactl list sinks Sink #1 State: RUNNING Name: alsa_output.pci-0000_00_1b.0.analog-stereo Description: Built-in Audio Analog Stereo Driver: module-alsa-card.c Sample Specification: s16le 2ch 44100Hz Channel Map: front-left,front-right Owner Module: 19 Mute: no Volume: front-left: 41944 / 64% / -11.63 dB, front-right: 41944 / 64% / -11.63 dB balance 0.00 Base Volume: 65536 / 100% / 0.00 dB Monitor Source: alsa_output.pci-0000_00_1b.0.analog-stereo.monitor Latency: 29816 usec, configured 31247 usec Flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY Properties: alsa.resolution_bits = "16" <snip> Can I use this information when starting mplayer over ssh to have it play sound through that boxes (the remotes) speakers? I've tried '-ao alsa' when starting over ssh, but still no sound. If I missed something in the wiki -- I missed it. Any help appreciated. -- David C. Rankin, J.D.,P.E.
David, Try the following. Use `aplay -l` to find the hardware ID which you want to use, e.g. in my case I want to use card number 2: ``` card 2: prime [Dr.DAC prime], device 0: USB Audio [USB Audio] Subdevices: 1/1 Subdevice #0: subdevice #0 ``` Then run `alsamixer -c 2` (2 is the card number), and make sure it is not muted, and the volume is not at zero. Then try `mplayer -ao alsa:device=hw=2` (again, 2 is the card number). This should help with any of the potential issues with mplayer trying to use wrong hardware to play audio, or the sound card being muted. On Sunday, June 30th, 2024 at 22:34, David C. Rankin <drankinatty@gmail.com> wrote:
Is there a config somewhere where I can tell it to start mplayer the same from ssh as it does when started from the desktop?
What probably happens (and this is just a guess here, since there are many different ways to set it up in Arch) when you run via X desktop is that systemd launches a sound server (pipewire or pulseaudio), which chooses the hardware and remembers its volume level for you. `mplayer` then probably connects to it, instead of using ALSA directly (although I cannot be sure without seeing mplayer output). If you want to have the same set up, you'll need to either start the sound server manually, or start it as a system service instead of a user service. However, this all should not be needed if my instructions above work for you. Hope this helps. If it doesn't, please include mplayer output (both when it works, and when it doesn't work). Best regards, -- Edward
On 7/1/24 12:49, Edward Toroshchyn wrote:
Then try `mplayer -ao alsa:device=hw=2` (again, 2 is the card number).
Hah!, That worked: $ mplayer -ao alsa:device=hw=0 -loop 0 -playlist http://playerservices.streamtheworld.com/pls/KDAQHD2.pls Though I'm quite curious why since this is card 0, it wasn't selected by default the first time I tried? This may be the result of me having started fluxbox desktop and X triggering the sound setup. I only have one sound card (and it's Alt on device:2) $ aplay -l **** List of PLAYBACK Hardware Devices **** card 0: Intel [HDA Intel], device 0: AD1984A Analog [AD1984A Analog] Subdevices: 1/1 Subdevice #0: subdevice #0 card 0: Intel [HDA Intel], device 2: AD1984A Alt Analog [AD1984A Alt Analog] Subdevices: 1/1 Subdevice #0: subdevice #0 I'm also not sure just what X starts as far as the sound system goes as I use startx to launch fluxbox, so there isn't any desktop manager launching the desktop. All I do is launch the pulse-audio systray volume app on fluxbox startup, e.g. in ~/.fluxbox/startup: ## pulse-audio volume control pasystray=$(type -p pasystray) [ -x "$pasystray" ] && "$pasystray" & Next reboot I'll try ssh and mplayer start as above and see if it will work without any X desktop having been previously started. Thank you for your help! -- David C. Rankin, J.D.,P.E.
On Mon, 2024-07-01 at 22:37 -0500, David C. Rankin wrote:
$ mplayer -ao alsa:device=hw=0 -loop 0 -playlist http://playerservices.streamtheworld.com/pls/KDAQHD2.pls
Though I'm quite curious why since this is card 0, it wasn't selected by default the first time I tried?
This may be the result of me having started fluxbox desktop and X triggering the sound setup. I only have one sound card (and it's Alt on device:2)
$ aplay -l **** List of PLAYBACK Hardware Devices **** card 0: Intel [HDA Intel], device 0: AD1984A Analog [AD1984A Analog] Subdevices: 1/1 Subdevice #0: subdevice #0 card 0: Intel [HDA Intel], device 2: AD1984A Alt Analog [AD1984A Alt Analog] Subdevices: 1/1 Subdevice #0: subdevice #0
Hi David, your audio device obviously provides device 0 and device 2. As a plain ALSA (or sometimes, but very seldom jackd + ALSA backend user) I set up the default device by $HOME/.asoundrc . I don't know if pulseaudio takes care about this default. I don't use pulseaudio. When using jackd, I need to get rid of $HOME/.asoundrc , before using jackd. Don't be confused by my output, the first card is card 0 and the second card is card 3, because I set up placeholders by /etc/modprobe.d/alsa-base.conf . This is completely irrelevant for you, it just explains why the output of aplay might be confusing on my machine. • rocketmouse@archlinux ~ $ cat /etc/modprobe.d/alsa-base.conf # ALSA module ordering options snd slots=snd_hdspm,snd_ice1712,snd_ice1712 When not using jackd, but just plain ALSA, I want audio output via HDMI. • rocketmouse@archlinux ~ $ aplay -l **** List of PLAYBACK Hardware Devices **** card 0: HDSPMx579bcc [RME AIO_579bcc], device 0: RME AIO [RME AIO] Subdevices: 1/1 Subdevice #0: subdevice #0 card 3: PCH [HDA Intel PCH], device 0: ALC897 Analog [ALC897 Analog] Subdevices: 1/1 Subdevice #0: subdevice #0 card 3: PCH [HDA Intel PCH], device 1: ALC897 Digital [ALC897 Digital] Subdevices: 1/1 Subdevice #0: subdevice #0 card 3: PCH [HDA Intel PCH], device 3: HDMI 0 [EV2450] Subdevices: 1/1 Subdevice #0: subdevice #0 card 3: PCH [HDA Intel PCH], device 7: HDMI 1 [HDMI 1] Subdevices: 1/1 Subdevice #0: subdevice #0 card 3: PCH [HDA Intel PCH], device 8: HDMI 2 [HDMI 2] Subdevices: 1/1 Subdevice #0: subdevice #0 card 3: PCH [HDA Intel PCH], device 9: HDMI 3 [HDMI 3] Subdevices: 1/1 Subdevice #0: subdevice #0 This is my $HOME/.asoundrc : • rocketmouse@archlinux ~ $ cat .asoundrc defaults.pcm.card 3 defaults.pcm.device 3 Again, I don't know if pulseaudio cares about $HOME/.asoundrc . However, for such simple Intel audio devices you usually don't need to do something complicated, to use several apps at the same time. A sound server isn't required to grant access to the audio device, this happens automagically under the hood. Right now on my machine Jimi Hendrix plays Voodoo Child on Waterfox and Little Wing on Firefox via Intel HDMI. As long as you don't need something tricky such as Bluetooth or pro-audio, you much likely don't need a sound server at all. When using my snd_hdspm, snd_ice1712 or an USB Scarlett 18i20 it's not as easy as it is with the Intel audio device. Regards, Ralf
participants (3)
-
David C. Rankin
-
Edward Toroshchyn
-
Ralf Mardorf