Annotation of multiplexer/iso13818ts.1, revision 1.30

1.1       oskar       1: .\" Man page for iso13818ts
                      2: .\"
1.16      oskar       3: .\" Copyright (C) GPL 2001, Convergence Integrated Media GmbH
1.24      oskar       4: .\" Copyright (C) GPL 2004..2005, Oskar Schirmer
1.1       oskar       5: .\"
1.29      oskar       6: .TH iso13818ts 1 "DATE" "VERSION" "Multiplexer"
1.1       oskar       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.
1.21      oskar      61: Note, that program specific information (PSI) is propagated,
                     62: i.e. program association tables (PAT) and program map tables (PMT)
                     63: are handled, both on input and output.
                     64: Only additional SI data (in the sense of ETSI EN 300 468)
                     65: is not propagated,
1.1       oskar      66: see command \fB\-\-si\fR for further information.
                     67: .TP
                     68: \fB\-T\fR, \fB\-\-ts\fR \fIfile\fR \fIsource_program\fR [\fItarget_program\fR]
                     69: Open a TS input \fIfile\fR,
                     70: extract the program \fIsource_program\fR (range 0x0001..0xFFFF)
                     71: and output that program as \fItarget_program\fR (range 0x0001..0xFFFF).
                     72: If no \fItarget_program\fR is given,
                     73: don't change the \fIsource_program\fR number.
                     74: The \fIfile\fR may be specified as \fB=\fR to denote
                     75: the last previously mentioned file.
                     76: .TP
                     77: \fB\-T\fR, \fB\-\-ts\fR \fIfile\fR \fIsource_program\fR \fItarget_program\fR \fIsource_stream_id\fR [\fItarget_stream_id\fR]
                     78: Open a TS input \fIfile\fR,
                     79: extract the stream with \fIsource_stream_id\fR (range 0x00..0xFF)
                     80: from the program \fIsource_program\fR (range 0x0001..0xFFFF)
                     81: and output that stream as \fItarget_stream_id\fR (recommended range 0xBD..0xFE)
                     82: in program \fItarget_program\fR (range 0x0001..0xFFFF).
                     83: If no \fItarget_stream_id\fR is given, use \fIsource_stream_id\fR instead.
                     84: The \fIfile\fR may be specified as \fB=\fR to denote
                     85: the last previously mentioned file.
                     86: .TP
1.11      oskar      87: \fB\-T\fR, \fB\-\-ts\fR \fIfile\fR 0 \fItarget_program\fR \fIsource_stream_id\fR [\fItarget_stream_id\fR]
                     88: As before, but extract a stream with \fIsource_stream_id\fR (range 0x00..0xFF)
                     89: from a transport stream with broken or missing PAT/PMT information.
                     90: The stream is opened only, if there is \fBnot\fR any entry in the
                     91: tables for that stream.
                     92: Note, that if there is more than one stream with the given
                     93: \fIsource_stream_id\fR,
                     94: only one matching stream will be opened, and
                     95: the choice is not deterministic.
                     96: .TP
1.1       oskar      97: \fB\-c\fR, \fB\-\-close\fR \fIfile\fR
                     98: Close input \fIfile\fR, as if eof is reached.
                     99: In combination with \fB\-\-repeat\fR this causes the next repeatition
                    100: to start immediately.
                    101: Note, that the input data file is cut of as is, i.e. no attempt
