random findings by wt8008
RSS icon Home icon
  • HDHomerun, Comcast QAM, MythTV

    Posted on September 4th, 2010 wt8008 2 comments

    With my new HDHomeRun, I need to setup MythTV backend to get channels from Comcast unencrypted QAM.Mythbuntu comes preinstalled with the hdhomerun_config command line and GUI tools, under Applications->Multimedia->HDHomeRun Config GUI. If it is plugged in the “Scan” button will discover any tuners on the network. Also, if you plug different sources into HDHomeRun, such as Cable and OTA, note the tuner numbers for later reference. If you have dual tuners you will have two entries. From there, you can flip through the channels and view what streams exist under that channel. With the “View” button VLC will open and play the video stream.

    HDHomeRun Config GUI

    HDHomeRun Config GUI

    The device ID of your HDHomeRun can be found by

    $ hdhomerun_config discover

    The output will look like

    hdhomerun device XXXXXXXX found at Y.Y.Y.Y

    where the XXXXXXXX represents the HDHomeRun ID, and Y.Y.Y.Y is the IP address. You should note the ID for use later on.

    Channel Scanning

    Integrating into Mythtv is not as direct as I hoped. The scanner built into Mythtv 0.23 does not handle the Comcast QAM stream properly. It can scan the channels, but it cannot use the virtual channel numbers from Comcast, and Mythtv will results in many conflicting channel numbers. Follow the guide at http://www.mythtv.org/wiki/Scte65scan to use scte65scan to scan and discover the virtual channel numbers. The rough procedure from the wiki is below:

    1. Run mythtv-setup to configure the backend.
    2. Setup section 1: General, and section 2: Video sources. Do not setup the other sections (or else the database dump of scte65scan will not work, maybe using -f4 as a command line option is a workaround and also default sourceid=1 , not tested or tried yet.)
    3. Download scte65scan source and HDHomerun libraries, follow the instructions to compile and for editing the HDHomrun Makefile.
    4. The VCT_ID for my area is 3065 (0x0bf9), after following the instructions on the wiki to discover them (the scan takes a few minutes):

    $ ./scte65scan -H FFFFFFFF us-Cable-Standard-center-frequencies-QAM256

    5. Now the SQL script will be generated to be used to import into Mythtv.

    $ ./scte65scan -H XXXXXXXX,0 -p -f3 -V 3065 us-Cable-Standard-center-frequencies-QAM256 > vct.sql

    Recall XXXXXXXX is the HDHomeRun ID, the 0 after it represents the tuner number, -p option is needed for the local PSIP channels in the cable stream, -f3 for SQL install script, -V 3065 where 3065 is my local areas VCT_ID, us-Cable-Standard…. is a file containing the channel frequencies that will be scanned, and finally vct.sql is the output SQL script. Read

    $ scte65scan --help

    for more details.

    6. Next import the output to the SQL database

    $ mysql -u mythtv -p mythconverg < vct.sql

    This allows you to access the mythconverg database as the mythtv user, but remember to lookup the database password in the Mythtv frontend before you proceed. The other method is to logon as -u root, if you remember the initial password you setup for it. If you get an error regarding

    ERROR 1062 (2300) at line 4: Duplicate entry '1' for key 'PRIMARY'

    it is due already having video sources defined, you can either delete them, or try different -f options in

    $ scte65scan --help

    7. The channel information entered is viewable in the backend setup under 5. Channel Editor. Continue with the setup by adding the 3. Video Source, and the channels should populate without a scan. Also setup the 4. Input connections.

    The channel scanner for OTA signals works fine, so you can use the internal scanner for that purpose.

    Inferred Sensor

    Using the inferred sensor on the HDHomeRun requires telling the device to forwards the signals to the backend, using lircd on the backend to process the signals into keys, and having mythtv map the remote key presses to keyboard shortcuts.

    The HDHomeRun site has a guide for setting up the HDHomeRun.

    
    
    $ hdhomerun_config  <device id> set /ir/target "<backend-ip>:5000 store"

    The store command saves the setting into flash, so on reboot of the tuner, it will continue to foward the IR commands. Next, use irrecord to let the computer learn each key of the remote.

    
    
    $ irrecord -H udp -d 5000 "<name of remote>"

    Attempt to give generic/general key names, since later a parser will be used to generate the key maps to Mythtv. Copy the resulting file,

    # sudo mv "<name of remote>" /etc/lirc/lircd.conf

    Now to start up lircd the first time, I recommend using verbose mode to watch what happens.

    # sudo lircd -n -H udp -d 5000

    Use irw to test the setup. With irw running press remotes on the key and it will print out the corresponding key that is pressed. If all is well then configure the /etc/lirc/hardware.conf file. Some recommended settings

    REMOTE_DRIVER="udp"
    REMOTE_LIRCD_CONFIG=/etc/lirc/hardware.conf"

    Now, setup the key mapping between lirc and MythTV, Mythbuntu users can use

    $ mythbuntu-lirc-generator

    This will parse the keynames in /etc/lirc/lircd.conf and guess a corresponding key/function in MythTV. Next, manually edit the generated file

    $ vim ~/.lirc/mythtv

    Custom mappings or unmaps keys needs to be manually added in. The format is

    begin
      remote = "<name of remote>"
      prog = mythtv
      button = CHUP
      config = Page Up  
      delay = 0
      repeat = 0
    end
  • Mythtv Remote udev Rules

    Posted on March 22nd, 2009 wt8008 No comments

    I was looking at setting some udev rules for my remote for mythtv, so that if I change the input devices (i.e. add or remove a mouse/keyboard), I want the name of the device to be constant so that I do not need to modify my lirc configuration files.

    I tried to setup this before, when I first setup mythtv (see my earlier mythtv post), but I never got it to work. There were two issues, one is that the filename for the rules was wrong, and also I had issues with the rules themselves. Anyways here is how you do it…

    This is my complete /etc/udev/rules.d/10-localremote.rules file

    KERNEL=="event*",ATTRS{name}=="saa7134 IR (Avermedia AVerTV GO",SYMLINK="input/irremote"

    This will link /dev/input/irremote to the device that is associated with my tv tuner’s IR receiver.

    [email protected]:/dev/input$ ls -l irremote
    lrwxrwxrwx 1 root root 6 2009-03-22 15:06 irremote -> event3

    Right now, it points to event3, but if I plug in my mouse and keyboard irremote will then point to event5.

    The associated file /etc/lirc/hardware.conf should also have the REMOTE_DEVICE field point to the new device.

    There is some way to setup the remote using hal, but I will give that a try another day. See http://www.doctort.org/adam/general/update-on-twinhan-remote-for-mythbuntu-810.html I will give that a try another day.

  • Mythtv Box with HDTV Support

    Posted on October 5th, 2008 wt8008 No comments

    Last month, I completed building a Mythbuntu box with HDTV support. I also have analog support, but who would want to watch TV on that, so I didn’t bother setting that part up. Anyway here is the hardware setup:

    • CPU: Athlon XP 3000+ (from the top of my head Runs at 2.25 GHz)
    • RAM: 1GB
    • HD: 750GB
    • Video card: PNY Geforce 6600gt
    • TV Tuner
      • HDTV: Air2PC rev 2
      • NTSC: Avermedia AverTV Go 007 FM Plus

    The CPU recommended for single core processors are P4 3.0GHz or equivalent for HDTV playback. With only using the CPU alone my computer was able to play back HDTV video, but it was not smooth. A way around this (but not recommended by the community because of issues with using this) is with XvMC, which allows X to use the video card’s processor to accelerate playback. Only the 5000-7000 series close source drivers from Nvidia have the support for XvMC, and also only the 5000 series support color OSD during playback. The menus are in color, but any item that displays on top of the video is in grayscale with XvMC.

    My system was used as as frontend and backend. For HDTV the backend just writes a digital stream to the HD so this does not strain the system. For analog TV, if the tuner did not have hardware encoding the CPU would have to do the lifting, thus the CPU would have to do more work. A seperate backend would help for commercial tagging.

    The video card has S-video, composite, and component video out, along with the standard DVI and VGA (via an adaptor). The HDTV we have that the HTPC is hooked to does not contain any other HD inputs besides component video. My xorg.conf file is located at the end of the post for 1080i output.

    The video settings I have is to have video above 720p and 1080i to play back using XvMC, and for lower resolutions to use ffmpeg. This allows me to smoothly playback HDTV (but there is still another issue), and have color OSD for lower resolutions.

    If I were to use the Avermedia tuner, it is will be detected by the kernel automatically. My Avermedia card came with a remote, so I am using the remote that came with that tv tuner to control Mythtv and mplayer. The infered port should be detected and be under /dev/input/event*. By using the command `cat /proc/bus/input/devices’, you can find the module that goes with the remote. Note that when mice, keyboards, or other input devices are added to the system, the device location may change without udev rules. I have generated a lircd.conf file for my remote. By using the mythbuntu-control-centre, you can setup the remote to use the devinput driver, proper device, and link to the lircd.conf file. Under the users home folder in ~/.lirc/mythtv, the file maps the buttons from the remote file (lircd.conf) to mythtv commands. Both files will be located at the end of this post.

    The Air2PC card requires a firmware file (dvb-fe-bcm3510-01.fw) to be downloaded and placed in /lib/firmware for the kernel to properly use the card. In dmesg output, you will see that the firmware is sucessfully loaded upon boot.

    Issues

    • Using XvMC with OSD is in grayscale and causes the video playback to shutter. When the OSD timesout video playback resumes smoothly.
    • EIT: The electronic programming guide transmitted through the air by the TV stations, sometimes stop over each other. For example, Channel’s 5 programming data will also appear in Channel’s 4 slot. I later found out there is a setting for each channel to allow EIT programming to be disabled on each channel.

    Testing ATSC Card via Commandline

    The dvb-utils package in Ubuntu has utlities for scanning for channels. This will install the scan utilty which will look for channels, it is ran by

    scan /usr/share/dvb/atsc/us-ATSC-center-frequencies-8VSB > channels.conf

    It will save the results of the scan in channels.conf. Some programs, like mplayer use this file for viewing tv. Run mplayer to view TV

    mplayer dvb://

    Now with the tv verfied to be working.

    Setup Mythtv Backend

    1. General Settings
    2. Capture Card
      1. Card Type: DVB DTV capture card for ATSC tuner; NTSC card is Analog V4L capture card – audio alsa:1,0 (or /dev/dsp1) audio sampling limit maybe 32000
    3. Video Source – setup scanning frequncies, and listing grabbers
    4. Input Connections – map a capture card to a video source, also scan for channels in here
    5. Channel Editor – easier to edit with the Mythweb plugin http://mythtvboxhostname/mythweb
    6. Storage Directory – for recordings

    Setup Mythtv Frontend
    Utilities/Setup -> Setup

    General

    • output and mixer device ALSA:default
    • mixer control PCM, so that i can have the master volume at 95%

    Apperance

    • Screen Settings – my tv requires
      • GUI width: 1730
      • GUI height: 1025
      • GUI X offset: 80
      • GUI Y offset: 35
    • Font sizes: Small – 12, Mediu – 16, Big – 25

    TV Settings

    1. General
    2. Program Guide: Eco – Transparent
    3. Playback
    4. Playback OSD
    5. Playback Groups
      • Live TV for v4l can support up to 640 x 480
      • Enable realtime priority threads – need to edit the RTC of the kernel
      • Enable extra audio buffering – without this causes studdering issues on HDTV
      • Disable OpenGL vertical sync for timing – does not properly work for me
    6. Playback profiles:
      • if rez >= 1280 720 -> XvMC-opengl
        • Deinterlace: None or Box (2x) (if a patched is applied and complied in)
      • if rez > 0 0 -> ffmpeg & Xvideo
        • Deinterlace: Kernel
      • Sticky keys and smart fast forwarding settings located here
      • Commerical Skip settings
      • Recording Priorities

    Other settings are for Mythvideo, which is not as complex as setting up the tv part, so that has been omitted.

    Files

    • hardware.conf – goes under /etc/lirc/ remote dev
    • lircd.conf – goes under /etc/lirc/ remote control keys
    • mplayer – goes under ~/.lirc matches remote keys to mplayer options
    • mythtv – goes under ~/.lirc maps remote keys to mythtv options
    • xorg.conf