RikWare
...

Introduction To Scanning DVB-T Digital TV

Sunday, 11 June 2006 15:38 by admin

Over the last weekend I've dived into some of the details of the MPEG-2 transport streams transmitted for Australian Digital TV with the goal of creating a C# library for scanning digital TV channels. This was largely prompted by a library released at forums.dvbowners.com which looked promising but which I wasn't 100% happy with due to licensing issues and its reliance on an extra DirectShow filter for parsing the MPEG tables. So instead I launched into my own library which performed the parsing itself. Surprisingly this wasn't particular difficult once you understand how the MPEG stream lays out the data. Unfortunately that info wasn't easily available anywhere... hence here's a summary of my findings with pointers to the full details. NOTE: I've only spent a couple of days gathering this info so don't expect it to be 100% correct - please leave corrections in the comments section.

I should be making the code available soon for others to play with so keep an eye on this site if you want to play.

Overview

First up, the MPEG stream contains a number of information tables for each frequency. When scanning for channels you simply tune into a certain frequency and gather information from these tables. Tables are identified using two identifiers - their PID (Packet ID) and TID (Table ID). There are quite a few tables involved, but the ones we're interested in for scanning channel info are these:

  • Program Association Table (PAT)
  • Program Map Table (PMT)
  • Service Description Table (SDT)

The PAT is our first port of call. The PAT lists the services available for a certain frequency and is always available on PID 0x00. The PAT tells us two things about each service - its program number and a PID for finding its PMT. The PMT contains a list of all of the streams associated with a service.

The PMT gives us sufficient information for tuning into each channel, but it'd be nice to have the name of the channel. This is available from the SDT which is always available on PID 0x11. The SDT lists extra info for each service including the name of the service.

Many of these tables have a list of descriptors associated with their entries. There are quite a few different types of descriptors defined. For scanning we're particularly interested in the "Service Descriptor" available on the SDT which is where the service's name is found.

Where's the Details

Of course, this doesn't provide anywhere near enough information for actually implementing a scanner, but I can point you in the right direction for getting the details. The most important documents are:

These will give you the layouts of all the tables and descriptors, but hopefully this article will speed up your search a little.

Implementing with DirectShow

DirectShow exposes these tables through the "MPEG-2 Sections and Tables" filter, using the IMpeg2Data interface. This interface takes a PID and a TID and returns the data for them. It should be relatively simple to find another tutorial on setting up a graph which contains this filter so I won't cover that.

Once you have the IMpeg2Data interface the following steps will perform a scan on the frequency that has been tuned into.

  1. Obtain the PAT by requesting PID 0x00 and TID 0x00
  2. Parse the PAT to discover the list of services available on this frequency. Store their program numbers and the PID for their PMT.
  3. Request the PMT for each service using the PID given in the PAT and a TID of 0x02
  4. Parse the PMT to gather the stream info including PIDs for each video & audio stream (and other streams such as TeleText).
  5. Request the SDT through PID 0x11 and TID 0x42
  6. Parse the SDT and search for Service Descriptors which contain the service names

Additionally you can request the Network Information Table (NIT) from PID 0x10, TID 0x40 to get the name of the provider of these services. The documentation indicates there should be a "Terrestrial Delivery System Descriptor" which could provide the actual centre frequency for the network. This could be slightly different to the frequency you originally tuned to, however so far I haven't been able to identify any of these in the actual broadcasts.

Future Work

EPG (Electronic Program Guide) data is also available from the Event Information Table (EIT) available at PID 0x12, TID 0x4E. I've done some basic tests with this and it's working, but I haven't finished cleaning it up.

Additionally, this work is only mildly attached to DVB-T - it should be pretty much identical for other DVB systems and somewhat close for ATSC based streams.

Currently rated 3.0 by 2 people

  • Currently 3/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Categories:   General
Actions:   E-mail | Kick it! | del.icio.us | Permalink | Comments (10) | Comment RSSRSS comment feed

Related posts

Comments

March 30. 2007 00:44

Unresolvable


RikWare had another problem with its commenting system. This only happened in some cases but should be all fixed up now so come back and comment on all those recent posts Smile



Unresolvable

April 8. 2007 23:24

Unresolvable


I've made some updates and re-enabled pingbacks. Hopefully spam will be reduced this time, but only time will tell...



Unresolvable

April 10. 2007 20:52

Unresolvable


Rob Mensching has outlined some info on the targets for WiX v3. (robmensching.com/.../WiX-v3-Roadmap-Draft.aspx" rel="nofollow">robmensching.com/.../WiX-v3-Roadmap-Draft.aspx)" class="ExternalLink">robmensching.com/.../WiX-v3-Roadmap-Draft.aspx" rel="nofollow">robmensching.com/.../WiX-v3-Roadmap-Draft.aspx) There's some good looking features in the roadmap. In particular I'm interested in the improved patch support and the expansion of ClickThrough support. The bootstrapper extensions sound good as well.



Congrats to the team for reaching the end of WiX v2.



Unresolvable

April 11. 2007 04:51

Unresolvable


I'm currently using http://www.nozbe.com/" class="ExternalLink">Nozbe to keep track of things I need to get done and I'm loving it. The app is easy to use, relatively quick and accessible everywhere.



Now Nozbe is still in beta which is fair enough. And I've recently tried to take advantage of the free upgrade offered as part of the beta testing. This upgrade lets me track more projects. Unfortunately, the "Add Project" feature is no longer working. Since this is a beta it doesn't bother me too much, but I'd like to submit the bug so a) it gets fixed and b) because as a developer I know that hearing about bugs is important.



BUT, this is where the real problem is. I can't easily submit a bug report! There's no link within the app itself. A bit of searching discovered the forum has a bug area. However, to write to the forum I have to sign up. At this point I gave up and figured that somebody else will report the bug. If this was my app I'd be really annoyed with me for taking advantage of the beta stage but not reporting bugs, but it's just too hard. I should be able to just click a link, write some details about the bug and submit. No extra signup (I'm already signed up to use the app!), no searching for where to report bugs.



Anyway... I guess it's a lesson learnt for me. I'll make sure that reporting bugs is obvious and easy with my apps so I can hear about the bugs, fix them and thank my beta testers for helping out.



Unresolvable

April 11. 2007 11:27

Unresolvable


With my PhD edging closer and closer to submission, I'm increasingly spending time thinking about my upcoming foray into the world of the micro ISVs. There's so many things that need to happen to take my current application and turn it into a product people would pay for. Luckily there's lots of info out there to help do that. Here's a few links to resources I'm finding helpful:



  • www.joelonsoftware.com/articles/fog0000000043.html" class="ExternalLink">The Joel Test - There's heaps of good stuff on Joel on Software but this stood out as some good thinking regarding improving the coding productivity. I'll be aiming to up the score on this a bit when I start.
  • http://momb.socio-kybernetics.net/" class="ExternalLink">The Museum of Modern Betas - Making things look good is tough for code monkeys like me but this site collects all the web 2.0 sites together in one nice list so I can browse through and steal ideas. Oh... and it's fun playing with some of the apps too.
  • http://www.squidoo.com/microisv-toolkit/" class="ExternalLink">The Micro ISV Toolkit - A set of links to stuff that's supposed to be helpful for micro ISVs. Some good, some not...



I'll probably drop some more links as I find them. Plus I'll aim to blog a bit about the micro ISV process as I go through it. Of course, sometime soon I'll actually announce what I'll be actually be releasing, but I'll wait until I've pushed the PhD out of the way first.



Unresolvable

August 15. 2007 03:48

Unresolvable


I've been quiet for awhile but not without reason. I've been hard at work converting http://www.rikware.com/WebLog/TV+Prognosticator.html" class="ExternalLink">TVP (our Imagine Cup entry from a few years ago) into a new product - www.rikpvr.com/" class="ExternalLink">RikPVR. I've just launched the beta program for RikPVR so if you have a digital TV card and you want to start using the easiest recording software available for it, go sign up for the www.rikpvr.com/Beta.aspx" class="ExternalLink">RikPVR beta program.



I've launched a new blog specifically for RikPVR over at www.rikpvr.com/blog.aspx." class="ExternalLink">http://www.rikpvr.com/blog.aspx. I'll be keeping this blog updated with major announcements, but if you want to keep right on top of RikPVR then subscribe over there as well.



Unresolvable

September 18. 2007 14:31

Unresolvable


Here's a somewhat interesting presentation about identity and the web which I felt was worth the time to watch (it wasn't too long) - http://identity20.com/media/OSCON2005/" rel="nofollow">http://identity20.com/media/OSCON2005/" class="ExternalLink">http://identity20.com/media/OSCON2005/" rel="nofollow">http://identity20.com/media/OSCON2005/



Well presented too!



Unresolvable

October 1. 2007 12:37

Unresolvable


There's a great interview with Herbie Hancock out on Wired - blog.wired.com/music/2007/10/herbie-hancock-.html" rel="nofollow">blog.wired.com/music/2007/10/herbie-hancock-.html" class="ExternalLink">blog.wired.com/music/2007/10/herbie-hancock-.html" rel="nofollow">blog.wired.com/music/2007/10/herbie-hancock-.html



Herbie is one of my favourite artists. I can't say I like all of his work, but I like a lot of it... and in many cases I like it a lot! I like looking at jazz legends and picking similarities between myself and then so I can keep deluding myself that one day I'll be able to play something like what I'd like to play (I'm a loooong way off that at the moment). In the case of Herbie I of course pick the fact that he did electrical engineering for awhile, and he obviously did it for a love of technology which led him to his later work as a synth pioneer.



Anyway, the interview's good. One point he makes which is very important for both mussos and tech people is this:



http://rikware.com/RikWik/Macro" rel="nofollow">http://rikware.com/RikWik/Macro" xmlns:xhtml="http://www.w3.org/1999/xhtml" rel="nofollow">http://www.w3.org/1999/xhtml">My advice is, don't depend on the technology. 
The music has nothing to do with the technology.
If you're doing music, the music has to come first.
And the technology is a tool for being able to produce
the things that you feel. Not the other way around



This holds for programming too. The point is the end result, not what language or platform you use to get there. Obviously you need to choose the best tools for the job, but ultimately the focus should be on what you're actually trying to do, not insisting on using your favourite tool, or the latest fad.



The other good one is something I've noticed in my own experiences too:



http://rikware.com/RikWik/Macro" rel="nofollow">http://rikware.com/RikWik/Macro" xmlns:xhtml="http://www.w3.org/1999/xhtml" rel="nofollow">http://www.w3.org/1999/xhtml">Interviewer: As a young child, you had serious talent 
in the classical area, and a passion for electronics early too,
later double-majoring in music and electrical engineering. My
dad is also a pianist, and he also almost went into engineering
at one point.

Herbie: (laughs) I think there's a relationship: math.
Particularly with jazz, but not necessarily only with jazz,
with classical music too. There's also a sense of exploration
that's involved with science and with music that links them together.


Unresolvable

October 19. 2007 12:28

Unresolvable


RikPVR is now available to everyone. After a beta program including testers throughout Australia, the UK and Europe, RikPVR v1.0 has been released.



And to celebrate the release a special introductory price of $30 (Australian) is available till the end of November. This gives you enough time to download the free 30 day trial and still purchase RikPVR at a discounted price.



Head over to http://www.rikpvr.com/" rel="nofollow">http://www.rikpvr.com/" class="ExternalLink">http://www.rikpvr.com/" rel="nofollow">http://www.rikpvr.com/ to find out more.



Unresolvable

October 30. 2007 16:43

Unresolvable


http://www.urlrewriter.net/" class="ExternalLink">UrlRewriter.NET is a great tool for url rewriting in .NET. It can even be used to redirect domain names with.



e.g. RikPVR's main address is http://www.rikpvr.com/" rel="nofollow">http://www.rikpvr.com/" rel="nofollow">http://www.rikpvr.com/" rel="nofollow">http://www.rikpvr.com/," class="ExternalLink">http://www.rikpvr.com/" rel="nofollow">http://www.rikpvr.com/" rel="nofollow">http://www.rikpvr.com/" rel="nofollow">http://www.rikpvr.com/, but it can also be found at www.rikdvr.com/" rel="nofollow">http://www.rikdvr.com/" rel="nofollow">www.rikdvr.com/" rel="nofollow">http://www.rikdvr.com/," class="ExternalLink">www.rikdvr.com/" rel="nofollow">http://www.rikdvr.com/" rel="nofollow">www.rikdvr.com/" rel="nofollow">http://www.rikdvr.com/,http://rikdvr.com/" rel="nofollow">http://rikdvr.com/" class="ExternalLink">http://rikdvr.com/" rel="nofollow">http://rikdvr.com/ or http://rikpvr.com/" rel="nofollow">http://rikpvr.com/" class="ExternalLink">http://rikpvr.com/" rel="nofollow">http://rikpvr.com/ but ideally these should just redirect to the primary address. Using a host condition in UrlRewriter.NET makes this easy:



http://rikware.com/RikWik/Macro" xmlns:xhtml="http://www.w3.org/1999/xhtml">
<if header="HOST" match="^((www.rikdvr.com)|(rikdvr.com)|(rikpvr.com))$">
<redirect name="RikDVR" url="^(.*)$" to="http://www.rikpvr.com$1" />
</if>


Unresolvable

Add comment


(Will show your Gravatar icon)  

  Country flag





Live preview

November 21. 2008 20:00