1.15      oskar     102: is made to close the file on a clean audio or video frame boundary.
1.1       oskar     103: .TP
                    104: \fB\-a\fR, \fB\-\-append\fR \fIfile1\fR \fIfile2\fR [\fInum\fR]
                    105: Earmark another \fIfile2\fR to be opened as soon as \fIfile1\fR
                    106: comes to its end.
                    107: The appended \fIfile2\fR is foreseen to be repeated \fInum\fR
                    108: times, default is 1 (see \fB\-\-repeat\fR).
                    109: Both files must contain the same type of data,
                    110: as the data of both files is chained without considering clean
                    111: transition of audio or video sequences.
                    112: The \fIfile1\fR may be specified as \fB=\fR to denote
                    113: the last previously mentioned file.
                    114: .TP
                    115: \fB\-f\fR, \fB\-\-file\fR \fIreference_number\fR \fIfile_name\fR
                    116: The positive \fIreference_number\fR is associated with a \fIfile_name\fR.
                    117: For all following commands, the \fIreference_number\fR may be
                    118: used instead of the \fIfile_name\fR. This allows better control
                    119: over file handles, as the same file may be addressed via different
                    120: \fIreference_number\fRs.
                    121: .TP
                    122: \fB\-x\fR, \fB\-\-crop\fR \fItarget_program\fR [\fItarget_stream_id\fR]
                    123: Delete a stream given by \fItarget_stream_id\fR,
                    124: or a complete program given by \fItarget_program\fR
                    125: from the output.
1.13      oskar     126: The corresponding input file(s) will be closed, if not needed otherwise.
1.1       oskar     127: .TP
                    128: \fB\-r\fR, \fB\-\-repeat\fR \fIfile\fR \fInum\fR
                    129: Set the repeatition counter for \fIfile\fR to \fInum\fR
                    130: (or to infinite if \fInum\fR=0).
                    131: The file will be reset as soon as eof is reached
                    132: (or it is closed by the command \fB\-\-close\fR).
                    133: Note, that the file will be reset without considering clean transition
                    134: of audio or video sequences at the restart point.
                    135: The \fIfile\fR may be specified as \fB=\fR to denote
                    136: the last previously mentioned file.
                    137: .TP
                    138: \fB\-R\fR, \fB\-\-reopen\fR
                    139: This command shall precede one of the commands that open a new file
                    140: (i.e. \fB\-\-pes\fR, \fB\-\-ps\fR or \fB\-\-ts\fR must follow
                    141: \fIon the same line\fR).
                    142: The next file will be opened with a new file handle,
                    143: regardless of whether the same file is yet open or not.
                    144: .TP
                    145: \fB\-\-si\fR \fIfile\fR [\fIlower_bound\fR \fIupper_bound\fR]
1.21      oskar     146: This command is meant to allow propagation of non-program data
                    147: streams.
                    148: It is not needed for normal multiplexing,
                    149: because all basic PSI is generated automatically.
                    150: With \fB\-\-si\fR however,
                    151: in a TS \fIfile\fR, all TS pakets with PID in the range
1.1       oskar     152: from \fIlower_bound\fR to \fIupper_bound\fR
1.22      oskar     153: (possible range 0x0001..0x1FFE, recommended range 0x0010..0x001F)
1.21      oskar     154: inclusive are handled as additional SI pakets (according to ETSI EN 300 468).
1.1       oskar     155: These pakets are bypassed and promoted to the output without further handling.
                    156: If no further data from the \fIfile\fR is in use,
                    157: the SI pakets are promoted \fIgreedy\fR, i.e. without any timing or delay. 
                    158: If \fIlower_bound\fR and \fIupper_bound\fR are omitted,
                    159: the special handling of SI pakets is turned off for the given \fIfile\fR.
1.5       oskar     160: \fBNOTE, that the \fIfile\fB must be opened with \-\-ts before!\fR
1.1       oskar     161: The \fIfile\fR may be specified as \fB=\fR to denote
                    162: the last previously mentioned file.
                    163: .TP
1.9       oskar     164: \fB\-\-sipid\fR \fItarget_program\fR [\fIpid\fR [\fIstream_type\fR]]
                    165: Manually add or delete entries to the target PMT for the given
                    166: \fItarget_program\fR.
1.21      oskar     167: This command is not needed for normal multiplexing,
                    168: because all basic PSI is generated automatically.
