Dtv multiplex table

From MythTV Official Wiki
Revision as of 12:12, 15 May 2011 by Bullestock (talk | contribs) (Added <pre> tags)

Jump to: navigation, search

Important.png Note: The correct title of this article is dtv_multiplex table. It appears incorrectly here due to technical restrictions.

The dtv_multiplex table contains information required to tune the digital reception hardware. Because numerous digital streams can be multiplexed into one source/frequency/modulation, this table aggregates the information necessary to tune the hardware to a particular source, except for choosing the particular stream. That last piece of information is the serviceid field in the channel table.

NOTE: I have no knowledge about what the fields mean or are used for with satellite reception. (Hint hint: someone should add to this!) My knowledge is limited to how this table is used for QAM_256 modulated signals on US/Canadian cable, although this information will be almost exactly the same for antenna reception OTA. In that case the modulation field may differ. Similarly, myth needs to send even more information to the hardware to tune a satellite receiver, so more fields will be required to be filled in.

To avoid problems there is a preferred order to obtaining and entering this information.

For North American digital cable reception of non-encrypted channels (whether Standard Definition or High Definition) using a pcHDTV HD3000 or similar, the only fields which need data are sourceid,frequency,modulation and sistandard. For each row entered, mysql automatically increments the mplexid. This is a listing of the fields in the table, but only a few are needed for cable reception.

mysql> describe dtv_multiplex;
+-------------------+-------------+------+-----+-------------------+----------------+
| Field             | Type        | Null | Key | Default           | Extra          |
+-------------------+-------------+------+-----+-------------------+----------------+
| mplexid           | smallint(6) |      | PRI | NULL              | auto_increment |
| sourceid          | smallint(6) | YES  |     | NULL              |                |
| transportid       | int(11)     | YES  |     | NULL              |                |
| networkid         | int(11)     | YES  |     | NULL              |                |
| frequency         | int(11)     | YES  |     | NULL              |                |
| inversion         | char(1)     | YES  |     | a                 |                |
| symbolrate        | int(11)     | YES  |     | NULL              |                |
| fec               | varchar(10) | YES  |     | auto              |                |
| polarity          | char(1)     | YES  |     | NULL              |                |
| modulation        | varchar(10) | YES  |     | auto              |                |
| bandwidth         | char(1)     | YES  |     | a                 |                |
| lp_code_rate      | varchar(10) | YES  |     | auto              |                |
| transmission_mode | char(1)     | YES  |     | a                 |                |
| guard_interval    | varchar(10) | YES  |     | auto              |                |
| visible           | smallint(1) |      |     | 0                 |                |
| constellation     | varchar(10) | YES  |     | auto              |                |
| hierarchy         | varchar(10) | YES  |     | auto              |                |
| hp_code_rate      | varchar(10) | YES  |     | auto              |                |
| sistandard        | varchar(10) | YES  |     | dvb               |                |
| serviceversion    | smallint(6) | YES  |     | 33                |                |
| updatetimestamp   | timestamp   | YES  |     | CURRENT_TIMESTAMP |                |
+-------------------+-------------+------+-----+-------------------+----------------+
21 rows in set (0.00 sec)

The 'proper' order is to run a scan to check out your hardware and to determine what channels you can receive, then create a channel lineup at labs.zap2it.com and run mythfilldatabase. This will populate the channel table with the majority of the information, without creating duplicate channel entries! Then you start some 'hands-on' work using your channels.conf and mysql. There are scripts which are intended to automate the process, but errors may occur, and you should understand, at least, what the script is supposed to be doing.


Running atscscan will have produced a channels.conf which has lines like this:

[0034]:525000000:QAM_256:18:19:52

Channel [0034] is actually Rogers SportsNet Ontario (RSO) for me and that channel is #402 in my DataDirect listing.

The ':18:' is the video id and the ':19:' is the audio id. If you tune to this channel in one console using:

azap -r [0034]

you should be able to watch the stream in another console using:

mplayer -vid 18 -aid 19 /dev/dvb/adapter0

The last number ':52' is the 'program id' or pid and is the serviceid which myth needs. The frequency goes into the dtv_multiplex table and the serviceid into the channel table.


This is a completed dtv_multiplex table for Rogers Cable in the greater Toronto area:

mysql> select mplexid, sourceid, frequency, modulation, sistandard from dtv_multiplex;
+---------+----------+-----------+------------+------------+
| mplexid | sourceid | frequency | modulation | sistandard |
+---------+----------+-----------+------------+------------+
|       1 |        2 | 525000000 | QAM_256    | atsc       |
|       2 |        2 | 579000000 | QAM_256    | atsc       |
|       3 |        2 | 597000000 | QAM_256    | atsc       |
|       4 |        2 | 657000000 | QAM_256    | atsc       |
|       5 |        2 | 681000000 | QAM_256    | atsc       |
|       6 |        2 | 699000000 | QAM_256    | atsc       |
|       7 |        2 | 771000000 | QAM_256    | atsc       |
|       8 |        2 | 837000000 | QAM_256    | atsc       |
|       9 |        2 | 843000000 | QAM_256    | atsc       |
+---------+----------+-----------+------------+------------+
9 rows in set (0.00 sec)

Sourceid 2 is my second channel lineup as set at labs.zap2it.com. The system can be unstable if sistandard is not set to atsc. Also remember to set the type to ATSC on the channel page of the Channel Editor in mythtv-setup.

These rows can be entered as follows:

mysql> REPLACE INTO dtv_multiplex (sourceid,modulation,sistandard,frequency) VALUES ('2', 'QAM_256', 'atsc', '525000000');

REPLACE will enter new rows or amend existing rows (so you can correct a mistake!). I put 'frequency' last so I did not have to use 'backspace' as much.


You then need to set the atscsrcid to '0' and enter the mplexid and serviceid into the channel table:

mysql> REPLACE INTO channel (sourceid,atscsrcid,mplexid,serviceid) VALUES ('2', '0', '1', '52') WHERE chanid= '2402';

Which will produce:

mysql> select chanid,channum,callsign,sourceid,mplexid,serviceid,atscsrcid from channel where chanid ='2402';
+--------+---------+----------+----------+---------+-----------+-----------+
| chanid | channum | callsign | sourceid | mplexid | serviceid | atscsrcid |
+--------+---------+----------+----------+---------+-----------+-----------+
|   2402 | 402     | RSO      |        2 |       1 |        52 |         0 |
+--------+---------+----------+----------+---------+-----------+-----------+
1 row in set (0.00 sec)

Now when you select channel 402 in the EPG, myth knows to use serviceid 52, to find the frequency and modulation by looking into the dtv_multiplex table using the mplexid and to select a tuner by using the sourceid and looking into the cardinput table. Simple!


R. G. Newbury 65.94.232.153 15:46, 5 April 2006 (UTC)

Here is a full record from the dtv_multiplex table:

mysql> select * from dtv_multiplex where mplexid = '110';

| mplexid | sourceid | transportid | networkid | frequency | inversion | symbolrate | fec  | polarity | modulation | bandwidth | lp_code_rate | transmission_mode | guard_interval | visible | constellation | hierarchy | hp_code_rate | sistandard | serviceversion | updatetimestamp     |

|     110 |        2 |        NULL |      NULL | 525000000 | a         |          0 | auto | v        | qam_256    | a         | auto         | a                 | auto           |       0 | qam_256   | a         | auto         | atsc       |             33 | 2006-12-29 22:23:25 |

For digital cable, the modulation (qam_256) and the sistandard (atsc) are important.