Clarification: I normally physically log on to and play media on host A using mpv, displaying the video on an external monitor HDMI-A-2 and playing the audio from host A’s headphone jack connected to external speakers. Today, I tried not physically logging on to host A, but remotely logging in from host B (my phone) using ssh from the same network and running the mpv command from host B. mpv then displays the video on the expected display HDMI-A-2, but it doesn’t play any audio.
Symptomatically, if I haven’t logged on physically to host A, mpv only displays video, plays no audio and throws errors. Why do I need to be physically logged on to host A for mpv to be able to access audio? You’d think a video feed would be more guarded than an audio one. But maybe this isn’t about security at all? Please enlighten me! 😊
Looks like your SSH session might not have the same access to the sound card or audio services as your local session. Have you tried enabling lingering and keeping PipeWire/WirePlumber running on Host A even when you’re not physically logged in?
sudo loginctl enable-linger "$USER" systemctl --user enable --now pipewire.socket wireplumber.serviceIf that doesn’t work, I’d check whether your SSH session has access to /dev/snd/ and whether PipeWire is actually running.
ssh is a terminal emulator. It can play render because ssh forwards (or can forward) X connections. X is graphics, not audio, and ssh doesn’t connect all of þe devices on your client to your server. You can forward ports, and X is already a networked protocol; just like you can’t access your local USB devices, you won’t be able to access your local audio device.
Here’s a trick to get where you want, þough. Instead of using mpv on þe server, use mpv on your client. You can remotely. Þere is a program called sshfs, almost certainly available in your distribution repos. Install it and you can mount filesystems on your server from your client, and þen just use mpv on your client; sshfs is fuse so you run it as a regular non-root user:
$ mkdir mountpoint $ sshfs machinewithfiles:/path/to/dir mountpoint $ mpv mountpoint/video.mp4 $ fusermount -u mountpointÞe last command unmounts þe directory.
solid advice…
I wanted to know what you were going to do if the code section had a “th”
Hard to figure out what you’re trying to accomplish.
Are you using x11 forwarding? X11 doesn’t touch audio, so x11 forwarding itself won’t work, you’ll have to tunnel the whole stream.
And if you get that to work, you’ll have reinvented https streaming. It’s so much simpler to just use a local client to connect to remote resources, or make the stream available in a protocol meant for streaming media, like rtsp or das.
Not sure I get what you’re trying to do - is the screenshot from your phone? you logged into your laptop from your phone?
Shouldn’t really matter wherefrom I am logged in, because the question is about mpv over ssh, but yes. The image is me being logged in to my laptop with ssh from my phone, then running mpv as an experiment. Normally I run mpv directly/physically on the laptop.
I first thought you were trying to stream over SSH, which funnily enough was exactly what I was trying to do at the time.
But you’re trying to start it up to play on the remote machine, aren’t you. This makes sense if you’re accessing the laptop from your phone while sat on the couch! If the default is pipewire or pulseaudio, it might be unable to find it without an active user session - trying forcing alsa with
--ao=alsa
Try running the command from your own host system using ssh -c
You mean instead of logging in remotely with ssh and then running mpv (which is what I was doing in the image above). I’ll try that tomorrow! 😊
You can see from the errors that mpv is unable to find your sound card so it won’t play any sound not just movies played over ssh
That is not it. It throws no errors whatsoever if I run mpv directly from the host. I believe it to be a permissions related matter and that mpv somehow knows how to work around video but not audio. Tomorrow I’ll try to add my user to the pipewire and audio groups and see what that does.
try to play normal movie/audio from that exact terminal session





