[mythtvnz] Diagnosing recording wrong channel
Stephen Worthington
stephen_agent at jsw.gen.nz
Thu Jun 21 04:00:27 BST 2012
On Thu, 21 Jun 2012 13:04:36 +1200, you wrote:
>On 20/06/12 21:31, Stephen Worthington wrote:
>> On Wed, 20 Jun 2012 15:05:37 +1200, you wrote:
>>
>>> I have had a few instances of programmes being recorded from the wrong
>>> channel. The correct time but, obviously, the wrong programme! I need
>>> some help diagnosing the cause.
>>>
>[snip]
>> You might like to try this SQL query to see what the tuning data being
>> used for channel 3 is:
>>
>> #!/bin/bash
>> # Lookup the DVB tuning data for a given channel number.
>> source /etc/mythtv/mysql.txt
>> mysql -r -t -u $DBUserName -p$DBPassword -h $DBHostName $DBName<< EOF
>>
>> select
>> channum,chanid,dtv_multiplex.mplexid,dtv_multiplex.sourceid,transportid,networkid,frequency
>> from channel,dtv_multiplex where channel.channum=3 and
>> dtv_multiplex.mplexid=channel.mplexid;
>> EOF
>
>Running....
>select
>channum,chanid,dtv_multiplex.mplexid,dtv_multiplex.sourceid,transportid,networkid,frequency
>from channel,dtv_multiplex where dtv_multiplex.mplexid=channel.mplexid
>order by chanid;
>
>(To get data for all channels)
>
>I attached the output.
>
>Why are all networkid the same?
>
>Transportid seems to map directly to frequency. But channels share
>frequencies. Is that OK? Why?
>
>The sourceid is the tuner? I only have one (currently).
>
>What is the mplexid?
>
>cheers
>Worik
Here is how it all works, as best as I can tell so far.
Some background first.
DVB-T and DVB-S channels are just streams of digital data packets
marked with ID numbers to say what channel they are and what stream
for that channel (eg video, audio, teletext, EIT). A group of
channels is transmitted on each frequency, what in analogue terms used
to be one channel frequency. The frequency has a designated bandwidth
that determines how much data it can carry. Different streams have
different amounts of data - and HD video stream such as for TV3 takes
much more bandwidth than an SD one as for Prime. So a calculation is
done to see what channels will fit on one frequency. The bundle of
channels and other data streams on one frequency is called a
multiplex.
A DVB-T or DVB-S tuner tunes to a multiplex frequency just like an
analogue tuner. It makes available all the data packets as they
arrive, and to tune for a particular channel or stream on the
multiplex, the tuner has a software or hardware filter that is
programmed for the packet ID numbers that are needed and it just drops
all the other unneeded packets. If more than one channel is to be
recorded from a multiplex, the same tuner can be used by simply
telling it the correct packet IDs to filter out for each channel and
where to send those packets. The ability of software to record
multiple channels from the same multiplex is called "multirec", and is
often not present is cheap PVR boxes.
The following explanation is a little simplified, due to the
complexities of various priority values in the database.
So now mythbackend is starting a recording on channel 3. The records
in the channel table matching channel 3 are looked up. There can be
more than one if the channel is available on DVB-T, DVB-S and Sky, in
which case there will be records with different chanid values but the
same channum. The highest recpriority value record is used, and if a
matching tuner is available it will be selected to be used, otherwise
mythbackend goes back and finds a lower priority tuner to use. Once
it has selected the channel record it is using it keeps a copy of the
chanid value to access that record. It uses the sourceid to work out
what tuners match that record (eg DVB-T, DVB-S, analogue input from
Sky box). Once it has decided that the matching tuners are DVB-T (or
DVB-S), it gets the mplexid value from the channel record and uses
that to look up the one matching dtv_multiplex record. The freqid
value in the channel record is used for tuning analogue channels, and
is ignored for digital channels. The dtv_multiplex record frequency
value is used to tune the DVB-T tuner to the channel, and other values
from the dvt_multiplex record (such as fec, modulation) are used to
set up decoding of the data from the analogue signal. Once the
channel decoding is set up, the tuner will be receiving data packets
and will be able to verify it has the right multiplex using the
transportid and networkid values which are transmitted in the data
packets. I am not entirely sure if the networkid and transportid
values are actually checked or just ignored and what would happen if
there was a mismatch. The networkid values seem to be different
between DVB-T and DVB-S and might also differ between DVB-S
satellites, but I am not sure exactly how they work. The transportid
values identify the multiplex. The difference between an mplexid and
a transportid is that a transportid is a value transmitted in the
packets on a multiplex. An mplexid is just an index into the tables
in the mythconverg database.
Once the tuner is set up and receiving data for the multiplex,
mythbackend then uses the serviceid value from the channel record to
select all the data streams for that channel out of the streams on the
multiplex. The serviceid is transmitted in the data packets
identifying the channel on the multiplex.
So, in the output of the SQL query I got you to do, the mplexid,
frequency and transportid values must all match, which they do. The
networkid values are all the same as all the channels are from DVB-T.
So everything in that output looks fine.
I think we need to see what is in the channel table now. Please
replace the select line in the batch file with:
select channum,chanid,callsign,name,recpriority,mplexid,serviceid from
channel where channum < 100 order by (channum+0);
and see especially if there are multiple entries for any channum.
More information about the mythtvnz
mailing list