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

# stream\_type(1)

Guess the type of a stream file

## NAME

**stream-type** – Guess the type of a stream file

## SYNOPSIS

**stream-type** \[**-err stdout**\] \[**-err stderr**\] \[**-verbose** \| **-v**\] \[**-quiet** \| **-q**\] *in\_file*

## DESCRIPTION

Attempt to determine if an input stream is Transport Stream, Program Stream, or Elementary Stream, and if the latter, if it is H.262 or H.264 (i.e., MPEG-2 or MPEG-4/AVC respectively). The mechanisms used are fairly crude, assuming that:

- data is byte aligned

- for TS, the first byte in the file will be the start of a NAL unit, and PAT/PMT packets will be findable

- for PS, the first packet starts immediately at the start of the file, and is a pack header

- if the first 1000 packets could be H.262 \*or\* H.264, then the data is assumed to be H.264 (the program doesn't try to determine sensible sequences of H.262/H.264 packets, so this is a reasonable way of guessing)

It is quite possible that data which is not relevant will be misidentified

### Files

- *in\_file*

  is the file to analyse

### Switches

- **-err stdout**

  Write error messages to standard output (the default)

- **-err stderr**

  Write error messages to standard error (Unix traditional)

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

  Output more detailed information about how it is making its decision

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

  Only output error messages

## RETURN VALUES

The program exit value is:

- 10

  if it detects Transport Stream,

- 11

  if it detects Program Stream,

- 12

  if it detects Elementary Stream containing H.262 (MPEG-2),

- 14

  if it detects Elementary Stream containing H.264 (MPEG-4/AVC),

- 5

  if it looks like it might be PES,

- 9

  if it really cannot decide, or

- 0

  if some error occurred

## SEE ALSO

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