1.9       oskar     169: To add an entry, all three parameters must be provided.
                    170: If an entry for the given \fIpid\fR (range 0x0001..0x1FFE) does exist,
                    171: the new \fIstream_type\fR (range 0x00..0xFF) is set
                    172: and all descriptors are cleared.
                    173: If no \fIstream_type\fR is given, a corresponding entry
                    174: in the PMT is deleted,
                    175: if it was added thru \fB\-\-sipid\fR earlier.
                    176: If no \fIpid\fR and no \fIstream_type\fR is given, all
                    177: entries for the \fItarget_program\fR in the PMT are deleted,
                    178: which have been added thru \fB\-\-sipid\fR earlier.
                    179: Note, that regular entries, i.e. those which are generated
                    180: automatically instead of using \fB\-\-sipid\fR,
                    181: cannot be changed.
                    182: Note, that entries added through \fB\-\-sipid\fR are
                    183: solely entries in the PMT, but there is not any corresponding
                    184: data stream created.
                    185: \fB\-\-sipid\fR is meant to be used in conjunction
                    186: with the \fB\-\-si\fR command, which in turn causes
                    187: data to arise in the target stream without listing it
                    188: in the PMT.
                    189: .TP
1.10      oskar     190: \fB\-\-descr\fR \fItarget_program\fR [\fIdescr_tag\fR [\fIdescr_length\fR \fIdata\fR...]]
                    191: Add, inhibit or delete in the PMT section a descriptor,
                    192: that does \fBnot\fR belong to a specific stream.
                    193: To add a descriptor, all parameters must be given,
                    194: \fIdescr_tag\fR (range 0x00..0xFF),
                    195: \fIdescr_length\fR (range 1..255),
                    196: and the appropriate amount of bytes given as \fIdata\fR (range 0x00..0xFF).
                    197: To inhibit any descriptor with a given \fIdescr_tag\fR,
                    198: \fIdescr_length\fR is set to \fB0\fR and no \fIdata\fR is given.
                    199: This causes matching descriptors from input streams to
                    200: be discarded instead of being copied to the target stream.
                    201: To delete the manual setting of a descriptor,
                    202: \fIdescr_length\fR is omitted. This causes descriptors
                    203: with matching \fIdescr_tag\fR to be passed from input to
                    204: the target stream.
                    205: To delete all manual settings for a \fItarget_program\fR,
                    206: that do \fBnot\fR belong to a specific stream,
                    207: the \fIdescr_tag\fR is omitted, too.
                    208: Note, that \fB\-\-descr\fR never modifies descriptors,
                    209: that belong to a specific stream.
                    210: To modify these, use the command \fB\-\-sdescr\fR or \fB\-\-pdescr\fR.
                    211: .TP
                    212: \fB\-\-sdescr\fR [\fItarget_program\fR [\fIstream_id\fR [\fIdescr_tag\fR [\fIdescr_length\fR \fIdata\fR...]]]]
                    213: Add, inhibit or delete in the PMT section a descriptor,
                    214: that does belong to a specific stream.
                    215: To add a descriptor, all parameters must be given,
                    216: \fIstream_id\fR (recommended range 0xBD..0xFE),
                    217: \fIdescr_tag\fR (range 0x00..0xFF),
                    218: \fIdescr_length\fR (range 1..255),
                    219: and the appropriate amount of bytes given as \fIdata\fR (range 0x00..0xFF).
                    220: To inhibit any descriptor with a given \fIdescr_tag\fR,
                    221: \fIdescr_length\fR is set to \fB0\fR and no \fIdata\fR is given.
                    222: This causes matching descriptors from the corresponding input streams to
                    223: be discarded instead of being copied to the target stream.
                    224: To delete the manual setting of a descriptor,
                    225: \fIdescr_length\fR is omitted. This causes descriptors
                    226: with matching \fIdescr_tag\fR to be passed from input to
                    227: the target stream.
                    228: To delete all manual settings for a \fIstream_id\fR in
                    229: the \fItarget_program\fR,
                    230: the \fIdescr_tag\fR is omitted, too.
                    231: To delete all manual settings for all streams \fBand\fR those
                    232: that do not belong to a specific stream,
                    233: the \fIstream_id\fR is omitted, too.
                    234: Finally, to delete all manual settings in all programs,
                    235: all parameters are omitted.
                    236: .TP
                    237: \fB\-\-pdescr\fR [\fItarget_program\fR [\fIpid\fR [\fIdescr_tag\fR [\fIdescr_length\fR \fIdata\fR...]]]]
                    238: Add, inhibit or delete in the PMT section a descriptor,
                    239: that does belong to a specific stream.
                    240: To add a descriptor, all parameters must be given,
                    241: \fIpid\fR (range 0x0001..0x1FFE),
                    242: \fIdescr_tag\fR (range 0x00..0xFF),
                    243: \fIdescr_length\fR (range 1..255),
                    244: and the appropriate amount of bytes given as \fIdata\fR (range 0x00..0xFF).
                    245: To inhibit any descriptor with a given \fIdescr_tag\fR,
                    246: \fIdescr_length\fR is set to \fB0\fR and no \fIdata\fR is given.
                    247: This causes matching descriptors from the corresponding input streams to
                    248: be discarded instead of being copied to the target stream.
                    249: To delete the manual setting of a descriptor,
                    250: \fIdescr_length\fR is omitted. This causes descriptors
                    251: with matching \fIdescr_tag\fR to be passed from input to
                    252: the target stream.
                    253: To delete all manual settings for a \fIpid\fR in
                    254: the \fItarget_program\fR,
                    255: the \fIdescr_tag\fR is omitted, too.
                    256: To delete all manual settings for all streams \fBand\fR those
                    257: that do not belong to a specific stream,
                    258: the \fIpid\fR is omitted, too.
                    259: Finally, to delete all manual settings in all programs,
                    260: all parameters are omitted.
                    261: Note, that, in contrast to \fB\-\-descr\fR and \fB\-\-sdescr\fR,
                    262: with \fB\-\-pdescr\fR it is possible to set
                    263: descriptors for PMT entries, that have been added using \fB\-\-sipid\fR.
                    264: .TP
