37

Question:

Can I get a local VLC instance to stream media from a remote computer, via SSH?

This is with VLC running on the local computer that I'm watching the video on, not remotely via X11-over-SSH.

Are there any extra access modules for VLC which could enable SSH sources?

The local computer unfortunately runs Windows 7, and I want to avoid dual-booting if possible.


Probably unnecessary - my setup:

  1. I have a computer in the UK which auto-connects to a VPS via SSH and sets up reverse port-forwarding.

    For those interested in doing this, the UK computer uses:

    ssh -nNTP *:9000:localhost:22 user@vps

    where 9000 and tunnel@vps should be changed accordingly for your setup.

  2. I SSH/PuTTY to the mapped port on my VPS from wherever in the world I am, in order to access the UK computer. I connect from my local computer to the UK one over the SSH tunnel by then locally executing:

    ssh user@vps -p 9000

  3. This works great for getting a shell on the UK computer. I want to stream media from it though onto my local PC which unfortunately, runs Windows 7. This rules out SSHFS, and also win-sshfs which is quite buggy on Windows 7.

Currently, I use win-ssh to start copying the file over, then I get VLC to play the (incomplete) file. As long as the copy rate is above the media bitrate and win-ssh doesn't fail (which it does for most files), this works great. I'm looking for a more robust solution.

4 Answers 4

31

Try SFTP. It's the protocol used by SSH to transfer files and is supported by VLC in the Open Network Stream menu by typing sftp://<server>/<path to file> and then authenticating.

4
  • Ah nice, I didn't think to just run a Windows-usable file access protocol through the SSH tunnel... and then I saw that SFTP runs via SSH anyway... This is a very simple and easy solution! Thanks! Commented Jul 10, 2014 at 22:06
  • 5
    I couldn't get that to work using sftp://user:password@server/path or sftp://server/path (VLC didn't prompt for auth options in the latter case). VLC failed to connect. For now, I use SCP to copy to the Windows machine, and play the incomplete file in VLC (as long as DL rate > video bitrate, it's fine) Commented Aug 14, 2014 at 14:17
  • VLC will use pageant for authentication, so this can be a very low friction solution.
    – Deebster
    Commented May 10, 2018 at 15:52
  • On OSX, VLC ignored aliases defined in ~/.ssh/config. Key authentication worked, though. Commented Nov 1, 2023 at 20:38
5

Three steps:

  1. Generate a new SSH key for easy authentication with ssh-kegen.
  2. Use ssh-copy-id to copy the key to the server.
  3. On the commandline, type

    vlc sftp://user@host:/path/to/file
    
1

I had trouble getting VLC to play when inputting the location of my file as well. I then opened the sftp in my file browser and double-clicked the video to launch it in VLC, it worked fine. I checked what the URL looks like under the playlist properties and it is formatted as:

/run/user/1000/gvfs/sftp:host=HOSTNAME/PATH/TO/FILE.EXT

Where you would need to replace 1000 with the uid of the remote user I would assume, and HOSTNAME and '/PATH/TO/FILE.EXT' respectively.

Hope that helps someone. In the end however, the easiest solution is browsing to the file via file browser and simply opening with VLC from there.

0

I had the same problem but the file I wanted to stream was still being modified (because it's a live recording, but that could also happen if you use your ssh server to download a movie for instance). In that case, Mark's method is not working since the download stops when the size of the file has reached the size at the beginning of the download.

But I wrote a Java program that basically resume the download as long as the file is getting bigger. If someone is interested, the program is there:

How to use VLC to watch a file (while it is being modified) on a SSH server (using sftp or smth else)?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .