Dtv multiplex table

From MythTV Official Wiki
Revision as of 12:18, 8 March 2014 by Pmhahn (talk | contribs) (Fields)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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.

This table is populated from channelscan_dtv_multiplex table.

Table Description

Field name Type Null Key Default Extras Description
mplexid smallint(6) PRI NULL auto_increment
sourceid smallint(6) NULL NULL REFERENCES videosource(sourceid)
transportid int(11) NULL NULL
networkid int(11) NULL NULL
frequency int(11) NULL NULL
inversion char(1) NULL a 'a'=auto
symbolrate int(11) NULL NULL DCB-C: 6.900.000
fec varchar(10) NULL auto FEC: none,1/2,2/3,3/4
polarity char(1) NULL NULL
modulation varchar(10) NULL auto DVB:C: 'qam_64','qam_128','qam_256'
bandwidth char(1) NULL a 'a'=auto
lp_code_rate varchar(10) NULL auto
transmission_mode char(1) NULL a 'a'=auto
guard_interval varchar(10) NULL auto
visible smallint(1) 0
constellation varchar(10) NULL auto
hierarchy varchar(10) NULL auto
hp_code_rate varchar(10) NULL auto
mod_sys varchar(10) NULL NULL
rolloff varchar(4) NULL NULL
sistandard varchar(10) NULL dvb 'atsc','dvb',...
serviceversion smallint(6) NULL 33
default_authority varchar(32)


just as with classical analog TV, a tuner must to tune this frequency to receive a channel. In contrast to analog TV, digital TV does not receive only one channel per frequency, but a multiplex with several channels mixed together.
satellite data is transmitted in both horizontal and vertical polarity. As with frequency a (classic) tuner can at any time only receive one polarity.
this tells the decoder, how many symbols per second should be detected; compare this the sampling frequency in audio, e.g. CD-quality=44.1 kHz.
this tells the decoder, how many bits a single symbol encodes; compare this to audio-resolution, where CD-quality=16 bit.
forward error correction. To correct errors in transmission, part of the bandwidth is used to "double"-transmit the data, so that the receiver can detect and correct flipped bits.


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 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:


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       |

Sourceid 2 is my second channel lineup as set at 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 |

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