Annotation of multiplexer/iso13818ts.1, revision 1.3

1.1       oskar       1: .\" Man page for iso13818ts
                      2: .\"
                      3: .\" Copyright (C) 2001, Convergence Integrated Media GmbH
                      4: .\" Author: Oskar Schirmer
                      5: .\"
                      6: .TH iso13818ts 1 "April 30th, 2001" "0.0.2" "Multiplexer"
                      7: .SH NAME
                      8: iso13818ts \- multiplexer for ISO 13818 transport streams
                      9: .SH SYNOPSIS
                     10: iso13818ts [COMMAND...]
                     11: .SH DESCRIPTION
                     12: Generates an ISO 13818-1 conforming transport stream from multiple
                     13: input streams.
                     14: The result is sent to \fIstdout\fR,
                     15: the input streams are read from explicitely opened files.
                     16: All of the following commands may also be fed to \fIstdin\fR during
                     17: operation by omitting the leading hyphen (e.g. \fBQ\fR) or
                     18: double-hyphen (e.g. \fBquit\fR).
                     19: .TP
                     20: \fB\-\-help\fR
                     21: Display this help.
                     22: .TP
                     23: \fB\-V\fR, \fB\-\-version\fR
                     24: Output version information.
                     25: .TP
                     26: \fB\-Q\fR, \fB\-\-quit\fR
                     27: Quit this program.
                     28: .TP
                     29: \fB\-v\fR, \fB\-\-verbose\fR [\fIlevel\fR]
                     30: Verbose mode, \fIlevel\fR = 0..6, default is 2 (providing warnings
                     31: concerning data errors), initial verbosity is 1 (providing only
                     32: program errors).
                     33: .TP
                     34: \fB\-p\fR, \fB\-\-pes\fR \fIfile\fR \fItarget_program\fR
                     35: Open a PES input \fIfile\fR,
                     36: output the contained stream as \fItarget_program\fR (range 0x0001..0xFFFF).
                     37: .TP
                     38: \fB\-p\fR, \fB\-\-pes\fR \fIfile\fR \fItarget_program\fR \fItarget_stream_id\fR
                     39: Open a PES input \fIfile\fR,
                     40: output the contained stream in \fItarget_program\fR (range 0x0001..0xFFFF)
                     41: with \fItarget_stream_id\fR (recommended range 0xBD..0xFE).
                     42: The \fIfile\fR may be specified as \fB=\fR to denote
                     43: the last previously mentioned file.
                     44: .TP
                     45: \fB\-P\fR, \fB\-\-ps\fR \fIfile\fR \fItarget_program\fR
                     46: Open a PS input \fIfile\fR,
                     47: output the contained program as \fItarget_program\fR (range 0x0001..0xFFFF).
                     48: .TP
                     49: \fB\-P\fR, \fB\-\-ps\fR \fIfile\fR \fItarget_program\fR \fIsource_stream_id\fR [\fItarget_stream_id\fR]
                     50: Open a PS input \fIfile\fR,
                     51: extract the stream with \fIsource_stream_id\fR (range 0x00..0xFF)
                     52: and output that stream in \fItarget_program\fR (range 0x0001..0xFFFF)
                     53: with \fItarget_stream_id\fR (recommended range 0xBD..0xFE).
                     54: If no \fItarget_stream_id\fR is given, \fIsource_stream_id\fR is used instead.
                     55: The \fIfile\fR may be specified as \fB=\fR to denote
                     56: the last previously mentioned file.
                     57: .TP
                     58: \fB\-T\fR, \fB\-\-ts\fR \fIfile\fR
                     59: Open a TS input \fIfile\fR,
                     60: extract all programs from it and output them.
                     61: Note, that additional SI data is not propagated,
                     62: see command \fB\-\-si\fR for further information.
                     63: .TP
                     64: \fB\-T\fR, \fB\-\-ts\fR \fIfile\fR \fIsource_program\fR [\fItarget_program\fR]
                     65: Open a TS input \fIfile\fR,
                     66: extract the program \fIsource_program\fR (range 0x0001..0xFFFF)
                     67: and output that program as \fItarget_program\fR (range 0x0001..0xFFFF).
                     68: If no \fItarget_program\fR is given,
                     69: don't change the \fIsource_program\fR number.
                     70: The \fIfile\fR may be specified as \fB=\fR to denote
                     71: the last previously mentioned file.
                     72: .TP
                     73: \fB\-T\fR, \fB\-\-ts\fR \fIfile\fR \fIsource_program\fR \fItarget_program\fR \fIsource_stream_id\fR [\fItarget_stream_id\fR]
                     74: Open a TS input \fIfile\fR,
                     75: extract the stream with \fIsource_stream_id\fR (range 0x00..0xFF)
                     76: from the program \fIsource_program\fR (range 0x0001..0xFFFF)
                     77: and output that stream as \fItarget_stream_id\fR (recommended range 0xBD..0xFE)
                     78: in program \fItarget_program\fR (range 0x0001..0xFFFF).
                     79: If no \fItarget_stream_id\fR is given, use \fIsource_stream_id\fR instead.
                     80: The \fIfile\fR may be specified as \fB=\fR to denote
                     81: the last previously mentioned file.
                     82: .TP
                     83: \fB\-c\fR, \fB\-\-close\fR \fIfile\fR
                     84: Close input \fIfile\fR, as if eof is reached.
                     85: In combination with \fB\-\-repeat\fR this causes the next repeatition
                     86: to start immediately.
                     87: Note, that the input data file is cut of as is, i.e. no attempt
                     88: is made to close the file on a clean audio or video frame border.
                     89: .TP
                     90: \fB\-a\fR, \fB\-\-append\fR \fIfile1\fR \fIfile2\fR [\fInum\fR]
                     91: Earmark another \fIfile2\fR to be opened as soon as \fIfile1\fR
                     92: comes to its end.
                     93: The appended \fIfile2\fR is foreseen to be repeated \fInum\fR
                     94: times, default is 1 (see \fB\-\-repeat\fR).
                     95: Both files must contain the same type of data,
                     96: as the data of both files is chained without considering clean
                     97: transition of audio or video sequences.
                     98: The \fIfile1\fR may be specified as \fB=\fR to denote
                     99: the last previously mentioned file.
                    100: .TP
                    101: \fB\-f\fR, \fB\-\-file\fR \fIreference_number\fR \fIfile_name\fR
                    102: The positive \fIreference_number\fR is associated with a \fIfile_name\fR.
                    103: For all following commands, the \fIreference_number\fR may be
                    104: used instead of the \fIfile_name\fR. This allows better control
                    105: over file handles, as the same file may be addressed via different
                    106: \fIreference_number\fRs.
                    107: .TP
                    108: \fB\-x\fR, \fB\-\-crop\fR \fItarget_program\fR [\fItarget_stream_id\fR]
                    109: Delete a stream given by \fItarget_stream_id\fR,
                    110: or a complete program given by \fItarget_program\fR
                    111: from the output.
                    112: The corresponding input file will be closed, if not needed otherwise.
                    113: .TP
                    114: \fB\-r\fR, \fB\-\-repeat\fR \fIfile\fR \fInum\fR
                    115: Set the repeatition counter for \fIfile\fR to \fInum\fR
                    116: (or to infinite if \fInum\fR=0).
                    117: The file will be reset as soon as eof is reached
                    118: (or it is closed by the command \fB\-\-close\fR).
                    119: Note, that the file will be reset without considering clean transition
                    120: of audio or video sequences at the restart point.
                    121: The \fIfile\fR may be specified as \fB=\fR to denote
                    122: the last previously mentioned file.
                    123: .TP
                    124: \fB\-R\fR, \fB\-\-reopen\fR
                    125: This command shall precede one of the commands that open a new file
                    126: (i.e. \fB\-\-pes\fR, \fB\-\-ps\fR or \fB\-\-ts\fR must follow
                    127: \fIon the same line\fR).
                    128: The next file will be opened with a new file handle,
                    129: regardless of whether the same file is yet open or not.
                    130: .TP
                    131: \fB\-\-si\fR \fIfile\fR [\fIlower_bound\fR \fIupper_bound\fR]
                    132: In a TS \fIfile\fR, all TS pakets with PID in the range
                    133: from \fIlower_bound\fR to \fIupper_bound\fR
                    134: (possible range 0x0000..0x1FFE, recommended range 0x10..0x1F)
                    135: inclusive are handled as SI pakets (according to ETSI EN 300 468).
                    136: These pakets are bypassed and promoted to the output without further handling.
                    137: If no further data from the \fIfile\fR is in use,
                    138: the SI pakets are promoted \fIgreedy\fR, i.e. without any timing or delay. 
                    139: If \fIlower_bound\fR and \fIupper_bound\fR are omitted,
                    140: the special handling of SI pakets is turned off for the given \fIfile\fR.
                    141: The \fIfile\fR may be specified as \fB=\fR to denote
                    142: the last previously mentioned file.
                    143: .TP
                    144: \fB\-I\fR, \fB\-\-ident\fR \fItransport_stream_id\fR
                    145: Set the output \fItransport_stream_id\fR (range 0x0000..0xFFFF).
                    146: .TP
                    147: \fB\-B\fR, \fB\-\-busy\fR [\fInum\fR]
                    148: Set the busy flag to \fInum\fR (range 0..1, default is 1).
                    149: Whenever the program has no more data to handle and
                    150: the busy flag is not set, it stops.
                    151: .TP
                    152: \fB\-\-timed\fR
                    153: Force delay timing, even if solely disk files are in use.
                    154: If not so, if delay is to be awaited while processing regular files,
                    155: the delay is skipped instead and timing information in the resulting
                    156: file is adjusted accordingly.
                    157: .TP
                    158: \fB\-F\fR, \fB\-\-fpsi\fR \fItime\fR
                    159: Set the PSI table frequency to \fItime\fR msec
                    160: (or to infinite if \fItime\fR=0, initial value is infinite).
                    161: The PAT and PMT will be generated at more or less the given
                    162: frequency, even if the tables did not change.
                    163: In any case, the next tables will be generated immediately.
                    164: .TP
