CrushTV : A Mac TV Mod
Written by Ben Spink   
Thursday, 01 September 2005
Mac TV Mod (CrushTV) : Enabling web based viewing, scheduling, and recording of your TV tuner card.

CrushTV : A Mac TV Mod

Enabling web based viewing, scheduling, and recording of your TV tuner card.

September 1st, 2005, 12:00 AM ET by Ben Spink : This e-mail address is being protected from spam bots, you need JavaScript enabled to view it


Background

I finally decided it was time to sell off my series 2 Tivo and get my money back out of it while I could. I was frustrated that I didn't have a legit, easy way to get the movies off of the Tivo, and to my Mac. To add to my annoyance, Tivo didn't support MacOS 10.4 Tiger and I could no longer use my TV for slideshows, or streaming Internet radio. I knew if I got a tuner card for my Mac, I could write applescripts and other software to interface and make my Mac into my own media center. I wanted slideshows, music, and videos...I got it all now, and much, much more.

Hardware
I started out by purchasing a TV tuner PCI card from Miglia.
I chose it over EyeTV mainly because of price. I would have preferred a firewire option...but again, price was my main factor. It comes with a remote, and integration with TitanTV.com for recording shows. My video card (ATI Radeon 8500) already has support for S-Video out, so I used that to connect my computer to my TV.
miglia.png

My TV only has RCA input. I already had a S-Video to RCA adapter. It however did not display properly on my TV. I figured out that combining two wires in the S-Video cable allowed for things to sync up right. I forget where exactly I read the info, but it was easy to do with trial and error. My machine also has two other ATI 7000 PCI cards in it with video out's. However I learned that it takes around 10% of my CPU just to send the video data to either of those cards when video is playing. Because of this, I used my main AGP card to save myself the CPU hit. Keep that in mind if you are using a PCI card for video out. radeon7000.png


Here is my monitor arrangement. The TV output is the small one on the top. I wanted to put it at the bottom, but then my dock moved down to it. For perspective, the big ones are 1920x1440, and the small TV one is 800x600.

arrangement.png

Specs

My desktop machine used for all of this is a Mac G4 QuickSilver 2x 1 GHz, 1.5GB RAM, 2x 200GB drives, AGP ATI 8500, PCI ATI 7000, PCI ATI 7000, and the PCI Miglia TV Tuner.

Additionally I use a Treo 650 phone as my remote control...more on that later. The remote control that came with the card from Miglia just wasn't going to cut it.

Description
There are several parts to this project. Here is an overview:
--Ability to use a web front end for scheduling shows.
--Ability to do live streaming of shows.
--Ability to use FTP to download shows.
--Ability to play music via iTunes to my home stereo.
--Ability to put on slideshows via iPhoto.
--Ability to play videos with VLC, or Quicktime Player.
--Ability to control all aspects with the Treo phone as a remote control via bluetooth.
--Ability to use a remote machine to control most aspects that make sense.

I started by installing Salling Clicker on my phone, and computer. This allowed me to control iTunes, iPhoto, and VLC from the phone anywhere within range of my bluetooth antenna. My first issue though was that when playing back a movie, I wanted to know where I was at in the movie, and what movie was playing via the phone. The built in VLC script didn't do this at all. It would start the movie, but not give you any feedback about the current movie. So this was the first part that I had to write. Soon I had an applescript for Salling Clicker and VLC that did just exactly that.

The next issue was that I wanted to have my movies organized and easy to browse via the Treo. I wrote another applescript for Salling Clicker that allowed me to browse my archive or recorded shows, and play the one I wanted. When I hit play, it launched my VLC script which then gave me feedback as to the current position of playback and what movie was playing.

I could now play back movies I had previously recorded. Now I wanted to access them via a web browser. I wanted to be able to do this when I'm not at home, but still had a broadband connection.

I installed Apple's Darwin Streaming Server. I set the location it used for its movies to be the same place I stored all my recordings. Now the problem was that my recordings were all around 1.5GB, MPEG4. Totally unsuitable for streaming.

At this point I decided I needed to have an applescript that just sat on my host machine converting movies as it found them to a format that could be streamed. I called this part "PVR_Processor". It scans a list of known upcoming recordings to see when a movie should be waiting and ready. It then opens the movie in quicktime and exports it as a H.264 320x240 video, AAC audio, streaming hinted movie. Its bit-rate is about 330kbps so it should work on an outgoing connection of 384kpbs. It then flags its list of recordings as exported. It also handles other task like going out and scheduling all shows of a particular name to be recorded. I use this to record all episodes of "The 4400", "Arrested Development", and "Scrubs" for example.

Now that my TV recordings had been exported to a streaming format, I was able to watch them live anywhere I had a web browser and Quicktime 7. Next, I worked on the web interface for watching the shows. I wrote some .jsp Java pages to allow me to login, browse my recordings, and start watching the exported version live right then.

browser.png

No need to wait for the entire show to download, you can scrub around in the show live to whatever part you want. This is a huge benefit of the rtsp:// protocol (Real Time Streaming Protocol) as opposed to just downloading the movie and playing it locally. This is an incredible benefit of using the Darwin Streaming Server.

