[mythtv-users] Max number of DVB channels per usb tuner

Stephen Worthington stephen_agent at jsw.gen.nz
Sat Dec 21 14:40:23 UTC 2013


On Sat, 21 Dec 2013 21:40:30 +1000, you wrote:

>I was looking for something, don't remember what now, but came across the following statement on a site advertised as a complete guide to MythTV - http://www.techradar.com/news/software/applications/complete-guide-to-mythtv-947946/4
>
>******
>If you're using DVB (either terrestrial or satellite), you're in luck, 
>because these multiplex several channels into one stream. MythTV is able
> to receive an entire stream from a DVB tuner card, and then split it 
>into individual programmes.
>When adding a capture card in mythtv-setup, press the Recorder Options 
>button to see a further screen, which includes a Max Recordings setting.
> Three is a sensible setting for this, and means that you could record 
>six channels at once if you have two capture cards.
>******
>
>Is that statement correct - ie that the number of channels that can be tuned from a single multiplex is not a hardware "given" of the particular card / tuner (in a DVB context)?
>
>I've set mine to two per usb tuner but that was because I thought I remembered reading on the box (back when I had the box) that it was capable of two channels.
>
>I've gone back to the manufacturer website to see what it says but it only has the following statement which I am not sure whether it means that it can tune two multiplexes (on a single usb tuner) and two channels from each multiplex, or 4 channels from a single multiplex.
>
>******
>Multiple Video Processing mode, enables two TV tuner devices, up to four
> channel program processing simultaneously. You can simply upgrade your 
>TV enjoyments with one more WinFast digital TV tuner card/ box for 
>multiple TV viewing.
>******
>
>No doubt there are other considerations (ie hardware of the backend) but I think USB 2.0 does 480Mbps and a multiplex is 20Mbps total so the USB part should be fine. I think a 7200rpm HDD can do around 60Mbps sustained write so that should be plenty as well.

You never said exactly what tuner you have, but with any DVB-T/T2 or
DVB-S/S2 tuner, the entire multiplex of channels is usually available
to the software.  Some DVB tuners have an option for the tuner to
select out the channels required, either in hardware or using its
onboard firmware, so that the amount of data sent by the tuner is
reduced to just that necessary for those channels.  But for a lot of
them, they just send all the channels and let the CPU sort it out.  I
believe that is done in the Linux V4L drivers, rather than MythTV,
with MythTV just asking the drivers for the channels it wants, and the
drivers asking the tuner to do the work if it is capable of it,
otherwise doing it themselves.  So MythTV does not know if the tuner
is doing the work, or if the main CPU is.  It is not a big job, as the
packets for each channel are numbered in their header data, so all
that needs to be done is to check if a packet matches the serviceid
for the channel and if so, send it off to be stored to disk for that
recording.  Packets that do not match any wanted serviceid values are
dropped.

I think the drivers also have an option to just deliver all the
packets for all the channels and the other data streams like MHEG5 and
EIT EPG data directly to the requesting program, but MythTV does not
use that as far as I know.

So in theory, if there are 10 channels on a multiplex, then software
could record all 10 at once from the same tuner.  In practice, MythTV
versions have restricted the number of channels that can be recorded
from one tuner to a smaller number.  That number is 5 for MythTV 0.27
(and 0.26?), but was smaller in older versions.  This feature, called
multirec, did not exist initially, and was added when DVB tuners came
along.

So if your hardware can cope with recording five programs at once,
then you may as well set the option to 5 on all tuners that support
multirec.  That gives the scheduler the best chance of avoiding
conflicts where it does not have enough tuners to record everything it
needs to.

In the case of your tuner, it may be that it is only internally
capable of selecting out up to two channels at once.  If so, then it
is likely that the driver will not be using that capability at all and
will be doing the processing to select out the channels itself.  It is
also possible that the quote you posted from the manufacturer's site
is talking about the software they provide to record from their tuners
under Windows, and that software is restricted to recording only two
channels per tuner and only from up to two tuners for a total of four
channels at once.  Some manufacturer provided software is like that,
because recording too much at once is likely to cause them to get too
many support calls when it causes damaged recordings.

There are limits to how many recordings your MythTV box is capable of
making at once.  When it is set to "balanced I/O mode", MythTV will
spread the recordings evenly around the hard drives you have set up as
storage groups to maximise the number of recordings that is possible,
but if there are too many, at some point the RAM buffers for one or
more of the recordings will overflow before the data can be written to
disk, and you will start to lose chunks of the recordings.  As a rule
of thumb, any modern hard drive should be capable of recording at
least two HD channels at once, but how many more a drive can cope with
depends on its specifications.  The latest hard drives can actually
write sequentially at over 140 Mbytes/s, but that is not the limiting
factor.  When writing more than one recording to one drive, the drive
has to move its heads back and forth between the locations for the
various recording files, and so the track-to-track stepping speed
becomes the limiting factor, and that has not sped up in proportion to
the on-track write speeds with each new generation of hard drives.
That problem can be helped by having more buffering, in the drive and
in the OS, so that the heads can stay in one location longer, but
eventually buffers fill and the heads will need to be moved to another
location.

It is a good idea once you have set up multirec with 5 channels per
tuner to do a bit of testing, and set up more and more simultaneous
test recordings at once until you find that the recordings are getting
damaged.  Then you can make sure that you never ask MythTV to record
that many at once.  If you want to also watch a recorded program while
other recordings are taking place, remember that playing back a
recording will take as much disk usage as recording one will.  And if
you have a storage group defined on the same hard drive as your
operating system and MythTV database, then you also have to leave
enough drive performance left for the OS and the database accesses to
work safely.  Every time the scheduler runs, it does quite a lot of
database accesses all at once, and for a few seconds that drive will
get very busy.  And a few seconds is enough to cause data to be lost
from recordings going to that drive if it was recording too many
programs at the same time.  For testing purposes, you can use a
"mythutil --resched" command to trigger the scheduler to run.  Watch
out for pre-roll and post-roll.  When you record extra before and
after a program's scheduled times, that can lead you to be recording
up to twice as many recordings at once during the overlap periods. But
given how often broadcasters miss their scheduled times, my experience
is that post-roll is normally necessary on most channels and pre-roll
often is on some channels.

Processing of recordings for commercial skipping with mythcommflag
also needs to read from the drives to do that.  If you have a recent
CPU and enough RAM, then mythcommflag can do that processing in real
time and will get its data from the RAM buffers without having to do
any extra disk accesses.  But on older CPUs, it will fall behind and
start to have to read back data from the disks.

If you find you are reaching the limit of the number of recordings
your hardware is capable of, then all you need to do is just add
another hard drive.  I would certainly recommend that any MythTV box
have at least two hard drives to record to.  I have five recording
drives in mine, with the system and database on one of those drives (a
high performance 3 Tbyte 7200 rpm Hitachi drive).


More information about the mythtv-users mailing list