DVB-T on Linux using DVBStreamer

I've tried most of the DVB streaming solutions for Linux, including VDR, MuMuDVB, DVBBlast, dvbstream, DVBStreamer, GNOME DVB Daemon. I've only managed to find one that does this well though, which is DVBStreamer.

Getting started with DVBStreamer is pretty easy. First of all you need a DVB adapter that works with Linux. I use a USB ITE IT913x-based adapter, which works well for me.

Once you have a compatible package, you need to install necessary (Debian/Ubuntu) packages:
apt-get install dvb-tools dtv-scan-tables dvbstreamer vlc

Use the scan tool to create a DVB channel configuration file using the DTV initial scan file for your nearest transmitter. I'm based in Dublin, Ireland, so I've used my nearest DVB-T transmitter, Three Rock in this example:
scan /usr/share/dvb/dvb-t/ie-ThreeRock > /tmp/channel.conf

Once you have your channel.conf file, you can pass this to setupdvbstreamer which creates the necessary DVBStreamer config files:
setupdvbstreamer -t /tmp/channel.conf

Create a startup file to auto tune to LCN 2 to on startup and output some useful DVB-T information. LCN 2 currently corresponds to RTÉ Two HD on Saorview:
printf "set udp://localhost:1234\nselectlcn 2\nfeparams\nfestatus\nstats\nlslcn\n" > ~/.dvbstreamer/dvbstreamer.conf

Now you can start DVBStreamer using the following:
dvbstreamer -f ~/.dvbstreamer/dvbstreamer.conf

DVBStreamer is now streaming over UDP to localhost:1234. You can view this using vlc:
vlc udp://@localhost:1234

I don't like keeping a terminal open just to run DVBStreamer, so usually I start it in daemon mode by passing '-f -d' at startup, and control it using the remote interface to control instead:
telnet localhost 54197

Dual Boot, Dual MAC

My desktop machine runs a Linux/Windows dual boot. It runs Linux 90% of the time, with Windows only used for playing games.

Rather than have to remember which operating system is running at the time, I decided to forcibly make Windows use a different MAC address. This means that I can now assign each machine a different hostname in DNS. Checking which operating system is running is now as simple as pinging the hostname corresponding to the operating system.

You can change this is both Linux and Windows, but I decided to keep my main operating system using the machine's original MAC address. Changing this in Windows involves editing a value in Device Manager:

4k Drive Alignment

With 4k advanced format drives becoming more and more popular, it is important that users understand the differences that the move from a 512 to 4k sector size brings about.

During this transitional phase, the majority of larger drives are using 4k sectors internally, but exposing a 512 byte section externally for compatibility reasons.

See for yourself using fdisk. Below is the output of a Samsung HD204UI 2 TB drive:

root@alpha:/etc# fdisk -l /dev/sdb

Disk /dev/sdb: 2000.4 GB, 2000398934016 bytes
218 heads, 56 sectors/track, 320038 cylinders
Units = cylinders of 12208 * 512 = 6250496 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1      320039  1953513560   fd  Linux raid autodetect

While these drives will work out of the box, unless the drive is aligned to a 4k sector boundary, each read/write action will require multiple sector to be read and rewritten. Not very efficient at all.

The following arguments will set up fdisk to create properly aligned partitions on /dev/sdb:

fdisk -c -u -H 224 -S 56 /dev/sdb

Debian Print to PDF

Having used PDFcreator on Windows for many years, a PDF printer is something that you miss very quickly on a fresh install operating system.

Linux is no exception, and cups-pdf provides a PDF printer for the most excellent CUPS. (I normally despise Apple software, but I have to give them credit for CUPS. :))

To install on a Debian/Ubuntu machine:

apt-get install cups-pdf

Once installed, you should now have a new PDF printer showing up in CUPS.

Mirror FTP

I recently decided to take mirror an old website that I had running. The hosting plan only offered ftp, and so, I couldn't get shell access to tar and scp it.

Next best thing was to mirror it using lftp. The following command logs into the root FTP directory and mirrors every file recursively.

lftp -e mirror -u username,password ftp.example.com