1.2       oskar     165: \fB\-S\fR, \fB\-\-statistics\fR \fItime\fR
                    166: Order output load statistics to be generated about every
                    167: \fItime\fR msec.
                    168: Switch off with \fItime\fR=0. The statistics are written
                    169: to \fIstderr\fR linewise, the following values are calculated:
                    170: .RS
                    171: .TP
                    172: \fInow\fR
                    173: Internal clock in msec.
                    174: .TP
                    175: \fIout\fR
                    176: Number of bytes written to stdout since last statistics.
                    177: .TP
                    178: \fIbuf\fR
                    179: Number of bytes currently in the output buffers.
                    180: .TP
                    181: \fItime\fR
                    182: Time in msec, for how long the current contents of the
                    183: output buffers should suffice.
                    184: .RE
                    185: .TP
1.1       oskar     186: \fB\-\-badtiming\fR
                    187: In conjunction with a program stream originating from a DVB-s
                    188: digital TV receiver card, You might want to automatically
                    189: correct some of the PCR values produced by that card, to
                    190: prevent discontinuities in the output.
                    191: .SH OVERVIEW
                    192: The multiplexer is designed to run uninterrupted and
                    193: be controlled via \fIstdin\fR and \fIstderr\fR.
                    194: It may be invoked interactively with the streams to
                    195: process given as command line options or with
                    196: the commands to be processed typed into \fIstdin\fR
                    197: during operation.
                    198: The latter type of usage is also designed for use
                    199: with an user interface front-end, that may
                    200: translate some GUI input to iso13818ts commands
                    201: and filter its responses to be presented to the user
                    202: as appropriate.
                    203: .P
                    204: Three different types of input are supported:
                    205: Paketized elementary streams (PES),
                    206: Program streams (PS),
                    207: Transport streams (TS).
                    208: .P
                    209: Numeric parameters may be given in decimal (e.g. 31)
                    210: or in hex (e.g. 0x1F).
                    211: .SH DETAILS
                    212: The output file or device does not change throughout the
                    213: time the program runs. The input files, however, may vary.
                    214: Also the contents of an input file may vary, but not its
                    215: type. E.g., a file opened as program stream must contain
                    216: valid program stream data up to its end (and including
                    217: any files that are appended to this file with \fB\-\-append\fR).
                    218: .P
                    219: All basic PSI is evaluated contiguously, and changes in
                    220: the configuration (changing PID, etc.) are taken into
