" /> UrlBlogGrey: June 2008 Archives

« April 2008 | Main

June 7, 2008

Audio Distortion with the Hauppauge PVR-150 and MythTV

I've been using the Hauppauge (pronounced hop-awg) PVR-150 to record standard-quality television from our Comcast Digital Cable service. So, far, the quality and performance of the card has been outstanding, especially when considering the cost of the card (~$75). It comes with a hardware MPEG-2 encoder that imposes hardly any load on the MythTV backend when recording because the compression and encoding of the video & audio is performed in hardware. This leaves plenty of system resources for other tasks, such as playback or transcoding into other media formats.

But there has been one problem that occurs intermittently: the audio on live & recorded programs will sound like it's being projected from a tin can. The sound is discernible, but wrong. Enduring an hour-long program with bad sound can be difficult.

At first, I wasn't sure if the sound distortion was coming from the digital cable box, the PVR-150 encoder card, or MythTV playback. We had never experienced this kind of audio distortion with our old Tivo service using the same digital cable box, so I had to rule out the cable box. Also, we never had any problems when using the PVR-150 tuner input, which combines video & audio in a single input. I had recently switched from the tuner input to the composite audio & video input on the PVR-150 due to the generally higher quality they deliver in comparison to coaxial feeds. So, I concluded that problem was with the PVR-150 composite audio input.

I'd noticed that leaving and then promptly returning to the channel would resolve the problem. But this is not possible when recording programs while away. After reading several posting on MythTV user lists, I decided to modify the channel-change script to fork a background that re-establishes the audio input 2 seconds after the channel-change script returns. This has worked successfully for a week now, which is a marked improvement over where we were.

The following shows the channel-change script:

[scott@eowyn ~]$ cat /usr/local/bin/change_chan.sh 
#!/bin/sh

# send infrared signals to change the current channel
REMOTE_NAME=comcast
for digit in $(echo $1 | sed -e 's/./& /g'); do 
  /usr/local/bin/irsend SEND_ONCE $REMOTE_NAME $digit
  sleep 0.4
done
/usr/local/bin/irsend SEND_ONCE $REMOTE_NAME "ok"

# start audio fix script in the background
/usr/local/bin/ivtv_audio_fix.sh &

And the following shows the contents of the audio fix-it script that runs in the background after the channel-change process has finished.

[scott@eowyn ~]$ cat /usr/local/bin/ivtv_audio_fix.sh 
#!/bin/sh

sleep 2

# reset the audio input to source 1
/usr/local/bin/v4l2-ctl --set-audio-input 1

I'll also mention that I don't notice any glitches in the audio despite the fact that the fix-it script runs 2 seconds after the channel has been changed.