1.1       oskar     265: \fB\-I\fR, \fB\-\-ident\fR \fItransport_stream_id\fR
                    266: Set the output \fItransport_stream_id\fR (range 0x0000..0xFFFF).
                    267: .TP
                    268: \fB\-B\fR, \fB\-\-busy\fR [\fInum\fR]
1.14      oskar     269: Set the busy flag to \fInum\fR (range 0..1, default is 1, initial is 0).
1.1       oskar     270: Whenever the program has no more data to handle and
                    271: the busy flag is not set, it stops.
                    272: .TP
                    273: \fB\-\-timed\fR
                    274: Force delay timing, even if solely disk files are in use.
                    275: If not so, if delay is to be awaited while processing regular files,
                    276: the delay is skipped instead and timing information in the resulting
                    277: file is adjusted accordingly.
                    278: .TP
                    279: \fB\-F\fR, \fB\-\-fpsi\fR \fItime\fR
                    280: Set the PSI table frequency to \fItime\fR msec
                    281: (or to infinite if \fItime\fR=0, initial value is infinite).
                    282: The PAT and PMT will be generated at more or less the given
                    283: frequency, even if the tables did not change.
                    284: In any case, the next tables will be generated immediately.
                    285: .TP
1.7       oskar     286: \fB\-\-trigin\fR \fItime\fR
                    287: Set the input buffer trigger timing to \fItime\fR.
                    288: For any input stream, that is newly opened
                    289: (or has to be retriggered, e.g. due to intermediate emptiness),
                    290: the buffer is triggered for promotion to the splice unit
                    291: with a delay of \fItime\fR msec compared to the time
                    292: of data entrance into the buffer.
                    293: For any stream yet triggered the timing is not changed
                    294: unless retriggering takes place.
                    295: Not affected by this value are the other trigger conditions,
                    296: mainly a certain buffer fullness
                    297: and cotriggering with a corresponding stream that is triggered.
                    298: .TP
                    299: \fB\-\-trigout\fR \fItime\fR
                    300: Set the output buffer trigger timing to \fItime\fR.
                    301: As the output buffer is triggered for promotion to \fIstdout\fR,
                    302: this is done with a delay of \fItime\fR msec compared to the time
                    303: of data entrance into the buffer.
                    304: The new timing is only valid if set before the first triggering
                    305: of the output buffer,
                    306: or if retriggering takes place, e.g. due to intermediate emptiness.
                    307: Not affected by this value is the trigger condition
                    308: of a certain buffer fullness.
                    309: .TP
