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

# esfilter(1)

Output a filtered or truncated version of an elementary stream

## NAME

**esfilter** – Output a filtered or truncated version of an elementary stream

## SYNOPSIS

**esfilter** **-copy** \| **-filter** \| **-strip** \[**-err stdout**\] \[**-err stderr**\] \[**-verbose** \| **-v**\] \[**-quiet** \| **-q**\] \[**-host** *dest\_ip*\[:*port*\]\] \[**-max** *max\_frames* \| **-m** *max\_frames*\] \[**-freq** *keep\_frequency*\] \[**-allref**\] \[**-tsout**\] \[**-pes** \| **-ts**\] \[**-h264** \| **-avc** \| **-h262**\] *in\_file* \| **-stdin** *out\_file* \| **-stdout**

## DESCRIPTION

Output a filtered or truncated version of an elementary stream. The input is either H.264 (MPEG-4/AVC) or H.262 (MPEG-2). The output is either an elementary stream, or an H.222 transport stream

If output is to an H.222 Transport Stream, then fixed values for the PMT PID (0x66) and video PID (0x68) are used.

### Files

- *in\_file*

  is the input elementary stream (but see **-stdin** below).

- *out\_file*

  is the output stream, either an equivalent elementary stream, or an H.222 Transport Stream (but see **-stdout** and **-host** below).

### Actions

- **-copy**

  Copy the input data to the output file (mostly useful as a way of truncating data with **-max**)

- **-filter**

  Filter data from input to output, aiming to keep every*keep\_frequency* th frame (where *keep\_frequency* is specified by**-freq** ).

- **-strip**

  For H.264, output just the IDR and I pictures, for H.262, output just the I pictures, but see **-allref** below.

### Switches

- **-err stdout**

  Write error messages to standard output (the default)

- **-err stderr**

  Write error messages to standard error (Unix traditional)

- **-stdin**

  Input from standard input, instead of a file

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

  Output extra information about packets

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

  Only output error messages

- **-host** *dest\_ip*\[:*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. Implies **-tsout**.

- **-max** *max\_frames*, **-m** *max\_frames*

  Maximum number of frames to read (for **-filter** and **-strip**), or ES units/NAL units (for **-copy**).

- **-freq** *keep\_frequency*

  Specify the frequency of frames to try to keep with -filter. Defaults to 8.

- **-allref**

  With **-strip**, keep all reference pictures (H.264) or all I and P pictures (H.262)

- **-tsout**

  Output data as Transport Stream PES packets (the default is as Elementary Stream)

- **-pes**, **-ts**

  The input file is TS or PS, to be read via the PES-\>ES reading mechanisms. Not allowed with **-stdin**.

### Stream type:

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.

## SEE ALSO

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