movie.jpg


Next I expanded the web pages I wrote to include the ability to schedule new shows, cancel recordings, and setup users who are allowed to access the web pages. The user setup is fairly configurable allowing you to specify who can record, view shows, cancel shows, schedule new ones, record shows, see the calendar, add more users, or change the overall configuration. So you can retain control while letting your kids watch shows on their laptops for example.

admin.png

I allowed the "PVR_Processor" application to take advantage of these web pages, and pass that functionality back to the Salling Clicker scripts, and ultimately back to my Treo. Granted, I could always use the web browser on the treo, but that wouldn't be the most elegant solution.

To handle the calendar of my upcoming recordings, I wrote the shareware application "iCal2Web". I couldn't believe there wasn't a utility out there to easily convert your existing iCal calendar to a customizable HTML web page. Seeing a need, I wrote one. I then used that calendar via my TV web interface, and replaced dates on the calendar with info and links about the recordings that are going on. Finally I display the modified calendar to the user to use. The calendar is automatically generated every hour, so its pretty much always up to date. Below is an example calendar:

calendar.png

Conclusion
So lets sum it all up. From my home, I can use my Treo 650 phone to browse my movies, play a movie, adjust the volume, pause, resume, etc. I can use it to play a slideshow and control the slideshow. I can use it to schedule a new recording, cancel a recording, view show descriptions, duration, etc. I can play iTunes music with complete control as well.

treo_find_show.jpg
Search for a show...
treo_found_shows.jpg
List of shows returned...click a show and it gives the description of the episode.
treo_schedule.jpg
List of previously scheduled shows...
treo_4400_movies.jpg
List of shows / movies availble to start watching...
treo_vlc.jpg
Pause / play, 30 sec forward, 5 sec back, volume, show name, current position in show...could also add show description info here, but have not done so yet
treo_itunes.jpg
This is the only script I didn't make...it is the standard iTunes script for playing music

From the internet, I can schedule new recordings, delete scheduled items, etc. The top items highlighted in blue are the automatic recordings that schedule all the other items you see below. You can click the link to force the schedule to be refreshed right now. At the bottom you can see part of the search form for finding a show you want to schedule, or just to get more info about a show.

schedule.png

I can browse previously recorded shows, watch one on demand with live scrubbing to any point in it, view a calendar of upcoming shows, download an entire recording to my hard drive via FTP, etc. As an extra bonus, I can watch previously recorded shows on my phone as well. I don't use this except to impress friends, but it does work surprisingly well. (Sanyo MM 7300 on the Sprint Vision Network)


All of this represents countless hours of playing around, programming, debugging, packet sniffing, and testing again and again. My time spent though, is your gain.


How-to Guide
First, download and install the required server items. You will need:


Tomcat $(free)

Click the download link, and then click "Complete Tomcat 4.1.24" to download the installer. You can install this manually if you want, but this is a simple package that makes it incredibly easy.
The installer even starts the server for you.
Test that it is working by going to http://127.0.0.1:8080/ after its installed.
If you get a web page to load, then tomcat is working!


Darwin Streaming Server $(free)

Scroll down to binary releases and download the appropriate server item.
You will be asked for your Apple ID. This should be your iPhoto login, iTunes login, .Mac account, whatever.
The installer will open your web browser when its finished for the last few setup steps of the install.
Enter your username, and password for it, then I used the defaults until the location for the
streaming media ("/Library/QuickTimeStreaming/Movies/"). This I changed to my home
directory : "/users/ben/Movies/". I did not enabled streaming on port 80.
Download my sample test.mov (a hinted streaming movie) and try and play it via Quicktime.
Put it in your home directory as you set above. Then use Quicktime Player and go to this URL:
rtsp://127.0.0.1/test.mov   or   rtsp://127.0.0.1:8000/test.mov
If the movie plays, your streaming server is working!


iCal2Web $8

I used a settings file with these three lines in it. Be sure to use the right calendar name as it
seems to change every so often with Miglia...
Frequency: 1
OutputFileName: PVR_calendar.html
Calendars: AlchemyTV


CrushTV $(???)
First, edit a couple files. Edit the script.jsp file in the Tomcat/CrushTV/ folder and change my username of "bens" to be yours.
Second, edit the PVR_Settings.txt file and put your username in there for the path as well.

Copy, or move the "PVR_Settings.txt" to your home directory on OS X.
Copy, or move the "CrushTV" folder to your tomcat "ROOT" folder "/Library/Tomcat/webapps/ROOT/".
You will probably have to just move the folder there, and click authenticate (when the Finder prompts you) as the owner for tomcat I believe is root.
The default location for Movies is the "Movies" folder in your user's home.

Use a web browser and go to: http://127.0.0.1:8080/CrushTV/
Login with user:admin, pass:admin.



Thanks for reading this article. I hope you have enjoyed it! I'm sure it will give you some new ideas to play around with. You now have control over your TV.

Enjoy!

--Ben Spink ( This e-mail address is being protected from spam bots, you need JavaScript enabled to view it )




Be first to comment this article

Write Comment

Name:
Comment:

Code:* Code
I wish to be contacted by email regarding additional comments



 
< Prev   Next >