Annotation of multiplexer/iso13818ts.1, revision 1.17

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

LinuxTV legacy CVS <linuxtv.org/cvs>