1.4       oskar     310: \fB\-C\fR, \fB\-\-config\fR \fInum\fR
                    311: Order output configuration of target stream with \fInum\fR=1,
                    312: switch off with \fInum\fR=0.
1.10      oskar     313: Set \fInum\fR=2, to get information about descriptors, too.
1.4       oskar     314: When switched on, the configuration is printed each time it changes.
                    315: First, the number of programs is printed,
                    316: then for each program one line of description and
                    317: for each stream within that program another line is printed.
1.10      oskar     318: When \fInum\fR=2, then for each descriptor there is printed one more line.
1.4       oskar     319: The following values are compiled:
                    320: .RS
                    321: .TP
                    322: \fIprogs\fR
                    323: Number of programs in target stream.
                    324: .TP
                    325: \fIprog\fR
                    326: Program number within target stream.
                    327: .TP
                    328: \fIpmt\fR
                    329: PMT PID for the program.
                    330: .TP
                    331: \fIpcr\fR
                    332: PCR PID for the program.
                    333: .TP
                    334: \fIstreams\fR
                    335: Number of streams in the program.
1.9       oskar     336: A number in parantheses may be added that denotes how many of these
                    337: streams are not PES data streams, but have been added by use of the
                    338: \fB\-\-sipid\fR option to the PMT.
1.4       oskar     339: .TP
                    340: \fIstream\fR
                    341: Stream PID.
                    342: .TP
1.9       oskar     343: \fItype\fR
                    344: Stream type (according to ISO 13818-1 table 2-29).
                    345: .TP
1.4       oskar     346: \fIsid\fR
                    347: PES stream ID.
                    348: .TP
                    349: \fIfile\fR
                    350: Source file contents type (PES=0, PS=1, TS=2).
                    351: .TP
                    352: \fIsource\fR
                    353: Stream index in source file (SID for PS, PID for TS).
                    354: .TP
                    355: \fInum\fR
                    356: Source file reference number (-1 if none).
                    357: .TP
                    358: \fIname\fR
                    359: Source file name.
1.10      oskar     360: .TP
                    361: \fIdescr\fR
                    362: Descriptor tag.
                    363: .TP
                    364: \fIlen\fR
                    365: Descriptor length, number of data bytes in the descriptor.
                    366: .TP
                    367: \fIdata\fR
                    368: Descriptor data, bytewise.
1.4       oskar     369: .RE
                    370: .TP
1.2       oskar     371: \fB\-S\fR, \fB\-\-statistics\fR \fItime\fR
                    372: Order output load statistics to be generated about every
                    373: \fItime\fR msec.
1.4       oskar     374: Switch off with \fItime\fR=0.
                    375: The statistics are written to \fIstderr\fR linewise,
                    376: the following values are calculated:
1.2       oskar     377: .RS
                    378: .TP
                    379: \fInow\fR
                    380: Internal clock in msec.
                    381: .TP
                    382: \fIout\fR
1.7       oskar     383: Number of bytes written to stdout since last statistics,
                    384: and number of write operations needed.
1.2       oskar     385: .TP
                    386: \fIbuf\fR
1.7       oskar     387: Number of bytes in the output buffers (lower and upper bound).
1.2       oskar     388: .TP
                    389: \fItime\fR
