DVR
Resume Essays Resources
Home Up |
Turning a beige mac into a DVR.
I was thinking using HackTV carbon as a capture program, this is Apples example program, this program nevertheless have two deficiencies:
I tested several formats of compression in the end I decided to use MPEG-4 for video and AAC for audio, codec 3ivx gave the best results, with a size of 320x240 the video have a similar quality to VHS and used about 700MB/hour. The as an alternative to the use of the videocam,I buy the XLR8 Interview 3,0 adapter, which is a USB-1 device, which captures video, but no audio, its necesary to use the audio-in port to capture the sound. This device captures 320x240 wich was the size that I wanted. The XLR8 comes with a the program USBVision, this program seems to be an extended version of HackTV, in fact it shares the preferences, and it solves both problems of HackTV, its possible to control the recording with Applescript and has the option of auto-renumber the captured archives. In spite of the name, USBVision also can capture from the videocamera using Firewire, another reason to think that this based on HackTV. As a capture codec the program brings a codec also called USBVision, using this codec the movie used about 4GB/hour. Because now the mac is going to be used with a TV, I added the AVerKey100 Pro box, which convert the VGA output to Composite Video or S-Video. I found the program cscreen wich allows to change the resolution to 640x480, which is seen well in TV. Reviewing information in the Internet about similar systems I found MythTV, which is much ambitious system that what I wanted, nevertheless have a link to a Perl program wich allow to control a DirecTV box, since I am a subscriber of DirecTV, I decided to test the program called Sony.pl, preferring Python to Perl, I converted the program to one called setDTV.py. Once I conected all the devices I have:
For the videocamera, it is connected to the Firewire instead of the USB and Audio-In is not needed. My DirecTV box uses a standart DB-9 connector for the serial port, so I need a mini-DIN to DB-9 adapter:
At first I used a few applets of Applescript to control the recording, I needed to put the applet as a Startup Item and set the correct time to power on the mac, that was a lot of manual work, so I decided to create a program to control the different applications with Applescript. I decided to create the program with Applescript Studio, being an opportunity to learn it, since it was the first time that I used this environment, although I already have experience with simple applets created with Script Editor. An extra objective was to try to automatically power on/off the devices (mac and DirecTV) , since the mac uses near 40W, and the DirecTV like 24W, is clear that I do not need to maintain them always active, neither equipment has a modality of sleep that could have been the alternative. For this I put a cable connected to the power output of the monitor of the mac, the I connected the power adapter of the AverKey box and an extra plug to connect the DirecTV box, therefore now whenever the mac power on, the other boxes are also power on. Reviewing the Apples documentation, I created a program called powerOn to schedule power on events to the mac. So the program TV Cron handles:
Two shell scripts are used, setPowerOn and setDate, because powerOn and date needed a administrative password to run, this password need to be put in the shells, these programs must be copied to /usr/local/bin where they are protected (I hope) by the mode, this avoid to have to put the password in the main program, which is a greater security risk. The other programs, cscreen, powerOn and setDTV.py also must be copied to the directory /usr/local/bin, the program seek them in that directory. In the end the program TV Cron perform:
And only use about 900 lines to obtain the 10 objectives! But additionally you need to edit the captured archives, also I found a problem when compressing the archives, the sound was unsynchronized to about a second each hour, this gave rise to a group of applescripts, to be used from the Script Menu with QuickTime Player Pro, I use the most:
Plus two applets:
These two last ones, are used while I decide how add compression within TV Cron, in tests apparently is possible to capture while simultaneously a movie is compressed, although the mac only run at 533MHz. N.B.: The graphs of this page were created using SqueakLand.org, which is a pre-loaded Squeak package for use of schools, it is used like a normal application, publishing projects (archives with extension .pr) locally or in the network, besides of drawing tools and presentation, comes with a graphical form of programing called EToys, useful to teach programming to children. |