From MEPIS Documentation Wiki
MythTV is a powerful Digital Video Recorder to watch your television shows on your computer. Features:
- Record television shows
- Watch LiveTV
- Transcode your recorded shows into various formats (default is mpeg 2)
- Scheduled recordings
- TvGuide through Schedules Direct
- Plugin functionality
Users of Hauppauge 150/250/350/500 Cards should read the Ivtv Setup Guide. Many others use the bttv driver which is in the kernel 2.6.x.
In MEPIS 7, 8.x and 11, you should be able to install MythTV using the standard included repositories. However, before you install MythTV you will need to enable Debian multimedia repository. Start Synaptic, goto Settings, Repositories and enable the repository:
Click OK, then click the Reload button.
At this point, it's usually a good idea to apply package updates to eliminate any potential problems that may have been fixed since your last system's update. However, your situation may dictate that you can't update, either because you have software dependent upon a particular package, or you want/need to test the updates to ensure there are no side effects.
If you do not have the command line package management tool aptitude installed it's best to install it in the usual manner before proceeding, as aptitude appears to resolve some package management and dependency issues better than Synaptic.
MySQL is required for MythTV, and has to be installed and running if MythTV is to be installed correctly. If you have MySQL installed already, or you plan on using MySQL on a different system, you can skip to the next step. Otherwise, to install MySQL:
For Mepis 7 & 8, run
aptitude install mysql-server mysql-client
For Mepis 11, run
aptitude install mysql-server-5.1 mysql-client-5.1
For a first time installation, you'll be prompted for a root admin password - you'll need this later for the MythTV install.
You can now install MythTV by running:
aptitude install mythtv
If you are trying to install MythTV on a MEPIS 6.5 install, please consider upgrading to the latest stable Mepis release as many MythTV issues have been resolved with version 0.21.
If you've already installed MySQL on the same system as your MythTV, using the above installation instructions, then your MySQL server should already be properly configured. To confirm the installation run:
mysql -uroot -p <myth_db_name> show tables;
By default, myth_db_name is mythconverg. If your MythTV database has been properly created, SHOW TABLES will display approximately 98 rows of table names.
If, however, you need to manually install MySQL then you'll need to make sure the MySQL server is running. As root:
ps aux | grep mysql
There should be 2 lines similar to this:
root 2916 0.0 0.1 2564 380 ? S 17:08 0:00 /bin/sh /usr/bin/mysqld_safe mysql 2945 0.0 5.1 129396 13056 ? Sl 17:08 0:14 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/lib/mysql/Soldier.pid --skip-locking --port=3
And possibly a 3rd like this:
root 3524 0.0 0.3 3176 792 pts/0 S+ 21:51 0:00 grep mysql
The third doesn't need to be there but the first two have to be there. If you don't see lines similar to the first two lines of output, then you'll need to start manually start the MySQL server. As root, run:
If the MySQL server didn't start then you may need to manually add mysql as a service. To do this, as root run:
update-rc.d mysql defaults
This will add the mysql startup script, ensuring that MySQL properly starts when your system boots. It also allows you to start and stop the MySQL server by running the /etc/init.d/mysql script. To continue with the MySQL configuration, as root run:
Set up a password for the root account, use a secure password, replace 'newpassword' with the new password
mysqladmin -u root password 'newpassword'
Now import the default table:
mysql -u root -p < /usr/share/mythtv/mc.sql
Schedules Direct Setup
Channel listings are available from Schedules Direct. At the time of this writing, Schedules Direct offers a 7-day free trial membership. a $5 USD 2-month, and a $20 USD annual subscription plan. According to Schedules Direct, the 7-day trial membership is applied to all paid subscriptions.
For more information about Schedules Direct visit their FAQ site.
The MythTV backend is the software that acts as the server. The TV Tuner(s) and storage are here, as well as the scheduling and recording related brains. In complex setups, it's possible to have more than one mythtv frontend distributed in different physical locations all acting as a single system (Source: http://www.mythpvr.com/mythtv/).
Before you setup the MythTV backend, you'll need to determine the IP address of the server hosting your MythTV backend. To obtain this IP address run the following command:
To obtain the maximum benefit of a MythTV installation, you really should have a membership to Schedules Direct, or a MythTV compatible program guide service. Make sure you have your Schedules Direct login information for the backend configuration.
You're now ready to start setting up the MythTV backend, but you need to stop the myth-backend process first. To stop the backend process and begin setup, run the following commands:
/etc/init.d/mythtv-backend stop mythtv-setup
mythtv-setup starts the configuration, displaying a menu of 5 or more different items. Select General. On this screen you should only need to change the IP address for the Local Backend and Master Backend - enter the IP address you obtain from the ifconfig command for both entries. This setting is crucial to having a proper MythTV backend/frontend configuration, and if you want to utilize UPNP clients (such as a Playstation 3) to consume content from your MythTV backend system.
For the port numbers it's best to use the default settings, but if you've modified the port numbers that the MythTV uses then you'll need to specify them here.
Select Next, and choose your TV Format, VBI Format, Channel Frequency Table, and Local Timezone. The default settings on the remaining configuration screens should be sufficient, so continue to select Next. At the final screen, click Finish.
You should now be back to the main menu, and ready to add your capture card. Select Capture Cards, then New Capture Card. Proceed with the configuration selecting the proper settings for your capture card, then select Finish.
Back at the the main screen, you need to configure your video sources (Schedules Direct). Select New Video Source. Enter a Video Source Name. Select your Listings Grabber option. Enter your account information, click Retrieve Lineup. Click Finish.
From the main menu, select Input Connections. Look for a listing that has Tuner-><video source name>, where source name is the Video Source Name you entered on the prior configuration screen. For a first time configuration, or if there are ever channel deletions/additions, select the appropriate Input Connection and select Scan for Channels and/or Fetch Channels from Listing Source. You can also specify the starting channel for your program guide. The default settings for the remaining options should be fine, continue to select Next, then Finish.
You should be done with the basic configuration of your MythTV backend.
To restart your mythbackend system run:
If you run into problems, a useful tip is to run the backend process in non-daemon mode with additional debug messages enabled. To do this, simply run the following command in a terminal window:
mythbackend -v all
The MythTV Frontend is the software similar to a set-top box your cable company might provide. It plays back media from other sources (even in that other source is on the same computer.)
Any program recorded on the server, or any other media for that matter, can be instantly watched at any MythTV frontend on the local network. Of course, it's also possible (and most common for new users) to install and run both the "frontend" and "backend" on a single machine that is only connected to one TV or monitor. (Source: http://www.mythpvr.com/mythtv/)
If you've never run the MythTV frontend, then the first thing you'll be prompted to do is configure your MythTV frontend. Configuration is a straightforward process. Select the language to use, click Next, which will take you to the first Database Configuration screen.
Enter the IP address of your MythTV backend. If you are running the frontend on the same machine as your backend, it's still best to use the actual IP address of your MythTV backend and NOT localhost or 127.0.0.1.
The default MythTV backend database settings are:
Database name: mythconverg User: mythtv Password: mythtv
You shouldn't need to enable "Ping test server?" or enter a port number. Click Next.
Enable the Use Custom Identifier for Frontend Preferences and enter a Custom Identifier value, usually the hostname of the frontend system. If this is your first time running MythTV frontend then you should be prompted to Click Finish. Otherwise, the remaining configuration options should be sufficient, so continue to click Next, then Finish.
Once configuration is complete the MythTV frontend menu may take several seconds to actually display. This is because MythTV frontend needs to build properly scaled images, etc.
You should now be able to watch TV (yes, you can watch live TV from your backend server via frontend), watch recorded shows, videos, etc.
Universal Plug and Play (UPNP)
By default, Myth is accessible via UPNP enabled clients. Including, but not limited to MythTV frontend, Sony Playstation 3, and more.
However, you may find that UPNP clients cannot connect to your MythTV backend. The most likely cause for this is that the needed UPNP related ports (TCP port 6544 and UDP port 1900) are blocked by a firewall on your MythTV backend server.
To eliminate this issue add an exception to your backend server's firewall allowing inbound traffic to the appropriate UPNP ports.
Enabling Playstation 3 UPNP
If you're not running a software firewall on your myth system, and it resides on the same network as your PS3, then your PS3 should be able to find, and connect to your mythtv system. Boot your PS3 and access the Video menu, select "Search for Media Servers." If your PS3 was able to connect to your mythtv system this search should display "1 media servers found." Go back, scroll down until you find your mythtv server listed.
If your PS3 was unable to find your mythtv system, your likely running a firewall on your mythtv backend. Make the modifications to your firewall rules that are mentioned above and perform the media server search again.
For mythtv system and PS3 that reside on disparate networks, you'll need to allow inbound traffic for the ports mentioned above from your PS3 into your mythtv system's network.
Optional Myth Software
Mythweb is an extremely useful addon. Mythweb allows users to manage recordings, view guide listings, schedule records, etc. This addon requires apache, php, and php-mysql. To install, as root run:
aptitude install mythweb
Once installed you can access this web application by using the following URL:
If you are accessing this from your backend server then using localhost instead of the IP address will work.
Visit the Mythweb page for more information.
MythTV has many plugins. Visit the MythTV Plugins page for a full listing of available plugins. To install the plugins run as root:
aptitude install mythplugins
In the current version, 0.24x, of Mythtv, video streaming has been incorporated into Mythweb and into a new package, Mythmusic.
For versions prior to Mythtv 0.24
MythTV also has the ability to stream videos, recordings, and music from the Mythweb web application. To install this streaming capability run as root:
aptitude install mythstream
Watching Internet Content
With the release of Mythtv 0.24, users now have the capability of watching videos from various Internet video sources such as, Youtube, Comedy Central, etc. For a complete list of Mythnetvision grabbers, visit Mythnetvision Grabbers.
To enabled this plugin, run
aptitide install mythnetvision mythnetvision-data
For additional themes, run as root:
aptitude install mythtv-themes
Often, upgrading is as simple as applying the latest versions available from the Debian Multimedia repository. The latest version of MythTV that is available in this repository usually has been beta tested by the MythTV community for several months before being published in the Debian repository. Usually this ensures that many installation, upgrade, and performance problems have already been discovered, and patched, before the latest version of MythTV is made available through the Debian repository, but MythTV is a very complex application and unforeseen problems can arise, so it's prudent to take a few precautionary steps before upgrading.
Before applying your MythTV upgrade, visit the MythTV website and read the upgrade and release notes for the version you want to upgrade to. You may find, for instance, that certain dependencies are required, or procedures need to be executed prior to applying the upgrade. Pay particular attention to the dependencies because the new dependencies may render MythTV plugins or other applications on your system inoperable.
NOTE: As of MythTV version 0.22, QT4 libraries are required. If you installed plugins under a prior MythTV version, the plugins may no longer be functional, and may cause mythfrontend and/or mythbackend to experience segmentation faults.
No matter what steps are required, ALWAYS, ALWAYS make a backup of your MythTV database. To do so, run:
mysqldump -u <myth_user> -p --extended-insert --databases <myth_db_name> > mythdatabase-20100109.sql
This will generate a backup of your MythTV database and save it to a text file. You don't have to use the same file name for your backup, but it is helpful to include the date that the backup was performed as part of the file name - it makes it easier to identify which database file to use, should you need to do a database restore.
Visit the MythTV Diagnosing Problems page for in depth tips on how to report a problem, and how to begin diagnosing problems.
Additionally, to help identify errors it's often helpful to run the MythTV backend and frontend from the command line with increased debugging messages enabled.
For the MythTV backend you must first stop the backend process. As root, run:
Now, from a terminal window run:
mythbackend -v all
This will display ALL debugging output. If you don't need all debugging output you can specify the debugging messages you want. To find out the available debugging output run:
mythbackend -v help
Whatever debug output option you choose, do not add an & to the command - you want this process to remain in the foreground with debugging information being sent to the terminal window's standard error output.
Once you're done debugging your MythTV backend simply CTRL+C to stop the current backend process, then to restart the MythTV backend daemon run:
MythTV frontend has similar debugging capabilities to the backend. Before debugging the frontend you'll need to first exit the frontend if it's currently running. Unlike the backend, MythTV frontend by default utilizes the entire screen. To run MythTV frontend and be able to see the debugging output you'll need to run the following command (this should be run as a normal user and not root):
mythfrontend -v all -geometry 1024x768 -w
This enables all debugging output, but confines the MythTV frontend to a 1024 x 768 sized window. Thus, allowing you to operate the frontend and see the debugging output.
Once you're done debugging the frontend simply exit the frontend and start it as normally.
The debugging information available through the -v all option is a good place to look for errors, and often you'll find clues to pointing to the underlying problem. However, mythfrontend may experience a segmentation fault just at the point of failure, thus the needed debugging information may not be generated via -v all. If this should occur, another possible source of clues may be obtained by running the following command:
dmesg | grep -i myth
It's important to understand that this is a possible added source of clues - you may not receive any output. As an example of the possible clues available from dmesg is a problem that occurred during the upgrade from 0.21 to 0.22. As of version 0.22, MythTV requires QT4. Upgrading from 0.21 to 0.22 appeared to go smoothly, yet mythfrontend would continually crash. The only available useful information was from dmesg, which indicated that mythfrontend was attempting to use QT3 libraries. Upon further investigation, it was determined that a MythTV plugin, installed under version 0.21, was still installed and using QT3. Removing this plugin resulted in the proper operation of mythfrontend.
The easiest way to remove a plugin is to delete it from the file system. The typical location for plugins is /usr/lib/mythtv/plugins, but this location may vary. To find the location of your MythTV plugins directory run:
locate mythtv | grep -i plugins
Change directory to the plugin directory, run ls -la to list the plugin files and then rm <plugin_file_name> to delete the plugin.
MythTV comes with a web based application, called Mythweb. Mythweb allows you to manage and schedule recordings, etc. Via Mythweb, you can also watch your recordings streamed over the network.
The only real means of troubleshooting Mythweb is to consult the Apache2 log files, specifically error.log, and the best way to identify web application errors is to watch the error.log file in realtime. To do this, run the following command as root
tail -f /var/log/apache2/error.log
This displays the last error messages that were recorded to the log file, and maintains a connection to the error log displaying errors as the occur.
If you attempt to use mythweb and apache displays a server error, reference the apache error.log. A common error that you may encounter may look like the following:
[Wed Jan 13 19:19:34 2010] [error] [client 127.0.0.1] (13)Permission denied: exec of '/var/www/mythweb/mythweb.pl' failed, referer: http://localhost/mythweb/tv/recorded [Wed Jan 13 19:19:34 2010] [error] [client 127.0.0.1] Premature end of script headers: mythweb.pl, referer: http://localhost/mythweb/tv/recorded
The above error may occur during the installation or upgrade of mythweb, and the most likely culprit is inappropriate file ownership and/or permissions. To fix this, you must first login as root (use su if already logged in as a non-root user). Then cd to directory that you've installed mythweb to. This is usually /var/www/mythweb. Run:
ls -l mythweb.pl
which should produce output similar to:
-rw-r--r-- 1 root root 3001 2010-01-11 03:59 mythweb.pl
Having this file owned by root shouldn't pose a problem since you don't need web users to write to this file. But web users need to have the ability to execute this file. To set the proper permissions run the following:
chmod 755 mythweb.pl
Recheck the file permissions using the ls -l command mentioned above and the output should now be:
-rwxr-xr-x 1 root root 3001 2010-01-11 03:59 mythweb.pl
Universal Plug and Play
The most likely cause of UPNP issues is firewall related. Specifically, blocked ports on the MythTV backend system. If you're running a firewall on your backend system, follow these steps to allow UPNP traffic from your UPNP client systems.
More UPNP info is available at MythTV.
If you notice that the media available via UPNP doesn't match what is actually available on the MythTV backend, then one possible fix is to run the following command, as root, on your backend system:
You should not be required to stop the MythTV backend process to execute this command. This command will force an update of UPNP available media.