1.7       oskar     390: Time in msec, for how long the contents of the
                    391: output buffers should suffice (lower and upper bound).
                    392: .TP
                    393: \fIburst\fR
                    394: Size of write burst, i.e. number of bytes prepared to
                    395: be written in a single write operation (lower and upper bound).
1.2       oskar     396: .RE
                    397: .TP
1.24      oskar     398: \fB\-\-nit\fR [\fIpid\fR]
                    399: Include the given network \fIpid\fR
                    400: (range 0x0001..0x1FFE, recommended value 0x0010)
                    401: in the program association table.
                    402: If no \fIpid\fR is given, omit any network pid.
                    403: .TP
1.1       oskar     404: \fB\-\-badtiming\fR
                    405: In conjunction with a program stream originating from a DVB-s
                    406: digital TV receiver card, You might want to automatically
1.17      oskar     407: correct broken PCR values produced by that card, to
                    408: avoid discontinuities in the output.
                    409: .TP
                    410: \fB\-\-conservativepids\fR [\fInum\fR]
                    411: Though PIDs are only of significance to internally link
                    412: elementary streams in a transport stream, for test purposes
                    413: it might be desired to keep PIDs across multiplexing
                    414: (range 0..1, default is 1, initial is 0).
1.1       oskar     415: .SH OVERVIEW
                    416: The multiplexer is designed to run uninterrupted and
                    417: be controlled via \fIstdin\fR and \fIstderr\fR.
1.8       oskar     418: It is designed to process data in real time,
                    419: i.e. if the processing is not performed fast
1.18      oskar     420: enough (e.g. because of low system performance),
1.8       oskar     421: errors in the resulting data may occur, namely
                    422: concerning the timing.
1.9       oskar     423: The multiplexer may be invoked interactively with
1.8       oskar     424: the streams to process given as command line options
                    425: or with the commands to be processed typed into
                    426: \fIstdin\fR during operation.
1.1       oskar     427: The latter type of usage is also designed for use
                    428: with an user interface front-end, that may
                    429: translate some GUI input to iso13818ts commands
                    430: and filter its responses to be presented to the user
                    431: as appropriate.
                    432: .P
                    433: Three different types of input are supported:
                    434: Paketized elementary streams (PES),
                    435: Program streams (PS),
                    436: Transport streams (TS).
                    437: .P
                    438: Numeric parameters may be given in decimal (e.g. 31)
                    439: or in hex (e.g. 0x1F).
                    440: .SH DETAILS
                    441: The output file or device does not change throughout the
                    442: time the program runs. The input files, however, may vary.
                    443: Also the contents of an input file may vary, but not its
                    444: type. E.g., a file opened as program stream must contain
                    445: valid program stream data up to its end (and including
                    446: any files that are appended to this file with \fB\-\-append\fR).
                    447: .P
                    448: All basic PSI is evaluated contiguously, and changes in
                    449: the configuration (changing PID, etc.) are taken into
1.3       frankro   450: account and tracked. Thus a stream should not get lost
1.1       oskar     451: simply because its PID is changed in the middle of the
                    452: broadcast.
                    453: .P
                    454: When remultiplexing a transport stream, the user cannot
                    455: rely on the original PIDs to be the same in the output stream.
                    456: Usually output PIDs are different from input PIDs.
                    457: This is because all basic PSI is composed from scratch for the
                    458: output stream, with exception of the descriptors.
                    459: These are not evaluated but only copied and reused
                    460: as appropriate.
                    461: .P
                    462: For each output program one stream within this program
                    463: must contain PCR time stamps. The strategy in selecting
                    464: which stream shall carry the PCR is, first see if there
                    465: is one input stream that contains PCR, if none is found,
                    466: use the stream for which data packets are found first.
                    467: Note, that for a simple mono TV program this is not
                    468: necessarily the video stream.
