MythTV on Windows?!

Welcome to MythTV on Windows

MythTV is complicated to setup.  MythTV only runs under Linux.  MythTV is only for people who like to tweak their setups all the time…These are some of the stereotypes surrounding MythTV.  While this may have been true at one point things have gotten much easier lately.  One of the things that has gotten a lot of recent attention is building and running MythTV on Windows.

For a number of years there have been ways to access MythTV recordings from Windows.  MythTV has a DLNA server built into it so any DLNA client can access the recordings.  The problem with this is that there is no way to access LiveTV, no automatic commercial skipping, no scheduling recordings, and other features are missing as well.  More recently, someone developed the MythTv Player which is able to talk to the MythTV backend using the MythTV protocol.  This brought along automatic commercial skipping, and in later releases, LiveTV capabilities.  Still, there was no program guide for scheduling recordings and no access to videos or music.

Most recently, a handful of real MythTV developers have taken it upon themselves to get the native MythTV frontend application working under Windows.  There have been a number of challenges along the way; not all of the features are functional yet and there are still some bugs to work out but it is now possible to run the MythTV frontend application natively in Windows.

There are a couple of reasons that having MythTV available on Windows is important.  First, I know that there are a lot of people who use MythTV under Linux (myself included) and have at least one system at their disposal that is running Windows.  It would be nice to be able to watch recordings on those systems from time to time.  The second reason is that, let’s face it, there are a large number of Windows users out there who, until now, have not had access to MythTV.  MythTV is a great Home Theater PC software package that should be available to as many people as possible.

So now the big question is, how do you do it?  Well, there are two options.  While MythTV does not distribute precompiled binaries, it is possible for third parties to do exactly that.  All of my use of MythTV under Linux has been by way of third party packages (atrpms.net is what I use for Fedora/CentOS installs).  Similar work has been done for Windows and you can pick up an installer here or here.

The other option, and the one that I’m going to describe in more detail for you, is to build MythTV from source.  I do not want to duplicate all of the instructions that have already been written on the subject – links will be provided shortly.  Instead I want to augment those instructions with the modifications that I needed to make in order to get things to install on my computer.  You can build it from Linux, Mac OS, or Windows but this guide will detail only building from Windows.  To get started, there is a Wiki page on MythTV.org that describes pretty much how to do everything.  However, another MythTV user has helped us out by putting together a nice script that does pretty much all of the work for you and it can be found here.  In order to run this script there are two things that you will need: MSys and mingw32.  Both of these applications are linked to from the script’s website on the page Building MythTV on Windows.  What they will give you is an environment similar to the Linux command prompt, which you can use to build MythTV.

Once the environment is setup, you will be ready to run the build script as described in the instructions.  There are many options that can be used when running the script.  Here is what I used:

$ ./mythbuild.sh -t 2 -r -b fixes/0.24

Breaking this down, -t 2 tells the script to change the timeout from a default of 60 seconds to 2 seconds.  At various points during the build it will pause and put up a note telling the user which part of the build script is about to run.  Since there are a number of steps to go through, this will cut a reasonable amount of time out of the build process.

The next option, -r, tells the script to build using official releases of the code and not code that is still being developed.  This option will be used by default, but it never hurts to add it.

The final parameter, -b fixes/0.24, tells the script which branch to use when building MythTV.  0.24-fixes is the most recent official release as of the time of this writing.  However, if this parameter is left out then it will build using head/master depending on which terminology you wish to use.  This is the bleeding edge code that the developers are working on but it isn’t recommended to use, at least on a production system, because it isn’t guaranteed in any fashion to be stable.  There may be, and likely are, bugs throughout the code as it is being written.  But if you want to get a glimpse at the latest features you can build it if you want.

Once the build script is launched, you will get a confirmation of the options that it will build and then pressing “Enter” again will start the process.  The build time will vary depending on the system being used and the speed of your internet connection.  I’ve heard mention of the process completing in as little as 15 minutes on a fairly new system.  In the case of my Core2Duo laptop, the build process took more than an hour and then I walked away. 

For me, the build process wasn’t 100% smooth; it was more like 95%.  There were a couple of problems that I ran into, the first problem being that the script complained that it ran out of memory when building QT. This has been noted by a number of users running this script and it seems to be resolved in every case by launching the script again (and again if it dies there the next time).  Inevitably though, the build process will get past that step if you keep at it.

The other two problems that I ran into were syntax errors in the script.  I recommend making a backup of the original script in case something goes south.  The errors were bypassed by commenting out lines 1814 to 1834 as follows:

#  MacOSX-i686) args="$args -arch x86 -little-endian" ;;&

#  MacOSX-PPC) args="$args -arch powerpc -big-endian" ;;&

#  MacOSX*)    args="$args -no-framework"

#

#      # Dwarf2 symbols cause memory exhaustion in debug build

#      args="$args -no-dwarf2"

#

#      # MacOSX qfontengine includes fontconfig.h unless explicitly disabled

#      args="$args -no-fontconfig"

#

#      # Pass system root to configure to detect PLATFORM_MAC

#      QT_SYSROOT=`$xprefix-cpp -v 2>&1 </dev/null | grep -m 1 /System/Library/Frameworks | cut -d ' ' -f 2`

#      export QT_SYSROOT=${QT_SYSROOT%/System/Library/Frameworks}

#

#      case "$QT_SYSROOT" in

#          # Force carbon while using 10.4 SDK

#          *MacOSX10.3*|*MacOSX10.4*) args="$args -carbon" ;;

#          *) ;;

#      esac

#   ;;

And then also commenting out lines 1970 and 1971:

#  MacOSX-PPC) : ${cpu:=g3} ;;&

#  MacOSX*) targetos="darwin" ;;

It appears that these lines of code are used for building the Mac version of MythTV, so there is no loss here in commenting them out.  The line numbers may change as changes are made to the build script but more than likely the general area will remain the same.  Before making changes to the code, I recommend running the script as is.  It is always possible that the developer of the script will fix these problems in the near future.

Once the above speed bumps are ironed out, the build process should complete without further problems.  If you used the default paths when installing mingw, MSys building MythTV, you will end up with a file called mythfrontend.exe located in C:\MinGW\msys\1.0\home\<user name>\mythinstall\win32.  To verify the version information, you can run the following from your home directory:

$ mythinstall/win32/mythfrontend.exe –version

When you run this command you will see something similar to the following:

Please attach all output as a file in bug reports.

MythTV Version   : v0.24.1-85-ge16613a-dirty

MythTV Branch    : fixes/0.24

Network Protocol : 63

LibraryAPI      : 0.24.20110505-1

QT Version       : 4.7.0

Options compiled in:

 release using_backend using_frontend using_iptv using_libfftw3 using_libudf using_mheg using_opengl_video using_opengl_vsync using_qtwebkit using_opengl using_ffmpeg_threads using_live using_mheg using_libudf

This shows all sorts of useful information.  In the above command response you can see that I built MythTV version 0.24.1-85.  You can also see what components were included in the build (using_backend, using_frontend, etc).  Hopefully at this point you will see something similar.

So now it’s time for you to try this for yourself.  Go on and try it out.  When you’re done, leave a comment in the forums and let us know how your build went.  Was it smooth?  Did you have any problems?  Let us know!