1.3     ! frankro   221: account and tracked. Thus a stream should not get lost
1.1       oskar     222: simply because its PID is changed in the middle of the
                    223: broadcast.
                    224: .P
                    225: When remultiplexing a transport stream, the user cannot
                    226: rely on the original PIDs to be the same in the output stream.
                    227: Usually output PIDs are different from input PIDs.
                    228: This is because all basic PSI is composed from scratch for the
                    229: output stream, with exception of the descriptors.
                    230: These are not evaluated but only copied and reused
                    231: as appropriate.
                    232: .P
                    233: For each output program one stream within this program
                    234: must contain PCR time stamps. The strategy in selecting
                    235: which stream shall carry the PCR is, first see if there
                    236: is one input stream that contains PCR, if none is found,
                    237: use the stream for which data packets are found first.
                    238: Note, that for a simple mono TV program this is not
                    239: necessarily the video stream.
                    240: .SH EXAMPLES
                    241: To convert a program stream file x.PS to a transport stream file x.TS,
                    242: with program number 42, transport stream id 23
                    243: and PAT and PMT generated about every half second:
                    244: .IP
                    245: $ iso13818ts --fpsi 500 --ident 23 --ps x.PS 42 > x.TS
                    246: .PP
                    247: If the program stream doesn't contain correct PSI,
                    248: the single streams may be extracted one by one. Assuming
                    249: one video stream (0xE0) and mono audio (0xC0):
                    250: .IP
                    251: $ iso13818ts -fpsi 500 --ident 23 --ps x.PS 42 0xE0 --ps = 42 0xC0 > x.TS
                    252: .PP
                    253: To bundle two streams originating from video devices and
                    254: send them out to a streaming device, e.g.:
                    255: .IP
                    256: $ iso13818ts -F 500 -P /dev/video0 0x7300 -P /dev/video1 0x7301 > /dev/xdvb0
                    257: .PP
                    258: To remultiplex a transport stream containing two TV programs
                    259: with program numbers 4711 and 4712, with the audio streams (0xC0)
                    260: of the TV programs exchanged:
                    261: .IP
                    262: $ iso13818ts -F 500 --file 1 /dev/rdvb0 --ts 1 4711 4711 0xE0 --ts 1 4712 4712 0xE0 --ts 1 4711 4712 0xC0 --ts 1 4712 4711 0xC0 > /dev/xdvb0
                    263: .PP
                    264: To invoke the multiplexer for interactive use, it must
                    265: be put in all-time-busy-mode. Subsequently, commands can
                    266: be fed to \fIstdin\fR, e.g. to do the same as with the
                    267: first example:
                    268: .IP
                    269: $ iso13818ts --busy > x.TS
                    270: .br
                    271: fpsi 500 ident 23
                    272: .br
                    273: ps x.PS 42
                    274: .PP
                    275: This instance of the multiplexer will not cease when the
                    276: end of file in x.PS is reached. To stop the multiplexer,
                    277: either \fBquit\fR or \fBbusy 0\fR may be typed to \fIstdin\fR.
                    278: .P
                    279: To output a movie repeatedly (e.g. seven times):
                    280: .IP
                    281: $ iso13818ts -F 500 --ps thepurpleroseofcairo.PS 777 --repeat = 7 > /dev/xdvb0
                    282: .PP
                    283: Note, that if during the movie is processed, the command
                    284: .IP
                    285: close thepurpleroseofcairo.PS
                    286: .PP
                    287: is issued, and supposed it is not yet processed the seventh time,
                    288: it is not closed, but restarted immediately.
                    289: .P
                    290: To concatenate two movies and output them in sequence:
                    291: .IP
                    292: $ iso13818ts -F 500 --ps rambo1.PS 789 --append = rambo2.PS > /dev/xdvb0
                    293: .PP
                    294: Note, that a file can only be appended to a file, that is
                    295: yet in use (i.e. being processed). Thus, it is not possible
                    296: to append a third movie (rambo3.PS) from within the command
                    297: line. Instead, the processing of the second movie must be
                    298: awaited, and then the following command can be fed to \fIstdin\fR:
                    299: .IP
                    300: append rambo2.PS rambo3.PS
                    301: .PP
                    302: To add data from a DSMCC carousel to the output, a DSMCC
                    303: carousel generator must be started seperately. The carousel
                    304: must generate the DSMCC data as a series of transport
                    305: stream packets that contain private sections. The PIDs used by
                    306: the carousel must be known (e.g. 0x10..0x1F):
                    307: .IP
                    308: $ mkfifo dsmcc_pipe
                    309: .br
                    310: $ some_dsmcc_carousel ... > dsmcc_pipe &
                    311: .br
                    312: $ iso13818ts -F 500 --busy --ts dsmcc_pipe --si = 0x10 0x1F > /dev/xdvb0
                    313: .br
                    314: ps x.PS 42
                    315: .br
                    316: ps y.PS 43
                    317: .br
                    318: \&...
                    319: .PP
                    320: .SH "KNOWN PROBLEMS"
                    321: The program might not work in conjunction with device drivers
                    322: that do not deliver or accept data unless a first read or write
                    323: is done on the device. E.g., for a MPEG video data source, that
                    324: does not produce output without being triggered by being read
                    325: from, this program will await the readability of the first
                    326: data infinitely. On the other hand it is obvious that the driver
                    327: should not encode data as long as there is no application that
                    328: will read this data.
                    329: One possibly solution to this dilemma is to patch such a driver
                    330: to interpret the \fIpoll\fR command as an order for data, thus
                    331: triggering the read mechanisms. Analogous considerations hold
                    332: for polling the output device and writing to it.
                    333: .P
                    334: Paketized elementary streams do not necessarily contain
                    335: usable time stamps, so when multiplexing raw PES, streams
                    336: belonging together may be out of sync. This is especially
                    337: noteworthy in case streams shall be demultiplexed and then
                    338: again multiplexed in some way. Results will always be better
                    339: when this remultiplexing takes place entirely within the
1.3     ! frankro   340: multiplexer, because that way timing information won't get lost.
1.1       oskar     341: .SH BUGS
                    342: Non-ISO_13818-1 descriptors (private descriptors) in
                    343: ISO_13818-1 PSI sections are not promoted.
                    344: .SH "SEE ALSO"
                    345: .BR ISO\ 13818-1 ,
                    346: .BR ETSI\ EN\ 300\ 468 .
                    347: .SH AUTHOR
                    348: Oskar Schirmer (oskar@convergence.de).

LinuxTV legacy CVS <linuxtv.org/cvs>