Skip to content
jeanlf edited this page Apr 27, 2023 · 29 revisions

HOME » Filters

Filters Overview

General Filters Concepts
gpac General Usage
Built-in Properties

GPAC Configuration

Configuration File
Global Options

Filters Help

Inspect packets (inspect)
Probe source (probe)
Compositor (compositor)
ISOBMFF/QT demultiplexer (mp4dmx)
MPEG-4 BIFS decoder (bifsdec)
MPEG-4 OD decoder (odfdec)
File input (fin)
BT/XMT/X3D loader (btplay)
HTTP input (httpin)
SVG loader (svgplay)
JPG/J2K/PNG/BMP reframer (rfimg)
PNG/JPG decoder (imgdec)
ADTS reframer (rfadts)
LATM reframer (rflatm)
MP3 reframer (rfmp3)
FAAD decoder (faad)
MAD decoder (maddec)
OpenJPEG2000 decoder (j2kdec)
AC3 reframer (rfac3)
A52 decoder (a52dec)
AMR/EVRC reframer (rfamr)
OGG demultiplexer (oggdmx)
Vorbis decoder (vorbisdec)
Theora decoder (theoradec)
MPEG-2 TS demultiplexer (m2tsdmx)
UDP/TCP input (sockin)
DVB for Linux (dvbin)
OpenSVC decoder (osvcdec)
VideoToolBox decoder (vtbdec)
MediaCodec decoder (mcdec)
MPEG-4 LASeR decoder (lsrdec)
SAF demultiplexer (safdmx)
MPEG-DASH and HLS client (dashin)
CENC decryptor (cdcrypt)
CENC encryptor (cecrypt)
ISOBMFF/QT multiplexer (mp4mx)
QCP reframer (rfqcp)
H263 reframer (rfh263)
M1V/M2V/M4V reframer (rfmpgvid)
NHNT reader (nhntr)
NHML reader (nhmlr)
AVC/HEVC reframer (rfnalu)
MPEG PS demultiplexer (m2psdmx)
AVI demultiplexer (avidmx)
Subtitle loader (txtin)
TTXT/TX3G decoder (ttxtdec)
WebVTT decoder (vttdec)
TTML decoder (ttmldec)
RTP/RTSP/SDP input (rtpin)
File output (fout)
Raw AAC to LATM writer (uflatm)
ADTS writer (ufadts)
MHAS writer (ufmhas)
Media Reframer (reframer)
Stream to file (writegen)
AVC/HEVC to AnnexB writer (ufnalu)
QCP writer (writeqcp)
WebVTT unframer (ufvtt)
NHNT writer (nhntw)
NHML writer (nhmlw)
VobSub parser (vobsubdmx)
AVI multiplexer (avimx)
Audio output (aout)
M4V writer (ufm4v)
VC1 writer (ufvc1)
Audio resampler (resample)
Video output (vout)
Video crop (vcrop)
Video flip (vflip)
RAW video reframer (rfrawvid)
PCM reframer (rfpcm)
JPG encoder (jpgenc)
PNG encoder (pngenc)
Audio/Video rewinder (rewind)
Sources concatenator (flist)
MPEG-2 TS multiplexer (m2tsmx)
DASH and HLS segmenter (dasher)
HEVC tile aggregator (tileagg)
HEVC tile bitstream splitter (tilesplit)
pipe input (pin)
pipe output (pout)
GSF Multiplexer (gsfmx)
GSF demultiplexer (gsfdmx)
UDP/TCP output (sockout)
AV1/IVF/VP9 reframer (rfav1)
IVF/OBU/annexB writer (ufobu)
NVidia decoder (nvdec)
ROUTE input (routein)
RTP Streamer (rtpout)
RTSP Server (rtspout)
HTTP Server (httpout)
HEVC tile splitter (hevcsplit)
HEVC Tile merger (hevcmerge)
FLAC reframer (rfflac)
MPEH-H Audio Stream reframer (rfmhas)
ProRes reframer (rfprores)
MPEG Transport Stream splitter (tssplit)
Compressed bitstream rewriter (bsrw)
Compressed layered bitstream splitter (bssplit)
Compressed layered bitstream aggregator (bsagg)
TX3G unframer (ufttxt)
TX3G to SRT (tx3g2srt)
TX3G to WebVTT (tx3g2vtt)
TX3G to TTML (tx3g2ttml)
WebVTT to TX3G (vtt2tx3g)
SRT reframer (rfsrt)
TTML to WebVTT (ttml2vtt)
TTML to SRT (ttml2srt)
MPEG-H Audio decoder (mpeghdec)
FFMPEG demultiplexer (ffdmx)
FFMPEG decoder (ffdec)
FFMPEG AV Capture (ffavin)
FFMPEG video rescaler (ffsws)
FFMPEG encoder (ffenc)
FFMPEG multiplexer (ffmx)
FFMPEG AVFilter (ffavf)
FFMPEG BitStream filter (ffbsf)
FFMPEG BitStream filter (ffbsf)
JavaScript filter (jsf)
ROUTE output (routeout)
TrueHD reframer (rftruehd)
CryptFile input (cryptin)
CryptFile output (cryptout)
Packet timestamp rewriter (restamp)
OGG multiplexer (oggmx)
Stream unframer (unframer)
Stream to unframed format (writeuf)
UNCV decoder (uncvdec)
GHI demultiplexer (ghidmx)
EVG video rescaler (evgs)
Closed-Caption decoder (ccdec)
DekTec SDIOut (dtout)
OpenHEVC decoder (ohevcdec)
Uncompressed Video File Format Generator Utility (uncvg)
GPU texture uploader (glpush)
Thumbnail collection generator (thumbs)
Audio Video Mixer (avmix)
AV Counter Generator (avgen)

