Difference between revisions of "Record multiple channels from one multiplex"

From MythTV Official Wiki
Jump to: navigation, search
m (Complex cases: Missing "but")
(Implementation Phase)
Line 444: Line 444:
== Implementation Phase ==
== Implementation Phase ==
Far, far away ...
A branch were it should be implemented has been started. http://svn.mythtv.org/trac/browser/branches/mythtv-multirec
== Testing Phase ==
== Testing Phase ==

Revision as of 09:02, 21 April 2007

DVB transmissions are multiplexed Transport Streams containing several data streams (video, audio, epg, eit, ...) identified by PIDs. When you select a TV/Radio program or data service (like EPG, Teletext, IPv4, ...) the necessary PIDs are remuxed into a new data stream which can be handled by your application. In case of a media player one video PID and one or several audio PIDs are muxed into a TS- or PES-container (there can also be timing information like PCR).

The DVB-standard specifies the MPEG2 codec for video and audio. Alternatively AC3 can be used for audio.

As of the high bandwith of DVB multiplexes (up to 90 MBit/s) there is usually more than one TV- or radio-program in a multiplex. In contrast to the Windows BDA driver, the LinuxDVB kernel driver can also deliver the complete Transport Stream of a multiplex.

By remuxing the TS into more than one new stream other TV applications like VDR can record several TV programs in a DVB multiplex at the same time using only one tuner for the multiplex.

Multiplex recording also allows overlapping of sequent recordings of the same program. That avoids the annoying problem with the end of a broadcast being in the next recording or the beginning of a broadcast being at the end of a previous recording.

This currently can't be done in MythTV.


Open Source Partners in Finland are collecting sponsorships for this development, with developers involved. Please donate if you want this feature developed.

Use cases

How would this feature be used? Write up some ideas that can be used to guide and test development.

Simple cases

  • User schedules recording of two programmes on different channels that share a multiplex (e.g., BBC1 and BBC2). Only one tuner should be used to record.
  • User has MythTV set up to always start recording five minutes before and after the scheduled time. User schedules recording of two back-to-back programmes on the same channel, or on different channels carried on the same transport. Only one tuner should be used to record both, despite the overlap.

Complex cases

A lot of the complexity in this change comes not from the recording code but from the scheduling. Define some edge cases to provoke discussion.

  • User has three recordings defined that will all be transmitted on one multiplex at the same time, each programme given a priority of "5". Another recording at the same time has a priority of "10" on another multiplex. With only one tuner, which programmes get recorded?
  • User has two tuners, one high priority, one low. Two programs at priority 0 are transmitted on the same transport, while one on a different transport has priority 10. Which gets the high priority tuner, and which the low priority one?
  • User has two tuners, one high priority DVB tuner, one low priority analog tuner. Two programs at priority 0 are transmitted on the same transport, while one on a different transport has priority 10. Do we give the high priority DVB tuner to the two low priority shows and put up with analog reception for the high priority show, or do we use the DVB tuner for the high priority show, and miss recording one of the lower priority shows?
  • User has two tuners, one low priority DVB tuner, one high priority analog tuner. One programs at priority 0 is on simultaneously with two priority 10 programs transmitted on the same transport. Do we give the low priority DVB tuner to the two high priority shows, or put one on the high priority analog tuner and miss the lower priority show? This may be a bit artificial, since a DVB tuner will usually have higher priority than an analog one.
  • All these same issues arise for back-to-back recordings on the same transport that are made to overlap due to start early/end late.

Countries with multiplexed DVB/ATSC transmissions





New Zealand

At present New Zealand has two DVB-S transponders. At some point in 2008 we expect to also see 2-3 MPEG4 based DVB-T Multiplexes. The DVB-S Transponders have enough room for upto 9 TV Channels.

DVB-S Mux 1 DVB-S Mux 2
TV 2 C4
Maori TV TBA
Reserved TBA
Reserved TBA
Bloomberg TBA
TVNZ Wide Test TBA


  • ABC and ABC2, with ABC2 repeating much of the ABC content later in the week (great if you run out of tuners)
  • SBS with SBS world News
  • Digital 44 (Sydney only) - datacasting of news/tab/expo/christian tv/parliament


  • Astra 19.2° and EutelSat 13.0° DVB-S (up to 20 radio or 8 TV programs per transponder/multiplex)

