The Personal Blog of Stephen Sekula

Take TV Anywhere

I’ve commented on how much I love my MythTV box, “Stevo.” I’ve found another reason to love it more: streaming recordings from my home in Texas to my laptop in France.

Fundamentally, all MythTV does is take output from a TV tuner card and convert it to MPEG, writing it to disk. MythTV makes the videos available through a “TiVo-like” interface. But in addition to TV, it collects your music and photos, RSS news feeds, web content (Hulu), and podcasts and makes them available through your computer or TV.

Marry MythTV, SSH, and VLC, and you have a personal streaming empire. Let me tell you how I get my videos from Texas to France.

It begins by opening an SSH tunnel, with port-forwarding, from my laptop to the Stevo machine. Since Stevo lives behind a firewalled server, I need to do a “two-hop SSH tunnel”. From one terminal, I type:

ssh -l <USERNAME> -L 8080:<INTERNAL STEVO IP ADDRESS>:8080 -2 <EXTERNAL SERVER IP ADDRESS>

and from another I type:

ssh -l <USERNAME> -L 8081:<INTERNAL STEVO IP ADDRESS>:8081 -2 <EXTERNAL SERVER IP ADDRESS>

The reason for two tunnels with two ports – 8080 and 8081 – will become apparent in a moment.

Using one of the two SSH sessions, I then log into the internal Stevo machine. I navigate to the directory containing my TV recordings and choose the one I want to stream. I then execute VLC, launching both its web server (to control the stream) and its streaming capability:

cvlc -I http –http-host :8080 <FILENAME> –sout \
‘#transcode{fps=25.0,height=320,width=240,vcodec=mp4v,vb=768,acodec=mpga,ab=128,channels=2}\
:std{access=http,mux=asf,dst=:8081}’

You’ll have to tune your bitrate (video and audio) settings to suit the quality of your connection. I find that with my home server upload speeds and the download speeds of my local internet connection, 768kbps for video and 128kbps work very well. We also see why two port tunnels are needed. One is for the HTTP interface that lets you control VLC (8080) and the other is where the stream goes (8081).

Now, one important thing. You may need to tweak the .hosts files provided by VLC for its HTTP interface. By default, it’s locked down and you can’t access the webserver, even with the SSH tunnel, from anyplace other than 127.0.0.1. I edited the /usr/share/vlc/http/.hosts file and made the server allow people from outside localhost to access the VLC interface.

Now, from my laptop’s web browser I go to http://localhost:8080 and I can control where in the stream I am located. I can launch VLC from a terminal on my laptop using

vlc http://localhost:8081

and I can watch the stream.

By the way, here’s a fun tip based on something I learned from Lifehacker [1]: if you are watching a certain GLOBALLY POPULAR sporting event using this method, and you cannot STAND Vuvuzelas, you can open VLC’s audio mixer, enable two-pass mode, and drag down the following sliders to zero: 600Hz, 1kz, 3kHz, and 6kHz. This removes the higher range of frequencies occupied by the Vuvuzela, leaving voices and cheering intact.

[1] http://www.npr.org/blogs/showmeyourcleats/2010/06/18/127928951/vuvuzela-tricks

2 thoughts on “Take TV Anywhere”

Comments are closed.