Preamble

Inspired by 6ga.net, in mid-2005, I started a project to build a TV recording system to watch TV programs broadcast in Japan without going there but staying here in California.

After busy investigation over a variety of Net resources, I decided to use Linux, which I feel most comfortable with, as the foundation of the system and to utilize many resources from the open source community. The first real task was to purchase a network media player (NMP) from Japan to verify its compatibility with open source resources (Linux). In August 2005, my wife proceeded the mission of picking up the NMP in Japan that I had ordered through Amazon.co.jp.

After the successful initial feasibility investigation, I built a PC-based server with two Haupauge PVR350 TV capture cards purchased through eBay and wrote a set of software programs mostly in PHP and Perl. The initial development ran about 3 months. Of course, I could not test the server with real Japanese TV broadcast, so I tested it only with my local cable TV feed.

At the end of 2005, I went to Japan and installed the server in J-NetTV, a commercial PC housing service, in downtown Tokyo. From this point, remote Internet connections were the only way to manipulate the server. The server recorded its very first program, NHK's "Minnano Uta," on January 2, 2006 and successfully transferred it to my home server in California.

Notes: There are a couple of alternatives to this projects, subscribing to a cable or satellite channel such as TV-Japan, and purchasing a commercial box such as SlingBox and Location-Free TV. But these solutions were found very inferior to my own because, for example, the former offers a very limited choice of programs and never re-broadcasts Olympic games focusing Japanese teams and similar for copyright reasons; the latter usually uses a proprietary closed system played back only on a PC and/or at a "news-grade" picture quality, which significantly differs from my project goal of "watching Japanese TV programs lying an a couch with family members."

Do I need say that of course my personal interest in the technology, as a Linux engineer, was one the biggest motivation factors?

The Architecture

Screen Shots

>

Busy recording server (click on images to enlarge)

Now Rec'ing Recording in progress
Waiting Waiting to be transcoded
Transcoding Transcoding in progress
Ready Ready for downloading
Xferring Downloading in progress
The underline on a day-of-the-week field indicates that the recording is part of weekly regular recordings. Otherwise it is a single-time recording.
 

Scheduled (but not yet started) programs and regular programs (click on images to enlarge)

Regular programs are periodically scanned and scheduled as individual recordings.

Each scheduled recording is periodically checked against its latest iEPG for updating the program title, program subtitle, casts, and end time (start time cannot be updated because it is used as key for searching for iEPG).

Theoretically, any TV program guide site offering iEPG can be interfaced, but so far goo was found the most compatible for its little use of JavaScript and other non-HTML stuff.

 

Recorded (and transferred) programs on Wizd NMP server (click on image to enlarge)

A Buffalo PC-P3LAN2/DVD network media player plays back recorded TV programs stored in a Linux-based home server. Program selection is point-and-click using an IR remote control.

A modified version of the Wizd media server program hides cryptic internal file names and displays program information retrieved from iEPG metadata instead.

There is a plan to develop a completely brand-new sever program to replace Wizd and enable on-screen file management and other operations, but no project has started.

 

Playing back a recorded program on a 50" LCD RPTV (click on image to enlarge)

TV programs recorded at a 480i resolution are played back in 720p mode. The 720p resolution was chosen to diplay as much program information as possible with reasonable legibility on a large TV screen (see above). Quality is close to that of a good VHS VCR, with no jitter noise at all!

A simple survey showed that each week the server records and transfers an average of 45 TV programs totaling over 22 hours (approximately 23GB).

 

Recorded file management (click on image to enlarge)

A web interface running on the local home server allows programs that have viewed to be deleted from or archived in the server.

TV Recording System Specification

General

Design goals
  • Watch TV programs broadcast in Japan on a large screen TV in family room in the U.S.
  • Remotely and securely control everything over the Internet
  • Use of and connectivity with open source resources.
Installation December 2005
Availability 99.9% (actual, excluding scheduled downtimes)
 

Base recording server installed in downtown Tokyo

CPU AMD Sempron(tm) Processor 3000+ (1.8GHz)
Memory 512MB (64MB used for VGA) DDR3200
Disk 100GB SATA/150, 8.5GB IDE (for local backup)
TV capture cards Haupauge PVR350 with hardware MPEG2 encoding (2 ea.)
UPS A dumb UPS (no communication with server) prevents the server from power-cycling at a short period of power outage
Hardware cost ~ $600US
OS Linux 2.6 (Fedora Core 4)
Control and processing software
  • Various open source tools including ffmpeg
  • Home-brew programs written in PHP, Perl, and Bash
 

Recording

Scheduling iEPG with point-and-click on a commercial TV guide site using URL-wrapping technology
Regular programs Day of week, Monday-Friday
TV stations VHF analog (1-12ch)
Simultaneous recording Up to 2 programs with automatic arbitration of TV capture cards
Primary recording MPEG2 720x480i 29.97fps NTSC 8Mb/s (3.9GB/h with audio)
Transcoding MPEG4 640x480i 29.97fps NTSC 2Mb/s (966MB/h with audio)
Audio Monaural, 128kbps after transcoding
Transcoding performance About 220% of program time (software transcoding with ffmpeg)
Simultaneous transcoding A significantly shorter program can cut in with a higher priority (no more than 2 simultaneous transcoding processes)
 

Recorded program transfer

File transfer Rsync over SSH (possible to resume interrupted transfers, no file size limit, one program at a time, shortest program first)
File transfer performance Up to 490kB/s (limited by local cable downstream)
Internet security Packet filtering, SSL, server access deny/allow list
 

Play back

TV Sony KDF-50WE655 50" LCD RPTV
Network Media Player Buffalo "Link Theater" PC-P3LAN2/DVD
Resolution 640x480i on 720p screen
NMP server (hardware) Pentium 4, 3GHz, 1GB memory, 1.2TB disk, Linux 2.6 (Fedora Core 5)
NMP server (software) Wizd (modified)
Program menu Date, Time, Program title, Program subtitle, Station, File size
File management Delete, Archive (web based)
Playback quality Similar to good VHS

The Future

The current version of my recording system is very stable and providing the means of major TV reception to my family. No major bugs have been fixed nor major new features have been added in the last few months.

Transition to digital broadcast

Key TV stations air 1-minute spots advertising the termination of analog terrestrial broadcast in Japan on July 24, 2011. The current version of my recording system does not support digital terrestrial broadcast reception and therefore will stop working on that day.

Since the authorities do not allow digital TV broadcast signals to pass universal buses like PCI, the only practical way to receive and record digital broadcast on my system is to use a separate digital broadcast tuner STB and feed its analog output to the existing TV capture card's composite or S-Video input (and audio input also). The same is true for BS (broadcast satellite) reception.

This is not only stupid but also gives me a number of challenges:

NMP Server

The Wizd NMP server program is very good, as it is; but mainly due to its non-OOP architecture, it's not easy to add new features or improve existinh features. I have added several new features such as metadata display, but it was a pain to traverse the entire code tree in order to insert just one small thing. The top wish-list item is to enbale file management on the TV screen that currently requires a PC web interface, but adding such a significant to the Wizd code is something I really do not want to do.

A plan is to rewrite the whole thing using Perl's plug-in manner, but it's not trivial...