---
name: "es2ts"
section: "1"
platform: "linux"
package: "tstools"
version: "1.13~git20151030-6"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/es2ts"
---

# es2ts(1)

Convert an ES video stream to H.222 TS

## NAME

**es2ts** – Convert an ES video stream to H.222 TS

## SYNOPSIS

**es2ts** \[**-err stdout**\] \[**-err stderr**\] \[**-verbose** \| **-v**\] \[**-quiet** \| **-q**\] \[**-pid** *pid\_no*\] \[**-pmt** *pmt\_pid\_no*\] \[**-host** *host*\[:*port*\]\] \[**-max** *max\_units* \| **-m** *max\_units*\] *in\_file* \| **-stdin** *out\_file* \| \[**-stdout**\]

## DESCRIPTION

Convert an elementary video stream to H.222 transport stream. Supports input streams conforming to MPEG-2 (H.262), MPEG-4/AVC (H.264) and AVS. Also supports MPEG-1 input streams, insofar as MPEG-2 is backwards compatible with MPEG-1.

Note that this program works by reading and packaging the elementary stream packages directly - it does not parse them as H.262 or H.264 data.

### Files

- *in\_file*

  is a file containing the Elementary Stream data (but see -stdin below)

- *out\_file*

  is an H.222 Transport Stream file (but see -stdout and -host below)

### Switches

- **-err stdout**

  Write error messages to standard output (the default)

- **-err stderr**

  Write error messages to standard error (Unix traditional)

- **-v**, **-verbose**

  Output summary information about each ES packet as it is read

- **-q**, **-quiet**

  Only output error messages

- **-pid** *pid\_no*

  *pid\_no* is the video PID to use for the data. Use '-pid 0x\<pid\>' to specify a hex value. \[default = 0x68\]

- **-pmt** *pmt\_pid\_no*

  *pmt\_pid\_no* is the PMT PID to use. Use '-pmt 0x\<pid\>' to specify a hex value. \[default = 0x66\]

- **-max** *max\_units*, **-m** *max\_units*

  Maximum number of ES data units to read

- **-stdin**

  Input from standard input, instead of a file

- **-stdout**

  Write output to \<stdout\>, instead of a named file Forces -quiet and -err stderr.

- **-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.

### Stream type

When the TS data is being output, it is flagged to indicate whether it conforms to H.262, H.264 or AVS. 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, H.262 or AVS. 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.

- **-avs**

  Force the program to treat the input as AVS.

## SEE ALSO

[esdots(1)](/esdots/1.md),

## BUGS

For the moment, the video input must be H.264 or AVS, and the audio input ADTS, AC-3 ATSC or MPEG layer 2. Also, the audio is assumed to have a constant number of samples per frame.
