MUXY the Muxer

From ByteWiki

MUXY the Muxer version 0.10

Contents

Introduction

muxy is a transport stream demultiplexer. It can extract programs and save them to file. It also decodes service information to help the demultiplexer and for other features like EPG.

It is designed and build with Australian DVB-T in mind. There are currently some Australian specific features. This may be applicable in other parts of the world. Other country detail can be added.

muxy is licensed under the GPL version 2 http://www.chrysocome.net/gpl

Download

Source http://www.chrysocome.net/downloads/muxy-0.10.tgz

RPM http://www.chrysocome.net/downloads/muxy-0.10-1.i386.rpm

Usage

muxy has a command interface which uses stdin/stdout. This is designed to be used interactivly or as a slave of a dvb recording system. Commands are entered at the # prompt. Various data is printed in ??? format

muxy also has a unix domain socket interface. This uses the same commands as stdin. Results are sent back to the socket. Debug info is still printed only to stderr.

You can also start muxy as a daemon. muxy -d will redirect output to the log file muxy.log and fork off as a daemon. In this mode you must use the domain socket to communicate with muxy.

Startup

On startup, muxy will process an init file. If a filename is specifiec on the command line then that file will be used, otherwise the default filename of muxy.init will be used.

If the file is not found then some compiled in defaults will be used.

The init file can configure the tuner card and socket to allow multiple instances of muxy.

set frontend /dev/dvb/adapter0/frontend0
set demux /dev/dvb/adapter0/demux0
set dvr /dev/dvb/adapter0/dvr0
set frequency 177500000
set socket muxy.sock
listen

Supported Commands

Text in <angled brackets> indicates a user supplied variable

Text in [square brackets] indicates a choice of values. Choices are listed with a bar | seperator

exit
set <key> [$]<variable>
show [<key>|open|all]
zap
unzap
replay <input filename.ts>
open <channel index> <output filename.mpg>
reopen <recording slot> <output filename.mpg>
close <recording slot>
listen
log <filename>

exit

causes muxy to quit. All in progress recording is stopped immediatly and the DVB device is closed. This causes the DVB device to go to sleep.

listen

This causes muxy to open a unix domain socket as specified by the socket variable. Muxy will then listed for connections on this socket and once a client is connected, process any commands sent. Only one client may be connected at a time.

set

muxy keeps a list of key=value variables in memory. These can control aspects of demultiplexer and can indicate information about the state of the demultiplexer.

set frequency 177500000 will set the frequency to be used by the next zap command

set frequency $frequency_28 will set the frequency to the current value of the variable </code>frequency_28</code>

keys used by the zap command:

  • frontend the DVB frontend device (/dev/dvb/adapter0/frontend0)
  • dvr the DVB dvr device (/dev/dvb/adapter0/dvr0)
  • demux the DVB demux device (/dev/dvb/adapter0/demux0)
  • frequency the DVB-T centre frequency to zap to

keys used by the listen command:

  • socket

keys set by the demultiplexer:

  • network_name set to the network name found in the NIT table network_name descriptor
  • service_type_<program_id> set to a description on the service on <program_id>
  • service_name_<program_id> set to the name of the servcie on <program_id>
  • service_index_<program_id> set to the unique id of <program_id>. This is used internaly to muxy for tracking information about the program

keys set by the zapper:

  • zap_signal indicated if the tuner has a RF signal
  • zap_carrier indicates if the tuner has a DVB signal
  • zap_fec indicates that stable FEC detected
  • zap_sync indicates that transport syncbytes are being found
  • zap_locked indicates the tuner is supplying valid data
  • zap_timeout indicates if the tuner failed to get a lock
  • zap_bit_error_rate indicates the current bit error rate (unit unknown)
  • zap_signal_strength indicates the current signal strength (unit unknown)
  • zap_signal_noise_ratio indicates the current signal to noise ratio (unit unknown)

show

show can display 2 types of information: variables and current recordings. To display a specific variable, the syntax show <key> is used, for example show network_name.

To show the current recordings use show open.

Debug: Wed Feb  7 19:52:19 2007 [23760] Channel 5 is recording on output 0 (seven.mpg)
Debug: Wed Feb  7 19:52:19 2007 [23760] Channel 2 is recording on output 1 (seven-guide.mpg)

To show program guide use show eit*</show>. There may be a lot of eit info and this might be better handled by another program.

In the future, more information will be available, perhaps

  • show sitables
  • show sitable <id> [<extended_id>]
  • show stats

=== zap === zap tunes the DVB-T card to the frequency specified in the <code>frequency environment variable (in Hz).

zap will return immediatly even if the card has not completed tuning. You can use show zap* to check the current state.

Once the card is tuned, the data is sent to the demultiplexor and si table decoding begins.

unzap

Close the tuner card and stop processing ts packets. This will also close any open recording slots.

replay

Replay opens a pre-recorded transport stream and sends the data to the demultiplexer. This can be used for testing and may be used in the future to 'preload' the required information into the demultiplexer before processing a live stream. This would reduce the delay between starting the demultiplexer and the requires PAT, PMT and NIT tables arriving.

Recording the transport stream can be done with dvbstream dvbstream -f <frequency kHz> bw 7 -o 8192 > file.ts can this be done with muxy? not yet

open

This starts a recording of a program/channel. The available program ids can be seen from the output of the show all command. All PIDs associated with the program are saved to the output file. This should include audio, video and teletext.

