How to stream multiple TV channels with a single DVB-T tuner using VLC

DVB-T (Digital Video Broadcasting – Terrestrial) is the European-based digital terrestrial television broadcast transmission standard. The system transmits video, audio and data streams encoded in a MPEG transport stream which can be decoded by different types of receiver cards, boxes or USB sticks. Every broadcast channel with its video, audio and data stream is multiplexed into a MPEG program stream and one or more of these are multiplexed into a MPEG transport stream which is then transmitted on a single frequency. So basically your tuner card/box/stick is receiving multiple broadcast channels on a single frequency at once and your tuner software selects the program stream you intend to watch or record. In this article I will explain how you can demultiplex the transport stream and watch or record multiple broadcast channels at the same time with a single tuner.

Prerequisites

The first thing I want to mention here is the LinuxTV wiki. There you can find all sorts of information regarding DVB on Linux. Parts of this article are based on information found there.

I will assume that you have a working DVB-T setup on your system and your DVB-T receiver is up and running. If this is not the case, please refer to the LinuxTV wiki for detailed information on how to setup your DVB-T receiver. If you are using an USB DVB-T stick, make sure you have the latest firmware installed in your /lib/firmware folder.

You will need the dvbutils to scan for frequencies and to generate a channels.conf file. If you don’t have them installed, go to the LinuxTV wiki and install them as described in the article. After that, make sure you run a frequency scan and create a recent channels.conf file. Your channels.conf should look like this:

ZDF:490000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_1_2:QAM_16:
  TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:545:546:514
3sat:490000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_1_2:QAM_16:
  TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:561:562:515
ZDFinfo:490000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_1_2:QAM_16:
  TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:577:578:516
neo/KiKA:490000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_1_2:QAM_16:
  TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:593:594:517
Bayerisches FS:530000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_AUTO:QAM_16:
  TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:5185:5186:34
MDR FERNSEHEN:530000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_AUTO:QAM_16:
  TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:5169:5170:100
NDR FS NDS*:530000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_AUTO:QAM_16:
  TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:5137:5138:129
NDR FS HH*:530000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_AUTO:QAM_16:
  TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:5137:5138:130
NDR FS SH:530000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_AUTO:QAM_16:
  TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:5137:5138:131
NDR FS MVP*:530000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_AUTO:QAM_16:
  TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:5137:5138:132
WDR Köln:530000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_AUTO:QAM_16:
  TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:5153:5154:262
kabel eins:546000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_1_2:QAM_16:
  TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:161:162:16394
N24:546000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_1_2:QAM_16:
  TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:225:226:16398
ProSieben:546000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_1_2:QAM_16:
  TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:305:306:16403
SAT.1:546000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_1_2:QAM_16:
  TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:385:386:16408
arte:570000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_1_2:QAM_16:
  TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:4385:4386:2
PHOENIX:570000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_1_2:QAM_16:
  TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:4401:4402:3
tagesschau24:570000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_1_2:QAM_16:
  TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:4417:4418:4
Das Erste:570000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_1_2:QAM_16:
  TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:4369:4370:128
RTL HH SH:626000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_1_2:QAM_16:
  TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:337:338:16405
RTL2:626000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_1_2:QAM_16:
  TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:353:354:16406
SRTL:626000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_1_2:QAM_16:
  TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:433:434:16411
VOX:626000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_1_2:QAM_16:
  TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:545:546:16418
TELE 5:778000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_1_2:QAM_16:
  TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:465:466:16413
Bibel TV:778000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_1_2:QAM_16:
  TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:673:674:16426
sixx:778000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_1_2:QAM_16:
  TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:273:274:16401
*D*AS* VIERTE*:778000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_1_2:QAM_16:
  TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:737:738:16430
arte:682000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_1_2:QAM_16:
  TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_8:HIERARCHY_NONE:4385:4386:2
PHOENIX:682000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_1_2:QAM_16:
  TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_8:HIERARCHY_NONE:4401:4402:3
tagesschau24:682000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_1_2:QAM_16:
  TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_8:HIERARCHY_NONE:4417:4418:4
Das Erste:682000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_1_2:QAM_16:
  TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_8:HIERARCHY_NONE:4369:4370:128

Last but not least you will need the VLC media player for demuxing and the actual streaming process. You can get it from videolan.org.

Demuxing the transport stream

VLC has a builtin component called Video Lan Manager (VLM).It can be configured via config files or on demand using VLCs telnet interface. In this article I will use the config file method to demux a DVB-T transport stream and stream the broadcast channels via http. The method should work with cable and satelite TV respectively, thou I haven’t tested it due to lack of cable and satelite tuners.

Create a file called dvbstream.vlm and open it in your favourite editor. Copy the following content into your dvbstream.vlm file:

new dvbt1 broadcast enabled
setup dvbt1 input "dvb-t://"
setup dvbt1 option dvb-adapter=0
setup dvbt1 option dvb-frequency=490000000
setup dvbt1 option dvb-bandwidth=8
setup dvbt1 option programs=514,515,516,517
setup dvbt1 option ts-es-id-pid

setup dvbt1 output #duplicate{dst=std{
access=http,mux=ts,dst=0.0.0.0:8080/zdf},select="program=514",dst=std{
access=http,mux=ts,dst=0.0.0.0:8080/3sat},select="program=515",dst=std{
access=http,mux=ts,dst=0.0.0.0:8080/zdfinfo},select="program=516",dst=std{
access=http,mux=ts,dst=0.0.0.0:8080/neokika},select="program=517"}

control dvbt1 play