Czech republic

3 Multiplexes(on terrestrial).

  • Multiplex A (CT1, CT2, CT24, CT4 Sport, TV Nova) + some radios
  • Multiplex B (Prima TV, TOP TV, Ocko, 24cz, TV NOE) + some radios
  • Multiplex C (some tests)


1 Multiplex, - more will come.

Current multiplex has: DR1, DR2, Tegnsprog and TV2. As of February not all of the country are covered. Se http://www.digi-tv.dk


  • All TV stations on DVB-C/-T (up to 6 TV channels per multiplex)

3 Multiplexes (on terrestrial). Muxes A and B cover 99,9 % of country. Mux C covers 78 % - 85,4 %.

n Multiplexes (on cable, depends on company)

TTV[1] is Finland's 2nd biggest cable tv provider with 12 multiplexes[2]. 6-10 channels per multiplex and most of the users use only 2 of them -> More than 10 free channels. Even getting 2 channels with one tuners would be HUGE improvement.

Analog TV will die in Finland 31th Aug 2007 and after that everyone have to buy DVB-T/-C receiver. Or build MythTV box with 10 tuners..


  • All TV stations on DVB-C/-T (4 TV programs per VHF/UHF multiplex)


DVB-T ("Freeview")

The UK is made up of 6 multiplexes. As you can see below, with only 6 tuners you could have quite an incredible MythTV recording platform.

Mux 1 Mux 2 Mux A Mux B Mux C Mux D
BBC ONE ITV1 abc1 301 E4+1 Film4
BBC TWO ITV2 bid tv 302 / Community Sky Sports Ideal World
BBC THREE / CBBC ITV3 Five 305 Sky Sports News ITV Play
BBC NEWS 24 CITV Five Life BBC FOUR / CBeebies Sky Three The HITS
Channel 4 Five US BBC News Multiscreen UKTV History / smileTV TMF
E4 price-drop tv BBC Parliment UKTV Bright Ideas / f tn
More 4 QVC
Quiz Call Teachers' TV

In addition, there are a large number of radio stations.

The full list can be found here: [3]


A selection of channels is also available for UK_Television via Sky Digital satellite. These channels are likewise multiplexed.

The 'interesting' Free TV channels that can be received with a DVB-S card (ie no Sky box required) and are thus available for multiplex recording:

Note especially the BBC HD

Astra 2D at 28.2°E

tp 41 ITV 2+1 ITV 1
tp 42 FILM4 FILM4+1
tp 44 ITV 1 ITV 2 CITV ITV 4 Men & Motors
tp 45 BBC One BBC Two BBC News24 BBC Four CBBC CBeebies BBC Three
tp 47 BBC One BBC Two BBC Radio
tp 50 BBC One BBC HD
tp 54 Channel TV STV ITV 3

Astra 2B at 28.2°E

tp 14 Zee Music UK
tp 26 Sky News UK Sky News Ireland


  • TV stations on the Digitenne network are in DVB-T (multiple TV programs per multiplex, all FTA public channels on one multiplex)

E.g.: # scandvb -c
using '/dev/dvb/adapter0/frontend0' and '/dev/dvb/adapter0/demux0'
0x0000 0x044d: pmt_pid 0x1b62 Digitenne -- Nederland 1 (running)
0x0000 0x044e: pmt_pid 0x1b6c Digitenne -- Nederland 2 (running)
0x0000 0x044f: pmt_pid 0x1b76 Digitenne -- Nederland 3 (running)
0x0000 0x0450: pmt_pid 0x1b80 Digitenne -- CNN (running, scrambled)
0x0000 0x0451: pmt_pid 0x1b8a Digitenne -- TV West (running)
0x0000 0x0457: pmt_pid 0x1bc6 Digitenne -- Radio West (running)
dumping lists (6 services)
Nederland 1 (0x044d) 01: PCR == V V 0x1b63 A 0x1b64 TT 0x1b65
Nederland 2 (0x044e) 01: PCR == V V 0x1b6d A 0x1b6e TT 0x1b6f
Nederland 3 (0x044f) 01: PCR == V V 0x1b77 A 0x1b78 TT 0x1b79
CNN (0x0450) 01: PCR == V V 0x1b81 A 0x1b82 TT 0x1b83
TV West (0x0451) 01: PCR == V V 0x1b8b A 0x1b8c TT 0x1b8d
Radio West (0x0457) 02: PCR == A A 0x1bc8

