Difference between revisions of "Repairing the Seektable"

From MythTV Official Wiki
Jump to: navigation, search
m (Re-jigged to remove most of the 1st person references)
(Added 'HOWTO' category.)
 
(14 intermediate revisions by 9 users not shown)
Line 9: Line 9:
 
= Repairing the Seektable=
 
= Repairing the Seektable=
 
== Preparation==
 
== Preparation==
First, run the <code>optimize_mythdb.pl</code> script to ensure that the MySQL database is in good order.
+
First, run the <code>optimize_mythdb.pl</code> script to ensure that the MySQL database is in good order.  This script should be run by a user with a valid <tt>~/.mythtv/config.xml</tt>, which provides the required the database connection information.  Since <tt>~/.mythtv/config.xml</tt> is also used by mythfrontend and will be created by  mythfrontend if it doesn't already exist, running <code>optimize_mythdb.pl</code> as a user who has previously run mythfrontend is recommended.
  
On an Ubuntu Feisty machine for example, this is as simple as running the following command:
+
On an Ubuntu machine, for example, running <tt>optimize_mythdb.pl</tt> is as simple as running the following command:
  sudo /usr/share/doc/mythtv-backend/contrib/optimize_mythdb.pl
+
  /usr/share/doc/mythtv-backend/contrib/maintenance/optimize_mythdb.pl
  
 
This will iterate through each of the tables in the mythconverg database, 'optimizing' each one.  Once the <code>optimize_mythdb.pl</code> script has returned successfully, it is time to move on.
 
This will iterate through each of the tables in the mythconverg database, 'optimizing' each one.  Once the <code>optimize_mythdb.pl</code> script has returned successfully, it is time to move on.
  
 
== Using mythcommflag==
 
== Using mythcommflag==
mythcommflag is generally very successful and very efficient at rebuilding the seektable. 
 
 
 
For each recording with corrupted seektable in need of repair, run the following command:
 
For each recording with corrupted seektable in need of repair, run the following command:
 
  mythcommflag --file <filepath> --rebuild
 
  mythcommflag --file <filepath> --rebuild
Line 24: Line 22:
 
where <code><filepath></code> is the path to a recording that exists in the Myth TV database.  There are other options that can be used to specify the input filename(s), refer to the [[mythcommflag]] page for further details.
 
where <code><filepath></code> is the path to a recording that exists in the Myth TV database.  There are other options that can be used to specify the input filename(s), refer to the [[mythcommflag]] page for further details.
  
[[Image:Important.png]] '''Note:''' mythcommflag should ''always'' be used for files that are recording in or transcoded to NUV.
+
{{Note box|mythcommflag should ''always'' be used for files that are recording in or transcoded to NUV}}
 +
 
 +
 
 +
== Automation of mythcommflag repair function==
 +
 
 +
If lost seektables are a recurring occurrence for your setup and you have users who are less happy with tracking down a file name and running a command line repair tool against it, the following tip may be useful.
 +
 
 +
Define a [[User Jobs]] with a descriptive name e.g. "fixseek", this should have the command:
 +
mythcommflag --file %FILE% --rebuild
 +
 
 +
The name you have selected e.g. "fixseek" will now appear as a new option below "Job Options" on the "Recording Options" menu.
 +
Progress on the repair can be seen within the "System Status/Job Queue" menu.
  
 
== Using mythtranscode==
 
== Using mythtranscode==
If problems are encountered rebuilding a seektable with mythcommflag, try using mythtranscode as follows:
+
If problems are encountered rebuilding a seektable for MPEG-2 recording files with mythcommflag, try using mythtranscode as follows:
  mythtranscode --mpeg2 --buildindex --showprogress --infile <filepath>  
+
  mythtranscode --mpeg2 --buildindex --allkeys --showprogress --infile <filepath>
  
 
where <code><filepath></code> is the path to a recording that exists in the Myth TV database.  There are other options that can be used to specify the input filename, refer to the [[mythtranscode]] page for further details.
 