1.9       oskar     469: .P
                    470: When using the command \fB\-\-si\fR,
                    471: PID collisions may occur with source stream PIDs
                    472: as well as with target stream PIDs.
                    473: .br
                    474: For source collisions, data streams win,
                    475: i.e. if a packet is encountered,
                    476: that matches the PAT and PMT description of the input file
                    477: as well as the range given by \fB\-\-si\fR,
                    478: the latter match is ignored and the packet is
                    479: processed as PES data packet
                    480: (or PMT packet, if appropriate).
                    481: .br
                    482: For target collisions, the \fB\-\-si\fR range wins,
                    483: i.e. the attempt is made not to assign PIDs to
                    484: target data streams (or PMT streams),
                    485: that are covered by a range given by \fB\-\-si\fR.
                    486: If this attempt fails, e.g. because the full range
                    487: was given with \fI\-\-si 0x0010 0x1FFE\fR,
                    488: the potential collision is accepted, because there
                    489: is no easy algorithm to get around it.
                    490: Instead, the user should avoid covering the full range
                    491: with \fB\-\-si\fR and preferredly only state those
                    492: PIDs, which actually will contain SI packets.
1.21      oskar     493: \fBWhenever possible, the best choice is not to use \-\-si at all\fR.
1.9       oskar     494: .P
                    495: Note, that no collision check is done for PIDs,
                    496: that are given with the \fB\-\-sipid\fR command.
                    497: This is because these PIDs are assumed to be
                    498: covered by a corresponding \fB\-\-si\fR.
1.1       oskar     499: .SH EXAMPLES
                    500: To convert a program stream file x.PS to a transport stream file x.TS,
                    501: with program number 42, transport stream id 23
                    502: and PAT and PMT generated about every half second:
                    503: .IP
                    504: $ iso13818ts --fpsi 500 --ident 23 --ps x.PS 42 > x.TS
                    505: .PP
                    506: If the program stream doesn't contain correct PSI,
                    507: the single streams may be extracted one by one. Assuming
                    508: one video stream (0xE0) and mono audio (0xC0):
                    509: .IP
1.7       oskar     510: $ iso13818ts --fpsi 500 --ident 23 --ps x.PS 42 0xE0 --ps = 42 0xC0 > x.TS
1.1       oskar     511: .PP
                    512: To bundle two streams originating from video devices and
                    513: send them out to a streaming device, e.g.:
                    514: .IP
                    515: $ iso13818ts -F 500 -P /dev/video0 0x7300 -P /dev/video1 0x7301 > /dev/xdvb0
                    516: .PP
                    517: To remultiplex a transport stream containing two TV programs
                    518: with program numbers 4711 and 4712, with the audio streams (0xC0)
                    519: of the TV programs exchanged:
                    520: .IP
                    521: $ 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
                    522: .PP
                    523: To invoke the multiplexer for interactive use, it must
                    524: be put in all-time-busy-mode. Subsequently, commands can
                    525: be fed to \fIstdin\fR, e.g. to do the same as with the
                    526: first example:
                    527: .IP
                    528: $ iso13818ts --busy > x.TS
                    529: .br
                    530: fpsi 500 ident 23
                    531: .br
                    532: ps x.PS 42
                    533: .PP
                    534: This instance of the multiplexer will not cease when the
                    535: end of file in x.PS is reached. To stop the multiplexer,
                    536: either \fBquit\fR or \fBbusy 0\fR may be typed to \fIstdin\fR.
                    537: .P
                    538: To output a movie repeatedly (e.g. seven times):
                    539: .IP
                    540: $ iso13818ts -F 500 --ps thepurpleroseofcairo.PS 777 --repeat = 7 > /dev/xdvb0
                    541: .PP
                    542: Note, that if during the movie is processed, the command
                    543: .IP
                    544: close thepurpleroseofcairo.PS
                    545: .PP
                    546: is issued, and supposed it is not yet processed the seventh time,
                    547: it is not closed, but restarted immediately.
                    548: .P
                    549: To concatenate two movies and output them in sequence:
                    550: .IP
                    551: $ iso13818ts -F 500 --ps rambo1.PS 789 --append = rambo2.PS > /dev/xdvb0
                    552: .PP
                    553: Note, that a file can only be appended to a file, that is
                    554: yet in use (i.e. being processed). Thus, it is not possible
                    555: to append a third movie (rambo3.PS) from within the command
                    556: line. Instead, the processing of the second movie must be
                    557: awaited, and then the following command can be fed to \fIstdin\fR:
                    558: .IP
                    559: append rambo2.PS rambo3.PS
                    560: .PP
                    561: To add data from a DSMCC carousel to the output, a DSMCC
                    562: carousel generator must be started seperately. The carousel
                    563: must generate the DSMCC data as a series of transport
                    564: stream packets that contain private sections. The PIDs used by
