Remote Videos
I went to watch a movie that I had downloaded on an external hard drive connected to my older
notebook.
Usually, I connect this hard drive directly to the TV, but this time I couldn’t eject the hard drive
because it was being used by other programs.
So, I found myself in a situation with two alternatives: watch the movie on the 14" screen or find a
way to stream the video to my new notebook, which has an HDMI output, and enjoy all the sound and
image quality that LG™ provides.
As a good computer movie lover (I’m not), I chose the second option and will write here how I solved the problem at that time as well as other methods I discovered later.
1. Put the computers on a network
I didn’t have a router to set up a network. Since both notebooks have wireless cards, I created an Ad-Hoc network, as explained in this post (without the internet part).
2. Find a way to exchange files
There are several ways to send files from one computer to another on the network:
-
SSH
SSH was the first thing that came to mind because I’m used to it. I admit it’s not a very good solution, as it consumes a lot of CPU and unnecessarily increases network traffic (there’s no reason to use encryption unless you’re paranoid or the video is extremely confidential). Anyway, it worked well as follows:
-
Install and activate SSH on both computers:
sudo pacman -S openssh sudo /etc/rc.d/sshd start
-
Connect Computer2 to Computer1 via ssh:
ssh julio@192.168.1.1
-
Play the video
mplayer video.avi -display :0
or
export DISPLAY=:0
in case we need to use another program that does not have a command to change the display.
-
-
SSH with pipe
As in the previous mode, but redirecting the video directly to mplayer
ssh julio@192.168.1.2 "cat /media/external/Videos/video.avi" | mplayer -cache 65536 -
-
SSHFS
-
Install sshfs
sudo pacman -S sshfs
-
Mount the file system
sshfs julio@192.168.1.2:/media/external /media/external
-
Go to the folder and play the video with
mplayer
as if it were a local file.mplayer /media/external/Videos/video.avi
-
-
SSH with X11
-
Change, on the server, the file
/etc/ssh/sshd_conf
from#X11forwarding no
to
X11Forwarding yes
or, on the client, edit
/etc/ssh/ssh_config
from#ForwardX11 no
toForwardX11 yes
. -
Play the video with
mplayer
ssh -XY julio@192.168.1.2 mplayer /media/external/Videos/video.avi
-
-
Samba
-
Download Samba
-
Enable sharing of your video folder
# vim /etc/samba/smb.conf [videos] comment = Videos do Julio path = /media/externo/Videos writable = no valid users = julio follow symlinks = yes wide links = yes
-
Mount the file system
sudo mount -t cifs //192.168.0.1/Videos /media/external/Videos -o user=julio,password=PASSWORD,workgroup=WORKGROUP
-
Play the video with mplayer as if it were a local file
mplayer /media/external/Videos/video.avi
-
-
Netcat
-
On the computer with the video:
cat /media/external/Videos/video.avi | nc -l -p 9998
-
On the computer connected to the TV:
nc 192.168.0.1 9998 | mplayer -vo x11 -cache 3000 -
-
-
VLC with sftp
file
»Open Network…
sftp://julio@10.211.55.3/media/external/Videos/video.avi
Enter login and password
3. Convert
At home network, I was able to stream 720p video without any issues, even with my old computer using old wi-fi (802.11g). However, if you want to do the same with 1080p video or even stream over the internet, it may be interesting to convert the video in real time. For that, you can use ffmpeg.
Avoid Standby
To prevent the computer monitor connected to the Television from turning off automatically due to
inactivity, we can disable standby through Xorg
:
sudo vim /etc/X11/xorg.conf
And leave the ServerLayout
session as in the example below:
Section "ServerLayout"
Identifier "Layout"
Screen 0 "Screen0"
Option "Xinerama" "true"
Option "BlankTime" "0"
Option "StandbyTime" "0"
Option "SuspendTime" "0"
Option "OffTime" "0"
EndSection