The same program can be recorded simultaniously to multiple output files allowing for overlapped recordings on the same channel.

You can also record multiple programs at the same time as long as they are broadcast on the same channel (frequency). In Melbourne for example, you can record both ABC1 and ABC2 at the same time using only one tuner card.

TODO: open all - record full ts open (0x1234,0x1235) - record only these PIDs

reopen

Keeps a recording slot open but starts saving the data to a new file.

close

Stops the recording of an open recording slot. Any buffered data is flushed before closing. This may leave incomplete packets in the output file. The recording slot then becomes available to record another program.

Features

  • ZAPping (tuning) the DVB card. Currently only Terrestrial delivery is supported. Cable and Satellite could easily be added but I don't have access to hardware for testing. The ZAP code was originaly taken from dvbstream but has fully re-written so it does not block.
  • Service Information tables are build and stored in memory. Many of them are decoded, see below.
  • Saving programs (channels) to file. The output format is a filtered ts format. In the past a dodgy ps format (as created by libdvb mpegtools instant_repack) was used. This is a common format for dvb recordings but it is not a valid program stream. mplayer will play this format if the file extension is .mpg but it lackes header information required for reliable playback. The .ts format includes a PAT and PMT which should allow correct playback. TODO: Part of MPEG does deal with this.
  • teletext decoding. Australian DVB uses VBI data embedded in a PID. This can be decoded to extrace the subtitles (closed captions). At the moment nothing can use this data because it has more features than most playback tools supports. There are also a few bugs.

Details

Tables decoded

  • 0x00 PAT
  • 0x02 PMT
  • 0x40 NIT
  • 0x4e - 0x4f EIT

The PAT tells the demultiplexer which PIDs contain the NIT and PMT tables.

The PMT tells the demultiplexer which PIDs belongs to which programs

Descriptors decoded

References

  • dvbstream http://sourceforge.net/projects/dvbtools/
  • libdvb http://www.metzlerbros.org/dvb/
  • Internation Standard ISO/IEC 13818-1 "Information technology — Generic coding of moving pictures and associated audio information: Systems"
  • European Standard ETSI EN 300 468 "Digital Video Broadcasting (DVB); Specification for Service Information (SI) in DVB systems"
  • Australian Standard AS4599-2001 Draft "Digital television—Terrestrial broadcasting Part 1: Characteristics of digital terrestrial television transmissions"
  • Australian Standard AS4933.1—2005 Draft "Digital television—Requirements for receivers Part 1: 7 MHz VHF/UHF DVB-T television broadcasts"

Hardware

A lot of people get confused about DVB hardware, and little wonder the way that they get marketed. This is some real information about 2 of the cards I have.

DViCO Fusion DVB-T Plus

This card contains a single Digiatal Tuner and a single Analog Input.

Digital Tuner

The digital tuner is a PCI DVB-T tuner. It presents the following PCI devices

  • Class 0480: 14f1:8802 (rev 05) Multimedia controller: Conexant CX23880/1/2/3 PCI Video and Audio Decoder [MPEG Port]
    • Subsystem: 18ac:db10 DViCO Corporation DVICO FusionHDTV DVB-T Plus

It has the following hardware inputs:

  • 75ohm coax antenna

It has the following hardware outputs:

  • 75ohm coax antenna (allowing you to chain multiple cards to one antenna)

The tuner is implemented with the following chips:

  • Zarlink MT352
  • Conexant cx8802/cx22702 ?
  • Thomson 7579?

Under Linux, the following kernel modules are required:

  • cx88_dvb

Analog Input

The analog input is a PAL video capture device. It does not contain a TV tuner. It presents the following PCI devices

  • Class 0400: 14f1:8800 (rev 05) Multimedia video controller: Conexant CX23880/1/2/3 PCI Video and Audio Decoder
    • Subsystem: 18ac:db10 DViCO Corporation: Unknown device


It has the following hardware inputs (via an extenion cable):

  • 1 x Composite Video RCA
  • 2 x Audio RCA
  • 1 x S-Video mini DIN

I 'assume' that you must use either the Composite or the SVIDEO but not both at the same time.

The card does not contain any audio capture hardware. There is a header on the card and a cable connects that to your sound card AUX input.

The analog input is implemented with the following hardware:

  • Connexant ??

Under Linux, the following kernel modules are required to make the device available as a Video for Linux version 2 (v4l2) device

  • cx8800 (alias char-major-81 cx8800)

Compro VideoMate T750

  • Class 0480: 1131:7133 (rev d1) Multimedia controller: Philips Semiconductors SAA7133/SAA7135 Video Broadcast Decoder
    • Subsystem: 185b:c900 Compro Technology, Inc.: Unknown device

Inputs

  • 75ohm coax DVB-T Antennta
  • 75ohm coax Analog TV Antenna
  • FM Radio Antenna RCA (antenna included)
  • IR receiver 2.5mm Jack (receiver included)
  • S-Video mini DIN
  • Composite Video RCA

Also includes an antenna splitter which allows a single antenna to connect to the DVB-T and Analog TV inputs.

This is a hybrid device. That means that both the analog and digital tuners are integraded in the one chipset (SAA7135).

  • SAA7135
  • CE6353 i2c address 0x0f
  • QT1010 i2c address 0x62
  • XC2028ACQ