Annotation of multiplexer/iso13818ts.1, revision 1.6

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.
1.5       oskar     141: \fBNOTE, that the \fIfile\fB must be opened with \-\-ts before!\fR
1.1       oskar     142: The \fIfile\fR may be specified as \fB=\fR to denote
                    143: the last previously mentioned file.
                    144: .TP
                    145: \fB\-I\fR, \fB\-\-ident\fR \fItransport_stream_id\fR
                    146: Set the output \fItransport_stream_id\fR (range 0x0000..0xFFFF).
                    147: .TP
                    148: \fB\-B\fR, \fB\-\-busy\fR [\fInum\fR]
                    149: Set the busy flag to \fInum\fR (range 0..1, default is 1).
                    150: Whenever the program has no more data to handle and
                    151: the busy flag is not set, it stops.
                    152: .TP
                    153: \fB\-\-timed\fR
                    154: Force delay timing, even if solely disk files are in use.
                    155: If not so, if delay is to be awaited while processing regular files,
                    156: the delay is skipped instead and timing information in the resulting
                    157: file is adjusted accordingly.
                    158: .TP
                    159: \fB\-F\fR, \fB\-\-fpsi\fR \fItime\fR
                    160: Set the PSI table frequency to \fItime\fR msec
                    161: (or to infinite if \fItime\fR=0, initial value is infinite).
                    162: The PAT and PMT will be generated at more or less the given
                    163: frequency, even if the tables did not change.
                    164: In any case, the next tables will be generated immediately.
                    165: .TP
1.4       oskar     166: \fB\-C\fR, \fB\-\-config\fR \fInum\fR
                    167: Order output configuration of target stream with \fInum\fR=1,
                    168: switch off with \fInum\fR=0.
                    169: When switched on, the configuration is printed each time it changes.
                    170: First, the number of programs is printed,
                    171: then for each program one line of description and
                    172: for each stream within that program another line is printed.
                    173: The following values are compiled:
                    174: .RS
                    175: .TP
                    176: \fIprogs\fR
                    177: Number of programs in target stream.
                    178: .TP
                    179: \fIprog\fR
                    180: Program number within target stream.
                    181: .TP
                    182: \fIpmt\fR
                    183: PMT PID for the program.
                    184: .TP
                    185: \fIpcr\fR
                    186: PCR PID for the program.
                    187: .TP
                    188: \fIstreams\fR
                    189: Number of streams in the program.
                    190: .TP
                    191: \fIstream\fR
                    192: Stream PID.
                    193: .TP
                    194: \fIsid\fR
                    195: PES stream ID.
                    196: .TP
                    197: \fItype\fR
                    198: Stream type (according to ISO 13818-1 table 2-29).
                    199: .TP
                    200: \fIfile\fR
                    201: Source file contents type (PES=0, PS=1, TS=2).
                    202: .TP
                    203: \fIsource\fR
                    204: Stream index in source file (SID for PS, PID for TS).
                    205: .TP
                    206: \fInum\fR
                    207: Source file reference number (-1 if none).
                    208: .TP
                    209: \fIname\fR
                    210: Source file name.
                    211: .RE
                    212: .TP
1.2       oskar     213: \fB\-S\fR, \fB\-\-statistics\fR \fItime\fR
                    214: Order output load statistics to be generated about every
                    215: \fItime\fR msec.
1.4       oskar     216: Switch off with \fItime\fR=0.
                    217: The statistics are written to \fIstderr\fR linewise,
                    218: the following values are calculated:
1.2       oskar     219: .RS
                    220: .TP
                    221: \fInow\fR
                    222: Internal clock in msec.
                    223: .TP
                    224: \fIout\fR
                    225: Number of bytes written to stdout since last statistics.
                    226: .TP
                    227: \fIbuf\fR
                    228: Number of bytes currently in the output buffers.
                    229: .TP
                    230: \fItime\fR
                    231: Time in msec, for how long the current contents of the
                    232: output buffers should suffice.
                    233: .RE
                    234: .TP