Clone this wiki locally

MPEG-2 TS multiplexer

Register name used to load filter: m2tsmx
This filter may be automatically loaded during graph resolution.

This filter multiplexes one or more input PIDs into a MPEG-2 Transport Stream multiplex.

PID selection

The MPEG-2 TS multiplexer assigns M2TS PID for media streams using the PID of the PMT plus the stream index.
For example, the default config creates the first program with a PMT PID 100, the first stream will have a PID of 101.
Streams are grouped in programs based on input PID property ServiceID if present. If absent, stream will go in the program with service ID as indicated by sid option.

  • name option is overridden by input PID property ServiceName.
  • provider option is overridden by input PID property ServiceProvider.
  • pcr_offset option is overridden by input PID property "tsmux:pcr_offset"
  • first_pts option is overridden by input PID property "tsmux:force_pts"
  • temi option is overridden by input PID property "tsmux:temi"

Time and External Media Information (TEMI)

The temi option allows specifying a list of URLs or timeline IDs to insert in streams of a program.
One or more TEMI timeline can be specified per PID.
The syntax is a comma-separated list of one or more TEMI description.
Each TEMI description is formatted as ID_OR_URL or #OPT1[#OPT2]#ID_OR_URL. Options are:

  • SN: indicate the target service with ID N
  • TN: set timescale to use (default: PID timescale)
  • DN: set delay in ms between two TEMI url descriptors (default 1000)
  • ON: set offset (max 64 bits) to add to TEMI timecodes (default 0). If timescale is not specified, offset value is in ms, otherwise in timescale units.
  • IN: set initial value (max 64 bits) of TEMI timecodes. If not set, initial value will match first packet CTS. If timescale is not specified, value is in PID timescale units, otherwise in specified timescale units.
  • PN: indicate target PID in program. Possible values are
    • V: only insert for video streams.
    • A: only insert for audio streams.
    • T: only insert for text streams.
    • N: only insert for stream with index N (0-based) in the program.
  • LC: set 64bit timecode signaling. Possible values for C are:
    • A: automatic switch between 32 and 64 bit depending on timecode value (default if not specified).
    • Y: use 64 bit signaling only.
    • N: use 32 bit signaling only and wrap around timecode value.
  • N: insert NTP timestamp in TEMI timeline descriptor
  • ID_OR_URL: If number, indicate the TEMI ID to use for external timeline. Otherwise, give the URL to insert



