random findings by wt8008
RSS icon Home icon
  • MythTV and XBMC Integration

    Posted on May 28th, 2012 wt8008 No comments

    MythTV’s main purpose is to function as a DVR. XBMC’s purpose is geared towards functioning as a media player—to interface the TV with all media stored on the computer, network, or even the internet. Both are designed with a 10-foot user interface for an HDTV, but XBMC’s interface is more polished. XBMC is cross-platform and is officially available for Linux, Windows, and OSX/ATV.

    XBMC has the basic photo, music, and video viewer just like MythTV, but XBMC’s strength is in its add-on capability. Add-ons extend the functionality of XBMC. Many add-ons reformat website data online and display it directly in XBMC. Examples of add-ons are YouTube, Hulu, Netflix, and podcasts networks. It is also useful for bringing internet-only content to the TV. Official add-ons can be directly downloaded within XBMC. The large XBMC community also provides unofficial add-ons, these add-ons can be found on the XBMC forums. One unofficial add-on is xbmc-addons-chinese, which provides an interface to Chinese websites with flash video and live streaming TV channels. There are also add-ons for other international communities. Some add-ons are platform dependent, if they relay on external supporting applications.

    An official add-on is MythBox which provides can access a MythTV backend. It can replace the main features MythTV’s frontend for watching videos and recordings. Watching live TV is also available, but the interface for changing channels is clunky requiring the on-screen tv guide.

    MythTV Integration

    Currently, I use a combined MythTV frontend/backend setup with Mythwelcome to automatically turn on and off my HTPC for recordings. I am also using LIRC with a remote control.

    A simple way to integrate XBMC into such a setup is to allow the user to launch XBMC directly from the frontend. You can add an XBMC menu entry in MythTV’s menu xml file.

    I am using the media center menu theme, so the corresponding menu xml file is located in /usr/share/mythtv/themes/mediacentermenu/mainmenu.xml

       <button>
          <type>MENU_XBMC</type>
          <text>XBMC</text>
          <description>Launch XBMC</description>
          <action>EXEC /usr/bin/xbmc</action>
       </button>

    The advantage of launching XBMC from the frontend is that MythTV will stop responding to LIRC commands until XBMC exits. The LIRC daemon will send the key action to both programs, if you were to open them separately.

    LIRC Setup

    To map the LIRC remote commands to XBMC actions, you edit ~/.xbmc/userdata/Lircmap.xml:

         <remote device="LIRC_Remote_Name">
            <title>GUIDE</title>
            <playlist>BACK</playlist>
            <menu>MENU</menu>
            <info>INFO</info>
            <back>EXIT</back>
            <up>UP</up>
            <down>DOWN</down>
            <left>LEFT</left>
            <right>RIGHT</right>
            <select>OK</select>
            <myvideo>A</myvideo>
            <mymusic>B</mymusic>
            <mypictures>C</mypictures>
            <mytv>D</mytv>
            <back>BACK</back>
            <pageplus>CHUP</pageplus>
            <pagedown>CHDOWN</pagedown>
            <play>PLAY</play>
            <pause>PAUSE</pause>
            <FastFoward>FASTFOWARD</FastFoward>
            <Rewind>REWIND</Rewind>
            <Stop>Stop</Stop>
            <one>ONE</one>
            <two>TWO</two>
            <three>THREE</three>
            <four>FOUR</four>
            <five>FIVE</five>
            <six>SIX</six>
            <seven>SEVEN</seven>
            <eight>EIGHT</eight>
            <nine>NINE</nine>
            <zero>ZERO</zero>
            <select>ENTER</select>
            <skipnext>PGUP</skipnext>
            <skipprevious>PGDOWN</skipprevious>
        </remote>
    

    Smartphones can also function as a remote control using an app. XBMC system settings need to be modified to enable access.

    Final Words

    With the XBMC add-ons, you do not need to record some network shows, because they are available directly in XBMC over Hulu, although the streaming quality is not as good as free OTA broadcasts. For some shows like news, the lower bitrate is acceptable. There are multiple add-ons with link to different US and international TV networks and sites. With the wide selection of add-ons, XBMC is a great addition to an HTPC.

    There is a PPA available with instructions for Ubuntu users.

  • Chinese Characters in Flash

    Posted on July 17th, 2009 wt8008 No comments

    With flash, Chinese (font) characters show up as boxes instead of the character itself. To remedy the issue

     $ sudo rm /etc/fonts/conf.d/69-language-selector-zh-cn.conf

    I don’t like the shipped configuration default for Ubuntu CN anymore. Don’t worry this is only removing a symbolic link.

    Create a new file /etc/fonts/conf.d/63-wqy-zenhei.conf and populate it with

    <?xml version="1.0"?>
    <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
    <fontconfig>
    <alias>
    <family>sans-serif</family>
    <prefer>
    <family>WenQuanYi Zen Hei</family>
    </prefer>
    </alias>
    <alias>
    <family>monospace</family>
    <prefer>
    <family>WenQuanYi Zen Hei</family>
    </prefer>
    </alias>
    </fontconfig>

    This files adds the WenQuanYi Zen Hei font to the sans-serif and monospace font families.

    Next, in the 30-cjk-aliases.conf file accept the WenQuanYi Zen Hei font as acceptable mappings to Windows fonts such as SimSum and MingLiu. Make sure that the font is first, as the system will pick the font by ordering. A sample snippet of affected areas

    <!-- Aliases for Simplified Chinese Windows fonts -->
    <alias>
    <family>SimSun</family>
    <family>NSimSun</family>
    <family>SimSun-18030</family>
    <family>NSimSun-18030</family>
    <family>宋体</family>
    <family>AR MingtiM GB</family>
    <accept><family>WenQuanYi Zen Hei</family></accept>
    <accept><family>AR PL UMing CN</family></accept>
    <accept><family>AR PL ShanHeiSun Uni</family></accept>
    </alias>
    <!-- Aliases for Traditional Chinese Windows fonts -->
    <alias>
    <family>MingLiU</family>
    <family>細明體</family>
    <family>PMingLiU</family>
    <family>新細明體</family>
    <family>AR MingtiM BIG-5</family>
    <accept><family>WenQuanYi Zen Hei</family></accept>
    <accept><family>AR PL UMing TW</family></accept>
    <accept><family>AR PL ShanHeiSun Uni</family></accept>
    </alias>
    <alias>
    <family>標楷體</family>
    <accept><family>WenQuanYi Zen Hei</family></accept>
    <accept><family>AR PL UKai TW</family></accept>
    <accept><family>AR PL ZenKai Uni</family></accept>
    </alias>
    <!-- Alias for HKSCS -->
    <alias>
    <family>Ming (for ISO10646)</family>
    <accept><family>WenQuanYi Zen Hei</family></accept>
    <accept><family>AR PL UMing HK</family></accept>
    <accept><family>AR PL ShanHeiSun Uni</family></accept>
    </alias>

    Now, Chinese charaters in font work correctly without editing 49-sansserif.conf to map unknown fonts to sans instead of sans-serif. The solution which others have suggested created an issue with the font of a buddy on pidgin.

  • 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.

  • Ubuntu Resolve Hostname

    Posted on February 7th, 2009 wt8008 1 comment

    I wanted to ping my vmware-player system using its hostname. The easiest way to do this is to install samba on the server computer, and let samba announce to the network my hostname.

    Everyone on the network that can pick up and process those packets will know about the hostname.

    Playing with /etc/nsswitch.conf and /etc/dhcp3/dhclient.conf does not make an effect that I can notice.

    Edit: Apparently I only tested from my laptop. My Desktop (the host system for vmware) cannot ping the hostname of my vmware-client directly, but it can reach it via .local from avahi. Some weird configuration somewhere. I should try with a livecd.

    Edit: Samba worked fine for Ricky’s Windows PC to Ricky’s eee running Ubuntu.

  • Ubuntu 8.10 avarice USB permission issue

    Posted on January 9th, 2009 wt8008 No comments

    Apparently lots of people are having issues with permissions with USB devices, mines is the AVR Dragon. Using sudo allows the command to work. Most people change the udev mask rules to 0666 to allow everyone to read and write. I found that in Ubuntu the package does not setup the udev rules file properly.

    When installing the packages the file /dev/udev.d/avarice.rules already exists to setup the permissions and group.

    Snippet:

    # Atmel Corp. AVR Dragon
    ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2107", MODE="0666", GROUP="dialout"
    

    The avarice.rules file is linked to /etc/udev/rules.d/z60_avarice.rules, but it does not work, so create a new link:

    cd /etc/udev/rules.d
    
    sudo ln -s ../avarice.rules 60-avarice.rules
    

    Replug in the AVR Dragon and it should work, assuming you are in the dialout group. You can check the /etc/group files to see if you are a memeber of that group.

  • 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