The first line creates a new broadcast object called dvbt1 and enables it. Then the input stream for this object is defined, in this case it’s dvb-t://. The adapter ID is also needed. If you are using multiple tuners, the ID can be found via lsusb or lspci respectively. The next few lines set some options regarding the input source. The parameters dvb-frequency, dvb-bandwidth and programs are taken from the channels.conf file above. The parameter ts-es-id-pid sets the program ID (PID) to the ID of the elementary stream (ES) so the streams can be easily adressed later.

To be able to output multiple streams from one input stream, the input has to be duplicated. Each program stream is then sent to all network interfaces on the local machine (0.0.0.0) on port 8080 via http as a transport stream and the resource is named for the broadcast channel for convenient access. The select parameter determines which program stream is to be sent to that resource. The dst=std parameter tells VLC to use its standard output interface. The last line starts the streaming process.

To run the streaming call cvlc on the command line with
$ cvlc -vvv --extraintf telnet --vlm-conf dvbstream.vlm

You can access the broadcast via http://ip.of.streaming.machine:8080/tvchannel, e.g. http://192.168.1.2:8080/zdf from every device in your local network, given you’ve opened port 8080 in your streaming machine’s firewall.

You can easily stream more broadcast channels if you have more than one tuner card/stick by repeating the code from above in your dvbstream.vlm file and adjusting the parameters accordingly, e.g. dvb-adapter, -frequency, programs and output parameters.

Have fun watching your own IPTV 😉

About h0nk3ym0nk3y

Yeah, whatever, never mind

Posted on August 10, 2013, in Audio / Video, Configure and tagged , , , , , . Bookmark the permalink. 12 Comments.

  1. Hi there, maybe you can help me…
    I bought TBS 6285 card (quad tunners) , done everything as you said, but i get only first channel. others i cannot start. vlc on client side simply stops… i dont know why

    Do you have some idea?

    Thanks

    • Hi Vlaya,

      first of all I must admit I have no experience with multituners nor DVB-T2, but let’s see if we can figure something out. I need some more information in order to find a solution for your problem. Is the driver loaded correctly? Please check the Linux TV Wiki here and here. Furthermore I’d like to take a look at your lspci output, channels.conf and dvbstream.vlm files. Can you upload them somewhere (RapidShare, Pastebin, etc)?

      Best regards

  2. how about using VLC installed on windows 7 O/S to stream channels from DVB T2 Decoder?

    • Hi ken,

      as far as I know, streaming on Windows 7 using VLC should work just the same. Since there is no cvlc.exe on Windows you would have to use the vlc.exe from the Windows shell. Nevertheless the command line parameters and the dvbstream.vlm should work just fine on Windows, too.

      Best regards

  3. Great post. Any idea if this would work with a DVB-S source? I can’t imagine any reason it wouldn’t, so I’ll probably give it a go.

    • Hi Ben,

      I can’t see why it should not be possible to stream DVB-S sources in the same manner. You might need to set some additional parameters like dvb-voltage, dvb-srate, dvb-device, dvb-inversion, dvb-satno, no-dvb-high-voltage and dvb-fec (found those after a quick search here and here). I can’t test it myself since I don’t have a satelite dish or a DVB-S tuner, but if you manage to stream multiple DVB-S programs with only one tuner please let me know.

      Best regards

  4. Hi! Very nice tutorial, but i am having a problem…

    My dvbstream.vlm looks exactly as yours i only changed frequency and channel id details, but i get error on my console…

    [0x8d32520] main vlm daemon error: Load error on line 9: access=http,mux=ts,dst=0.0.0.0:8080/etv},select=program=1,dst=std{: Unknown VLM command
    [0x8d1e8f0] main libvlc warning: error while loading the configuration file

    My config is as follows: http://pastebin.com/5zMQ8cf6

    Can you see whats wrong with it?

    Regards
    Mix

    • Hi, I’m actually not the author of this post (just a co-author on this blog), but I think I know what the problem is. Starting in line 9, you have to remove the line breaks and write everything into a single line.

  5. Hallo, hat jemand geschafft dvb-s mehrere Sender mit nur einen Tuner zu streamen und geht das auch mit ffmpeg ?

  6. Hi EvilShit,

    Quoted your wicked post here on Armbian Forum, OS for many SBC boards:

    https://forum.armbian.com/index.php/topic/2841-can-h3-or-h5-support-multiple-different-tvout-and-hdmi-outputs/?fromsearch=1

    ( See post #7.)

    So I am asking you the same question: With an MPEG 4 TS input, do you think multiple independent video outputs cab be supported on one of these quad core boards?

    Cheers,
    Athar

    • Dear Athar,

      I don’t know about the H2, H3 and H5 boards specifically, but if the board exposes more than one vide output it should be possible to use them for multi monitor output just like you would do with a normal desktop computer. Do I understand you corectly that you have a MPEG-TS stream with multiple video streams you want to display simultaneously? If so, I would suggest you use one VLC instance for demuxing the stream and sending them to a socket (similar to how I did it in the article, but with the MPEG-TS stream as input) and other VLC instances to play back the demuxed streams. If you have configured multi monitor output you can arrange the video windows to your likings.

      I also remember there was (and maybe still is) a device by Matrox that was able to take a single monitor signal and split it in two independent outputs. It had one DVI input and two DVI outputs, so if you would feed it a 2048×768 input you would get two 1024×768 outputs, the left and the right half respectively. As I said I don’t know if this device is still on the market, nor can I remember the device’s name, but I think this can be found out with your favourite search engine.

      Hope I could be of some help.

      Best regards,
      h0nk3ym0nk3y

Leave a comment