Annotation of multiplexer/iso13818ts.1, revision 1.4

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

LinuxTV legacy CVS <linuxtv.org/cvs>