MPlayer 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 firstname.lastname@example.org.
X11 forwarding ∞
-X option of the ssh client, we can enable X11 forwarding. (Read: ssh manual)
ssh -X email@example.com 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 firstname.lastname@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 email@example.com: ~/remote
Read more on mount remote folder by ssh at Mounting Remote Folder Through SSH.
Then you can just use MPlayer open the movie under ~/remote by: