Cookbook : Separating out lots of channels from a recorded DVB broadcast

Find this code here:
/Code/Python/Kamaelia/Examples/DVB_Systems/TransportStreamDemuxer.py

This simple example shows how to read back in a recorded transport stream from a file and separate out (demultiplex) several channels from it:

from Kamaelia.Device.DVB.Core import DVB_Demuxer
from Kamaelia.File.ReadFileAdaptor import ReadFileAdaptor
from Kamaelia.Chassis.Graphline import Graphline
from Kamaelia.File.Writing import SimpleFileWriter

Graphline( SOURCE=ReadFileAdaptor("BBC_MUX_1.ts"),
DEMUX=DVB_Demuxer({ 640: ["NEWS24"],
641: ["NEWS24"],
600: ["BBCONE"],
601: ["BBCONE"],
610: ["BBCTWO"],
611: ["BBCTWO"],
620: ["CBBC"],
621: ["CBBC"],
18: ["NEWS24", "BBCONE"],# "BBCTWO", "CBBC"], }),
NEWS24=SimpleFileWriter("news24.data"),
BBCONE=SimpleFileWriter("bbcone.data"),
BBCTWO=SimpleFileWriter("bbctwo.data"),
CBBC=SimpleFileWriter("cbbc.data"),
linkages={ ("SOURCE", "outbox"):("DEMUX","inbox"),
("DEMUX", "NEWS24"): ("NEWS24", "inbox"),
("DEMUX", "BBCONE"): ("BBCONE", "inbox"),
("DEMUX", "BBCTWO"): ("BBCTWO", "inbox"),
("DEMUX", "CBBC"): ("CBBC", "inbox"),
} ).run()

The DVB_Demuxer component takes, at initialization, a dictionary mapping packet IDs (PIDs) to outbox names. Each of those outboxes has been linked to a SimpleFileWriter component to write it to a file.

For all the channels there are two PIDs - one for the audio and one for the video. For two of them, we also include PID 18 which carries Event Information Tables (tables containing now & next and EPG data)

 

Kamaelia is an open source project originated from and guided by BBC Research. For more information browse the site or get in contact.

This is an ongoing community based development site. As a result the contents of this page is the opinions of the contributors of the pages involved not the organisations involved. Specificially, this page may contain personal views which are not the views of the BBC. (the site is powered by a wiki engine)

(C) Copyright 2008 Kamaelia Contributors, including the British Broadcasting Corporation, All Rights Reserved

This web site is powered by the same code created for the bicker manor project. For more details, contact Michael Sparks at BBC Research directly (cf contact)