How to Play Movie from Remote Host using MPlayer over SSH
Posted on In Linux, Network, Software, TutorialMPlayer is a great movie player. SSH is a great tool to connect and transfer data over the network securely. Combining these 2 great tools together will be greater. You may already has a small server storing some movies or videos or music and playing them on your laptop will be convenient. In this post, we will introduce three methods to play movie using MPlayer over SSH.
Here, we use the example that we want to play the movie file ~/movie.mp4 on user@example.org.
Table of Contents
X11 forwarding
Use the -X
option of the ssh client, we can enable X11 forwarding. (Read: ssh manual)
ssh -X user@example.org mplayer ~/movie.mp4
The command is straightforward and you can also just connect to the remove server and invoke mplayer anytime you like. The drawback here is that there is no sound.
Use ssh as a data transfer tunnel
MPlayer can play content from STDIN. We can use ssh to transfer the movie file
ssh user@example.org cat ~/movie.mp4 | mplayer -
This is also handy. The drawback is that you can not seek back when you play the movie.
Mount remote directory over ssh
This method is my favorite one.
We can mount a remote directory over ssh to our laptop (e.g. ~/remote) by:
sshfs user@example.org: ~/remote
Read more on mount remote folder by ssh at https://www.systutorials.com/mounting-remote-folder-through-ssh/.
Then you can just use MPlayer open the movie under ~/remote by:
mplayer ~/remote/movie.mp4
What you play movie over `ssh` tunnel, better enable compress like
ssh -XC4c arcfour,blowfish-cbc user@example.org mplayer ~/movie.mp4
to get a better experience.
Since now sshfs is my favorite too!
To unmount this was taken from man sshfs:
fusermount3 -u mountpoint # Linux
umount mountpoint # OS X, FreeBSD