1.7       oskar     565: the carousel must be known (e.g. 0x10..0x1F). Supposed use of
                    566: the DSMCC carousel data provider \fIrepeatts\fR:
1.1       oskar     567: .IP
                    568: $ mkfifo dsmcc_pipe
                    569: .br
1.7       oskar     570: $ repeatts 8000 2000 dsmcc_data.TS > dsmcc_pipe &
1.1       oskar     571: .br
                    572: $ iso13818ts -F 500 --busy --ts dsmcc_pipe --si = 0x10 0x1F > /dev/xdvb0
                    573: .br
                    574: ps x.PS 42
                    575: .br
                    576: ps y.PS 43
                    577: .br
                    578: \&...
                    579: .PP
1.12      oskar     580: If the source is a transport stream with broken or
                    581: missing PSI (i.e. PAT/PMT), and if further it can
                    582: be assumed, that there is only one program to be found
                    583: in the stream, then the \fIsource program number\fR
                    584: can be specified as \fB0\fR. With the following
                    585: example, one video and one audio stream are extracted
                    586: (the first one found, if more than one exist)
                    587: and output as \fItarget program number\fR 42:
                    588: .IP
                    589: $ iso13818ts -F 500 -T deficient.TS 0 42 0xE0 -T = 0 42 0xC0 > complete.TS
                    590: .PP
1.1       oskar     591: .SH "KNOWN PROBLEMS"
                    592: The program might not work in conjunction with device drivers
                    593: that do not deliver or accept data unless a first read or write
                    594: is done on the device. E.g., for a MPEG video data source, that
                    595: does not produce output without being triggered by being read
                    596: from, this program will await the readability of the first
                    597: data infinitely. On the other hand it is obvious that the driver
                    598: should not encode data as long as there is no application that
                    599: will read this data.
1.30    ! oskar     600: One possible solution to this dilemma is to patch such a driver
1.1       oskar     601: to interpret the \fIpoll\fR command as an order for data, thus
                    602: triggering the read mechanisms. Analogous considerations hold
                    603: for polling the output device and writing to it.
                    604: .P
                    605: Paketized elementary streams do not necessarily contain
                    606: usable time stamps, so when multiplexing raw PES, streams
                    607: belonging together may be out of sync. This is especially
                    608: noteworthy in case streams shall be demultiplexed and then
                    609: again multiplexed in some way. Results will always be better
                    610: when this remultiplexing takes place entirely within the
1.3       frankro   611: multiplexer, because that way timing information won't get lost.
1.1       oskar     612: .SH BUGS
1.9       oskar     613: End of action sometimes is not detected correctly, which
                    614: causes the multiplexer to hang.
                    615: Nevertheless, it then can be stopped by the \fBquit\fR command.
1.10      oskar     616: .P
                    617: Changing configuration is not printed if the change
                    618: is solely a descriptor coming from a source file.
1.1       oskar     619: .SH "SEE ALSO"
1.6       oskar     620: .BR repeatts (1),
                    621: .BR iso13818ps (1),
1.1       oskar     622: .BR ISO\ 13818-1 ,
                    623: .BR ETSI\ EN\ 300\ 468 .
                    624: .SH AUTHOR
1.18      oskar     625: Oskar Schirmer (schirmer@scara.com).

LinuxTV legacy CVS <linuxtv.org/cvs>