Tuesday, August 21, 2007

Recording Standard Definition TV from DirecTV with MythTV

In a followup to my note to myself on playing live TV from my satellite box using mplayer, this is about integrating a pcHDTV 3000's s-Video input into my MythTV system.

It would, of course, be nice if I could get all the programming I want in unencrypted HD, but sometimes all you can get or afford is old fashioned analog. In my case, I have a D12-300 DirecTV satellite receiver on my desk, this extra receiver costs me $5 a month over the cost for the receiver in the TV room, so it's a fairly good deal. What makes it a better deal is using my MythTV to time shift, skip commercials and watch it anywhere in the house wirelessly onto my MacBook.

Hardware



Most of the hardware I already had. I did purchase the USB to serial adaptor—according to accounts on the web not all adaptors work with DirectTV receivers—and the null modem adaptor.

Hardware setup

I plugged the USB end of the USB to serial adaptor into the DirecTV receiver, and the serial end into the null modem adaptor. I plugged the other end of the null modem into the serial port of my Dell Dimension—tighten those screws. I plugged the s-Video cable into the s-Video output of the satellite receiver, and into the s-Video input of the pcHDTV card. I plugged the RCA jacks of the audio cable into the red/white outputs of the satellite receiver and the mini-jack end into the line in port (2nd from the right) of the AV-710.

Software setup

My previous posting described setting up the system audio to activate the line in port for audio input. I would follow those instructions now, to confirm you can see and hear live TV via mplayer.

As I will be using a script to change channels over the serial port, I want a non-root user account to open up the serial port device, so as root from the command line:
# chmod a+rw /dev/ttyS0

I would test this by running your copy of the directv.pl script. For example:
$ /usr/share/mythdora/directv.pl 231
should bring up the Food network. (Your path will be different, probably.)

I went to my account on (the soon to be discontinued) zap2It labs and setup a listing grabber for DirecTV, limiting it to the 10 or so channels I would conceivably watch.

Then I ran mythtv-setup.
  • Capture Cards
    • Card Type: Analog V4L capture card
    • Video device: /dev/video
    • VBI device: /dev/vbi
    • Audio device: /dev/dsp
    • Audio sampling rate limit: 48000
    • Do not adjust volume: Checked
    • Default input: S-Video
  • Video Sources
    • Video source name: DirectTV
    • Rest of the settings are dependent on your having setup up a listing grabber for DirecTV
  • Input connections - [V4L :/dev/video] (S-Video) -> DirectTV
    • Display Name (optional): DirecTV
    • Video source: DirecTV
    • External channel change command: /usr/share/mythdora/directv.pl (your path will be different)
    • Preset tuner to channel: 231
    • Click on the Fetch channels from listing source
    • Starting channel: 231
    • Input priority: -1


Of course, I kept my pcHDTV's DVB setup to record over the air digital HD programming, although I did change the Recording Options for the Capture Card to only "Open DVB card on demand".
[Update: somewhere along the way, I lost ATSC tuning for the pcHDTV card, and I'm having a hard time getting it back. For me, this is not an urgent matter as I have the two tuners in my HDHomerun, but obviously it would be important to anybody with only a pcHDTV. I'll try to figure this out, but I think it has to do with a conflict between my kernel version and the DVB drivers.] [Update 2: I updated mythtv to the current build to support Schedules Direct and it works again. I apparently can now record off of one of the pcHDTV's outputs at a time (not both at once.)]

At this point, you should run mythfilldatabase.

I then restarted the mythbackend, and opened up the mythfrontend, but before watching any TV, I had to setup my recording profiles.
  • Utilities/Setup
    • Setup
      • TV Settings
        • Recording Profiles
          • Software Encoders (v4l based)
            • Default
              • Enable auto-transcode after recording: Checked
              • Width: 720
              • Height: 480
              • Codec: MPEG-4
              • Codec: MP3
              • Sampling rate: 48000
            • Live TV
              • Enable auto-transcode after recording: Checked
              • Width: 720
              • Height: 480
              • Codec: RTjpeg
              • Codec: Uncompressed
              • Sampling rate: 48000

Conclusion

After finishing all this, I was very surprised that I could watch Live TV both at my MythTV box itself, and over wireless with my MacBook, and I could also schedule recordings and it would all work. I like having a wired connection to the satellite box for changing channels, it should be 100% reliable unlike an infrared blaster arrangement. The video is amazingly ugly compared to the beautiful HD I get from my antenna, but then again, it's going to be a while before Good Eats comes in over the air.

I keep my audio sampling, storing and playback rates at a constant 48000 Hz as it is the standard playback rate for the PCM stereo audio which will eventually go out the optical port to my audio receiver, and I don't see the point of adding another possible failure point in the sampling conversion. My previous MythTV install made 44.1Khz recordings sound high pitched.

I'm just glad I'm done with this, and I hope this saves you some time.
 
Google+