A few things, mostly technical notes...

Tuesday, November 22, 2011

the thin myth-tv frontend

Running a thin myth-tv frontend:

Here's how to setup a thin frontend for mythtv with minimal config and filesets.

Install mythtv frontend and socat on your machine.

# apt-get install mythtv-frontend socat

Create a file called ~/bin/thin-myth.sh:
(in my case, the IP of my backend server is

#! /bin/bash

#set the IP of your backend server.

xrandr >> $log
socat -b 128000 -d -d -lmlocal2 TCP4-LISTEN:3306,fork,reuseaddr  TCP4:$IP:3306 &
socat -b 128000 -d -d -lmlocal2 TCP4-LISTEN:6543,fork,reuseaddr  TCP4:$IP:6543  &
/usr/bin/mythfrontend -l $log

Ensure that DBHostname in ~/.mythtv/config.xml and ~/.mythtv/mysql.txt is set to

$ grep config.xml mysql.txt

Launch ~/bin/thin-myth.sh and enjoy.

How does it work?
socat listens on 3306,6543 for mysql and mythbackend ports respectively and relays those onto your 
mysql and mythbackend ports on your backend server. 
more here.. 

Monday, February 07, 2011

Wifi recommendation for HD streaming

I stream HD media over wifi, lots and lots of it. I live in a rented apartment where there're no wired ports available. I tried Belkin Ethernet over power adapter to carry my HD traffic, it failed miserably. Then I tried to bridge my wireless G usb dongle along with my wired nic - it never worked.

Then I went onto buy a "NETGEAR WNDR3400-100NAS IEEE 802.11a/b/g/n 2.4/5GHz Simultaneous Dual Band N600 Wireless Router" and a "NETGEAR WNCE2001 Wireless 802.11b/g/n Ethernet Port Universal WiFi Internet Adapter" as my bridge.

Sadly the bridge is in 2.4Ghz spectrum, and is susceptible to interference, even to microwaves. (2.4Ghz is such a crowded space - microwaves, garage door openers, cordless phones all use it - compared to that, 5.x GHz spectrum is squeaky clean..!)

I returned the 2.4Ghz WNCE2001 bridge and got a "Cisco-Linksys WET610N Dual-Band Wireless-N Gaming and Video Adapter" from Amazon - as implied, this bridge can talk in the 5.x Ghz spectrum. It has been almost a month now, and my HD streaming is working smooth.

Gist: For HD streaming over wifi - go for Wireless N devices in the 5.x Ghz spectrum, you will be happy!

keywords: mythtv wifi recommendation, hd streaming over wifi

Monday, January 24, 2011

rsync delta-transfer algorithm

rsync delta-transfer algorithm is pretty cool, reduces the amount of data sent over the network by sending only the differences between the source files and the existing files in the destination.

export alias scpr='rsync -av --partial --progress --rsh="ssh -c arcfour -o compression=no -o StrictHostKeyChecking=no"'

myhost:/tmp# ls -ltrh somefile
-rw-r----- 1 root root 2.3G Jan 24 11:53 somefile

myhost:/tmp# time scpr somefile somehost:/tmp/
2452194584 100% 67.76MB/s 0:00:34 (xfer#1, to-check=0/1)

sent 2452494012 bytes received 31 bytes 65399841.15 bytes/sec
total size is 2452194584 speedup is 1.00

real 0m37.408s
user 0m22.341s
sys 0m5.624s

append some data to somefile:

myhost:/tmp# dmesg >> somefile

myhost:/tmp# time scpr somefile somehost:/tmp/

2452249209 100% 137.71MB/s 0:00:16 (xfer#1, to-check=0/1)

sent 266589 bytes received 396255 bytes 20395.20 bytes/sec
total size is 2452249209 speedup is 3699.59

real 0m32.525s
user 0m16.521s
sys 0m0.484s

rsync just sends out the delta(!), 2452494012 bytes the very first time vs. 266589 to accomodate delta.

scp: transfer speed & compression

With compression:

$ time scp -c arcfour -C somefile somehost:/somewhere

real 47m30.974s
user 46m18.974s
sys 1m4.040s

Without compression:

$ time scp -c arcfour somefile somehost:/somewhere
real 10m41.195s
user 2m41.142s
sys 0m51.611s

details of somefile:

$ file somefile
somefile: MySQL MISAM compressed data file Version 1

Gist: if a file is already compressed, scp-ing with -C (compression) rightly slows down the transfer.


Creative Commons License
This work is licensed under a Creative Commons License.