1.1       oskar     235: \fB\-\-badtiming\fR
                    236: In conjunction with a program stream originating from a DVB-s
                    237: digital TV receiver card, You might want to automatically
                    238: correct some of the PCR values produced by that card, to
                    239: prevent discontinuities in the output.
                    240: .SH OVERVIEW
                    241: The multiplexer is designed to run uninterrupted and
                    242: be controlled via \fIstdin\fR and \fIstderr\fR.
                    243: It may be invoked interactively with the streams to
                    244: process given as command line options or with
                    245: the commands to be processed typed into \fIstdin\fR
                    246: during operation.
                    247: The latter type of usage is also designed for use
                    248: with an user interface front-end, that may
                    249: translate some GUI input to iso13818ts commands
                    250: and filter its responses to be presented to the user
                    251: as appropriate.
                    252: .P
                    253: Three different types of input are supported:
                    254: Paketized elementary streams (PES),
                    255: Program streams (PS),
                    256: Transport streams (TS).
                    257: .P
                    258: Numeric parameters may be given in decimal (e.g. 31)
                    259: or in hex (e.g. 0x1F).
                    260: .SH DETAILS
                    261: The output file or device does not change throughout the
                    262: time the program runs. The input files, however, may vary.
                    263: Also the contents of an input file may vary, but not its
                    264: type. E.g., a file opened as program stream must contain
                    265: valid program stream data up to its end (and including
                    266: any files that are appended to this file with \fB\-\-append\fR).
                    267: .P
                    268: All basic PSI is evaluated contiguously, and changes in
                    269: the configuration (changing PID, etc.) are taken into