Inserts a TEMI URL+timecode in the each stream of each program.


Inserts a TEMI URL+timecode in the first stream of all programs and an external TEMI with ID 4 in the second stream of all programs.


Inserts a TEMI with ID 2 and a TEMI URL+timecode in the first stream of all programs, and an external TEMI with ID 4 in the second stream of all programs.


Inserts an external TEMI with ID 4 in the each stream of program with ServiceID 20 and a TEMI URL in each stream of program with ServiceID 10.


Inserts an external TEMI with ID 4 and timescale 30000, NTP injection and carousel of 500 ms in the video stream of all programs.

Warning: multipliers (k,m,g) are not supported in TEMI options.

Adaptive Streaming

In DASH and HLS mode:

  • the PCR is always initialized at 0, and flush_rap is automatically set.
  • unless nb_pack is specified, 200 TS packets will be used as pack output in DASH mode.
  • pes_pack=none is forced since some demultiplexers have issues with non-aligned ADTS PES.

The filter watches the property FileNumber on incoming packets to create new files, or new segments in DASH mode.
The filter will look for property M2TSRA set on the input stream.
The value can either be a 4CC or a string, indicating the MP2G-2 TS Registration tag for unknown media types.


In LATM mux mode, the decoder configuration is inserted at the given repeat_rate or CarouselRate PID property if defined.


breq (uint, default: 100): buffer requirements in ms for input PIDs
pmt_id (uint, default: 100): define the ID of the first PMT to use in the mux
rate (uint, default: 0): target rate in bps of the multiplex. If not set, variable rate is used
pmt_rate (uint, default: 200): interval between PMT in ms
pat_rate (uint, default: 200): interval between PAT in ms
first_pts (luint, default: 0): force PTS value of first packet, in 90kHz
pcr_offset (luint, default: -1): offset all timestamps from PCR by V, in 90kHz (default value is computed based on input media)
mpeg4 (enum, default: none): force usage of MPEG-4 signaling (IOD and SL Config)

  • none: disables 4on2
  • full: sends AUs as SL packets over section for OD, section/pes for scene (cf bifs_pes)
  • scene: sends only scene streams as 4on2 but uses regular PES without SL for audio and video

pmt_version (uint, default: 200): set version number of the PMT
disc (bool, default: false): set the discontinuity marker for the first packet of each stream
repeat_rate (uint, default: 0): interval in ms between two carousel send for MPEG-4 systems (overridden by CarouselRate PID property if defined)
repeat_img (uint, default: 0): interval in ms between re-sending (as PES) of single-image streams (if 0, image data is sent once only)
max_pcr (uint, default: 100): set max interval in ms between 2 PCR
nb_pack (uint, default: 4): pack N TS packets in output packets
pes_pack (enum, default: audio): set AU to PES packing mode

  • audio: will pack only multiple audio AUs in a PES
  • none: make exactly one AU per PES
  • all: will pack multiple AUs per PES for all streams

realtime (bool, default: false): use real-time output
bifs_pes (enum, default: off): select BIFS streams packetization (PES vs sections)

  • on: uses BIFS PES
  • off: uses BIFS sections
  • copy: uses BIFS PES but removes timestamps in BIFS SL and only carries PES timestamps

flush_rap (bool, default: false): force flushing mux program when RAP is found on video, and injects PAT and PMT before the next video PES begin
pcr_only (bool, default: false): enable PCR-only TS packets
pcr_init (lsint, default: -1): set initial PCR value for the programs. A negative value means random value is picked
sid (uint, default: 0): set service ID for the program
name (str): set service name for the program
provider (str): set service provider name for the program
sdt_rate (uint, default: 0): interval in ms between two DVB SDT tables (if 0, SDT is disabled)
temi (str): insert TEMI time codes in adaptation field
log_freq (uint, default: 500): delay between logs for realtime mux
latm (bool, default: false): use LATM AAC encapsulation instead of regular ADTS
subs_sidx (sint, default: -1): number of subsegments per sidx (negative value disables sidx)
keepts (bool, default: false): keep cts/dts untouched and adjust PCR accordingly, used to keep TS unmodified when dashing