See http://nl.wikipedia.org/wiki/Digitenne for details and information (in Dutch)


Mux R1 France 2 France 3 France 4 France 5 ARTE La Chaîne Parlementaire
Mux R2 Direct 8 Gulli Europe 2 TV i>TELE BFM TV TMC
Mux R3 Canal + Canal J Planète Canal + Sport Canal + Cinéma
Mux R4 M6 W9 NT1 Paris Première TF6 AB1
Mux R5 unused unused unused unused unused unused
Mux R6 TF1 NRJ 12 TPS Star Eurosport LCI


DVB-T and DVB-C.

There are 5 public DVB-T multiplexes. Four of them covers 90% of the population, one 50%. This is about 30 channels, both encrypted and unencrypted. There are also ongoing work to ensure that the Swedish population in Finland will continue to receive digital transmissions after the analog transmissions have stopped.

North America

Digital cable transmissions are multiplexed. The standard encoding appears to be QAM-256 for unencrypted channels. Usually there are also lots of audio only channels multiplexed into the stream, so each frequency can have a number of streams. Maximum for one frequency with Rogers cable in the Toronto area appears to be 14 streams on one frequency...a mixture of unencrypted video+audio, audio and encrypted HD.

Rogers has a total of 424 streams!

An example dvbscan output:

Unique name:frequency:modulation: video id: audio id: serviceid (pid)

#dumping lists (424 services)

South America


Please read these discussions, and the Trac ticket thoroughly before starting a new discussion about the subject on the mailing list.




If someone has time, it would be great if the ideas in these threads and the ticket could be summarised?


Pdf.gif Linux DVB API version 3

Software Engineering

Analysis Phase

Current state:

  MythTV does not support multiplex reception


  Multiplex reception

Design Phase


Q: How to get several recordings from one multiplex?
A: Grab the complete Transport Stream from a DVB/ATSC device into a ringbuffer and demux it into several MPEG streams.

Q: Does it make sense to store the TS on harddisk instead of using a ringbuffer?
A: No, unless you can afford 40 GByte diskspace per recording hour (DVB-S multiplexes can have bitrates up to 90 MBit/s). So make it configurable: 1 or more, or all channels from one multiplex, perhaps appearing as a `virtual tuner` to MythTV. MythTV can use the channels via the normal means.

Q: Is it possible to record encrypted and decode the recording offline/later?
A: In theory, yes. Practically NOT.

  1. The decoding is done by CAM modules with smartcards.
  2. The CAM modules use a extended PCMCIA interface with special wiring.
  3. You need a kernel driver for the CAMs.
  4. Also consider the high load for the PCI/PCMCIA interface.
  5. Legal issues in most countries.

Q: How to prevent MythTV-backend crashes by broken Transport Streams?

  1. Validate Transport Stream by defining preconditions in the TS remuxer
  2. Fork a transport stream demuxer process for each recording.
  3. Make sure to handle process signals correctly (no zombies)!
  4. Make it restart upon error (e.g. using a watchdog process)

Q: How to handle multiplexes in the recording scheduler?
A: Use source type (DVB-C/-S/-T), frequency (DVB-C/-S/-T) and polarisation (DVB-S) to identify programs on the same multiplex. In a multiplex case use the new code; MythTV can then handle `conflicting` situations.

Q: How to adapt the recording scheduler for multiplex recordings?
A: A simple Solution for this is in the Ticket in Track about this feature. This is not the full Solution, but it works.

Q: Will it be possible to view concurrently two programs on the same multiplex with Picture in Picture ?
A: PiP is a frontend feature while multiplex recording is a backend feature.
So the answer is YES! If your backend provides multiplex demuxing you can use PiP.

Implementation Phase

A branch were it should be implemented has been started. http://svn.mythtv.org/trac/browser/branches/mythtv-multirec

Testing Phase

Testing by SVN-Users ;-)


Three developers are going to work on this feature in the spring of 2007. A pledge to pay for that effort has been started in April 2007. Please donate to the pledge if you're willing to pay for this feature.

(Note that another pledge was started earlier and expired on 15th December, 2006)