ps2ts(1) Convert an H.222 program stream to H.222 transport stream

SYNOPSIS

ps2ts [switches] <infile> <outfile>

DESCRIPTION

TS tools version 1.11, ps2ts built Nov 11 2008 17:15:47
Convert an H.222 program stream to H.222 transport stream.
This program does not make use of any Program Stream Map packets in the data (mainly because I have yet to see data with any). This means that the program has to determine the stream type of the data based on the first few ES units.
This program does not output more than one video and one audio stream. If the program stream data contains more than one of each, the first will be used, and the others ignored (with a message indicating this).
It is assumed that the video stream will contain DTS values in its PES packets at reasonable intervals, which can be used as PCR values in the transport stream, and thus the video stream's PID can be used as the PCR PID in the transport stream.

Files:

<infile>
is a file containing the program stream data (but see -stdin below)
<outfile>
is an transport stream file (but see -stdout and -host below)

Input switches:

-stdin
Take input from <stdin>, instead of a named file
-dvd
The PS data is from a DVD. This is the default. This switch has no effect on MPEG-1 PS data.
-notdvd, -nodvd
The PS data is not from a DVD. The DVD specification stores AC-3 (Dolby), DTS and other audio in a specialised manner in private_stream_1.
-vstream <n>
Take video from video stream <n> (0..7). The default is the first video stream found.
-astream <n>
Take audio from audio stream <n> (0..31). The default is the first audio stream found (this includes private_stream_1 on non-DVD streams).
-ac3stream <n>
Take audio from AC3 substream <n> (0..7), from private_stream_1. This implies -dvd. (If audio is being taken from a substream, the user is assumed to have determined which one is wanted, e.g., using psreport)

Output switches:

-stdout
Write output to <stdout>, instead of a named file Forces -quiet.
-host <host>, -host <host>:<port>
Writes output (over TCP/IP) to the named <host>, instead of to a named file. If <port> is not specified, it defaults to 88.
-vpid <pid>
<pid> is the video PID to use for the data. Use '-vpid 0x<pid>' to specify a hex value. Defaults to 0x68.
-apid <pid>
<pid> is the audio PID to use for the data. Use '-apid 0x<pid>' to specify a hex value. Defaults to 0x67.
-noaudio
Don't output the audio data
-pmt <pid>
<pid> is the PMT PID to use. Use '-pmt 0x<pid>' to specify a hex value. Defaults to 0x66
-prepeat <n>
Output the program data (PAT/PMT) after every <n> PS packs. Defaults to 100.
-pad <n>
Pad the start with <n> filler TS packets, to allow a TS reader to synchronize with the datastream. Defaults to 8.

General switches:

-verbose, -v
Print a 'v' for each video packet and an 'a' for each audio packet, as it is read
-quiet, -q
Only output error messages
-max <n>, -m <n>
Maximum number of PS packs to read

Stream type:

When the TS data is being output, it is flagged to indicate whether it conforms to H.262, H.264, etc. It is important to get this right, as it will affect interpretation of the TS data.
If input is from a file, then the program will look at the start of the file to determine if the stream is H.264 or H.262 data. This process may occasionally come to the wrong conclusion, in which case the user can override the choice using the following switches.
If input is from standard input (via -stdin), then it is not possible for the program to make its own decision on the input stream type. Instead, it defaults to H.262, and relies on the user indicating if this is wrong.
-h264, -avc
Force the program to treat the input as MPEG-4/AVC.
-h262
Force the program to treat the input as MPEG-2.
-mp42
Force the program to treat the input as MPEG-4/Part 2.
-vtype <type>
Force the program to treat the input as video of stream type <type> (e.g., 0x42 means AVS video). It is up to the user to specify a valid <type>.
If the audio stream being output is Dolby (AC-3), then the stream type used to output it differs for DVB (European) and ATSC (USA) data. It may be specified as follows:
-dolby dvb
Use stream type 0x06 (the default)
-dolby atsc
Use stream type 0x81
TS tools version 1.11, ps2ts built Nov 11 2008 17:15:47
Convert an H.222 program stream to H.222 transport stream.
This program does not make use of any Program Stream Map packets in the data (mainly because I have yet to see data with any). This means that the program has to determine the stream type of the data based on the first few ES units.
This program does not output more than one video and one audio stream. If the program stream data contains more than one of each, the first will be used, and the others ignored (with a message indicating this).
It is assumed that the video stream will contain DTS values in its PES packets at reasonable intervals, which can be used as PCR values in the transport stream, and thus the video stream's PID can be used as the PCR PID in the transport stream.