1.3       frankro   270: account and tracked. Thus a stream should not get lost
1.1       oskar     271: simply because its PID is changed in the middle of the
                    272: broadcast.
                    273: .P
                    274: When remultiplexing a transport stream, the user cannot
                    275: rely on the original PIDs to be the same in the output stream.
                    276: Usually output PIDs are different from input PIDs.
                    277: This is because all basic PSI is composed from scratch for the
                    278: output stream, with exception of the descriptors.
                    279: These are not evaluated but only copied and reused
                    280: as appropriate.
                    281: .P
                    282: For each output program one stream within this program
                    283: must contain PCR time stamps. The strategy in selecting
                    284: which stream shall carry the PCR is, first see if there
                    285: is one input stream that contains PCR, if none is found,
                    286: use the stream for which data packets are found first.
                    287: Note, that for a simple mono TV program this is not
                    288: necessarily the video stream.
                    289: .SH EXAMPLES
                    290: To convert a program stream file x.PS to a transport stream file x.TS,
                    291: with program number 42, transport stream id 23
                    292: and PAT and PMT generated about every half second:
                    293: .IP
                    294: $ iso13818ts --fpsi 500 --ident 23 --ps x.PS 42 > x.TS
                    295: .PP
                    296: If the program stream doesn't contain correct PSI,
                    297: the single streams may be extracted one by one. Assuming
                    298: one video stream (0xE0) and mono audio (0xC0):
                    299: .IP
                    300: $ iso13818ts -fpsi 500 --ident 23 --ps x.PS 42 0xE0 --ps = 42 0xC0 > x.TS
                    301: .PP
                    302: To bundle two streams originating from video devices and
                    303: send them out to a streaming device, e.g.:
                    304: .IP
                    305: $ iso13818ts -F 500 -P /dev/video0 0x7300 -P /dev/video1 0x7301 > /dev/xdvb0
                    306: .PP
                    307: To remultiplex a transport stream containing two TV programs
                    308: with program numbers 4711 and 4712, with the audio streams (0xC0)
                    309: of the TV programs exchanged:
                    310: .IP
                    311: $ 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
                    312: .PP
                    313: To invoke the multiplexer for interactive use, it must
                    314: be put in all-time-busy-mode. Subsequently, commands can
                    315: be fed to \fIstdin\fR, e.g. to do the same as with the
                    316: first example:
                    317: .IP
                    318: $ iso13818ts --busy > x.TS
                    319: .br
                    320: fpsi 500 ident 23
                    321: .br
                    322: ps x.PS 42
                    323: .PP
                    324: This instance of the multiplexer will not cease when the
                    325: end of file in x.PS is reached. To stop the multiplexer,
                    326: either \fBquit\fR or \fBbusy 0\fR may be typed to \fIstdin\fR.
                    327: .P
                    328: To output a movie repeatedly (e.g. seven times):
                    329: .IP
                    330: $ iso13818ts -F 500 --ps thepurpleroseofcairo.PS 777 --repeat = 7 > /dev/xdvb0
                    331: .PP
                    332: Note, that if during the movie is processed, the command
                    333: .IP
                    334: close thepurpleroseofcairo.PS
                    335: .PP
                    336: is issued, and supposed it is not yet processed the seventh time,
                    337: it is not closed, but restarted immediately.
                    338: .P
                    339: To concatenate two movies and output them in sequence:
                    340: .IP
                    341: $ iso13818ts -F 500 --ps rambo1.PS 789 --append = rambo2.PS > /dev/xdvb0
                    342: .PP
                    343: Note, that a file can only be appended to a file, that is
                    344: yet in use (i.e. being processed). Thus, it is not possible
                    345: to append a third movie (rambo3.PS) from within the command
                    346: line. Instead, the processing of the second movie must be
                    347: awaited, and then the following command can be fed to \fIstdin\fR:
                    348: .IP
                    349: append rambo2.PS rambo3.PS
                    350: .PP
                    351: To add data from a DSMCC carousel to the output, a DSMCC
                    352: carousel generator must be started seperately. The carousel
                    353: must generate the DSMCC data as a series of transport
                    354: stream packets that contain private sections. The PIDs used by
                    355: the carousel must be known (e.g. 0x10..0x1F):
                    356: .IP
                    357: $ mkfifo dsmcc_pipe
                    358: .br
                    359: $ some_dsmcc_carousel ... > dsmcc_pipe &
                    360: .br
                    361: $ iso13818ts -F 500 --busy --ts dsmcc_pipe --si = 0x10 0x1F > /dev/xdvb0
                    362: .br
                    363: ps x.PS 42
                    364: .br
                    365: ps y.PS 43
                    366: .br
                    367: \&...
                    368: .PP
                    369: .SH "KNOWN PROBLEMS"
                    370: The program might not work in conjunction with device drivers
                    371: that do not deliver or accept data unless a first read or write
                    372: is done on the device. E.g., for a MPEG video data source, that
                    373: does not produce output without being triggered by being read
                    374: from, this program will await the readability of the first
                    375: data infinitely. On the other hand it is obvious that the driver
                    376: should not encode data as long as there is no application that
                    377: will read this data.
                    378: One possibly solution to this dilemma is to patch such a driver
                    379: to interpret the \fIpoll\fR command as an order for data, thus
                    380: triggering the read mechanisms. Analogous considerations hold
                    381: for polling the output device and writing to it.
                    382: .P
                    383: Paketized elementary streams do not necessarily contain
                    384: usable time stamps, so when multiplexing raw PES, streams
                    385: belonging together may be out of sync. This is especially
                    386: noteworthy in case streams shall be demultiplexed and then
                    387: again multiplexed in some way. Results will always be better
                    388: when this remultiplexing takes place entirely within the
1.3       frankro   389: multiplexer, because that way timing information won't get lost.
1.1       oskar     390: .SH BUGS
                    391: Non-ISO_13818-1 descriptors (private descriptors) in
                    392: ISO_13818-1 PSI sections are not promoted.
                    393: .SH "SEE ALSO"
1.6     ! oskar     394: .BR repeatts (1),
        !           395: .BR iso13818ps (1),
1.1       oskar     396: .BR ISO\ 13818-1 ,
                    397: .BR ETSI\ EN\ 300\ 468 .
                    398: .SH AUTHOR
                    399: Oskar Schirmer (oskar@convergence.de).

LinuxTV legacy CVS <linuxtv.org/cvs>