where <code><filepath></code> is the path to a recording that exists in the Myth TV database.  There are other options that can be used to specify the input filename, refer to the [[mythtranscode]] page for further details.
 
It should be noted that mythtranscode generally does a better job at repairing MPEG-TS (and/or MPEG-PS) streams.
 
  
 
= Possible Causes of a Corrupt Seektable=
 
= Possible Causes of a Corrupt Seektable=
* Editing a recording outside of the MythTV Frontend.
+
* Editing or converting a recording outside of the MythTV Frontend GUI (such as a custom post-processing script).
 
* Excessive disk IO during recording could prevent invalid SQL updates to the [[recordedseek table]] (I think).
 
* Excessive disk IO during recording could prevent invalid SQL updates to the [[recordedseek table]] (I think).
 
* Crashed MySQL tables.
 
* Crashed MySQL tables.
 
* Losing the network between slave backends and the MySQL database server during recordings.
 
* Losing the network between slave backends and the MySQL database server during recordings.
* Alternatively, files imported into the MythTV recordings library may need to have their seektables build, especially if they are to be edited.
+
* Alternatively, files imported into the MythTV recordings library may need to have their seektables built, especially if they are to be edited.
 +
 
 +
[[Category:HOWTO]]

Latest revision as of 19:13, 21 November 2013

It is possible that the seektable can become corrupted for one or more recordings, which can result in:

  • Being unable to skip forward and backward correctly, and
  • Recordings reporting the incorrect length.

mythcommflag and mythtranscode are two tools that can be used to rebuild the seektable.

Important.png Note: After rebuilding the seektable, any cutlist which has created for a recording will no longer be properly synced and should be recreated.

Repairing the Seektable

Preparation

First, run the optimize_mythdb.pl script to ensure that the MySQL database is in good order. This script should be run by a user with a valid ~/.mythtv/config.xml, which provides the required the database connection information. Since ~/.mythtv/config.xml is also used by mythfrontend and will be created by mythfrontend if it doesn't already exist, running optimize_mythdb.pl as a user who has previously run mythfrontend is recommended.

On an Ubuntu machine, for example, running optimize_mythdb.pl is as simple as running the following command:

/usr/share/doc/mythtv-backend/contrib/maintenance/optimize_mythdb.pl

This will iterate through each of the tables in the mythconverg database, 'optimizing' each one. Once the optimize_mythdb.pl script has returned successfully, it is time to move on.

Using mythcommflag

For each recording with corrupted seektable in need of repair, run the following command:

mythcommflag --file <filepath> --rebuild

where <filepath> is the path to a recording that exists in the Myth TV database. There are other options that can be used to specify the input filename(s), refer to the mythcommflag page for further details.


Important.png Note: mythcommflag should always be used for files that are recording in or transcoded to NUV


Automation of mythcommflag repair function

If lost seektables are a recurring occurrence for your setup and you have users who are less happy with tracking down a file name and running a command line repair tool against it, the following tip may be useful.

Define a User Jobs with a descriptive name e.g. "fixseek", this should have the command:

mythcommflag --file %FILE% --rebuild

The name you have selected e.g. "fixseek" will now appear as a new option below "Job Options" on the "Recording Options" menu. Progress on the repair can be seen within the "System Status/Job Queue" menu.

Using mythtranscode

If problems are encountered rebuilding a seektable for MPEG-2 recording files with mythcommflag, try using mythtranscode as follows:

mythtranscode --mpeg2 --buildindex --allkeys --showprogress --infile <filepath>

where <filepath> is the path to a recording that exists in the Myth TV database. There are other options that can be used to specify the input filename, refer to the mythtranscode page for further details.

Possible Causes of a Corrupt Seektable

  • Editing or converting a recording outside of the MythTV Frontend GUI (such as a custom post-processing script).
  • Excessive disk IO during recording could prevent invalid SQL updates to the recordedseek table (I think).
  • Crashed MySQL tables.
  • Losing the network between slave backends and the MySQL database server during recordings.
  • Alternatively, files imported into the MythTV recordings library may need to have their seektables built, especially if they are to be edited.