Files:

<infile>
is a file containing the program stream data (but see -stdin below)
<outfile>
is an transport stream file (but see -stdout and -host below)

Input switches:

-stdin
Take input from <stdin>, instead of a named file
-dvd
The PS data is from a DVD. This is the default. This switch has no effect on MPEG-1 PS data.
-notdvd, -nodvd
The PS data is not from a DVD. The DVD specification stores AC-3 (Dolby), DTS and other audio in a specialised manner in private_stream_1.
-vstream <n>
Take video from video stream <n> (0..7). The default is the first video stream found.
-astream <n>
Take audio from audio stream <n> (0..31). The default is the first audio stream found (this includes private_stream_1 on non-DVD streams).
-ac3stream <n>
Take audio from AC3 substream <n> (0..7), from private_stream_1. This implies -dvd. (If audio is being taken from a substream, the user is assumed to have determined which one is wanted, e.g., using psreport)

Output switches:

-stdout
Write output to <stdout>, instead of a named file Forces -quiet.
-host <host>, -host <host>:<port>
Writes output (over TCP/IP) to the named <host>, instead of to a named file. If <port> is not specified, it defaults to 88.
-vpid <pid>
<pid> is the video PID to use for the data. Use '-vpid 0x<pid>' to specify a hex value. Defaults to 0x68.
-apid <pid>
<pid> is the audio PID to use for the data. Use '-apid 0x<pid>' to specify a hex value. Defaults to 0x67.
-noaudio
Don't output the audio data
-pmt <pid>
<pid> is the PMT PID to use. Use '-pmt 0x<pid>' to specify a hex value. Defaults to 0x66
-prepeat <n>
Output the program data (PAT/PMT) after every <n> PS packs. Defaults to 100.
-pad <n>
Pad the start with <n> filler TS packets, to allow a TS reader to synchronize with the datastream. Defaults to 8.

General switches:

-verbose, -v
Print a 'v' for each video packet and an 'a' for each audio packet, as it is read
-quiet, -q
Only output error messages
-max <n>, -m <n>
Maximum number of PS packs to read

Stream type:

When the TS data is being output, it is flagged to indicate whether it conforms to H.262, H.264, etc. It is important to get this right, as it will affect interpretation of the TS data.
If input is from a file, then the program will look at the start of the file to determine if the stream is H.264 or H.262 data. This process may occasionally come to the wrong conclusion, in which case the user can override the choice using the following switches.
If input is from standard input (via -stdin), then it is not possible for the program to make its own decision on the input stream type. Instead, it defaults to H.262, and relies on the user indicating if this is wrong.
-h264, -avc
Force the program to treat the input as MPEG-4/AVC.
-h262
Force the program to treat the input as MPEG-2.
-mp42
Force the program to treat the input as MPEG-4/Part 2.
-vtype <type>
Force the program to treat the input as video of stream type <type> (e.g., 0x42 means AVS video). It is up to the user to specify a valid <type>.
If the audio stream being output is Dolby (AC-3), then the stream type used to output it differs for DVB (European) and ATSC (USA) data. It may be specified as follows:
-dolby dvb
Use stream type 0x06 (the default)
-dolby atsc
Use stream type 0x81