Skip to content
jeanlf edited this page Jan 14, 2020 · 15 revisions

HOME » Filters » ISOBMFF/QT muxer


Register name used to load filter: mp4mx

Muxes file according to ISOBMFF (14496-12 and derived specifications) or QuickTime

Tracks and Items

By default all input PIDs with ItemID property set are muxed as items, otherwise they are muxed as tracks.
To prevent source items to be muxed as items, use -itemid option from ISOBMF demuxer.

-i source.mp4:itemid=false -o file.mp4

To force non-item streams to be muxed as items, use #ItemID option on that PID:

-i source.jpg:#ItemID=1 -o file.mp4


The store mode allows controling if the file is fragmented ot not, and when not fragmented, how interleaving is done. For cases where disk requirements are tight and fragmentation cannot be used, it is recommended to use either flat or fstart modes.

The cache mode allows controling how DASH onDemand segments are generated:

  • When disabled, SIDX size will be estimated based on duration and DASH segment length, and padding will be used in the file before the final SIDX.
  • When enabled, file data is stored to a temporary file on disk and flushed upon completion, no padding is present.

Custom boxes

Custom boxes can be specified as box patches:
For movie-level patch, the boxpatch option of the filter should be used.
Per PID box patch can be specified through the PID property boxpatch.

src=source:#boxpatch=myfile.xml dst=mux.mp4

Per Item box patch can be specified through the PID property boxpatch.

src=source:1ItemID=1:#boxpatch=myfile.xml dst=mux.mp4

The box patch is applied before writing the initial moov box in fragmented mode, or when writing the complete file otherwise.
The box patch can either be a filename or the full XML string.


m4sys (boolean, default: false): force MPEG-4 Systems signaling of tracks
dref (boolean, default: false): only references data from source file - not compatible with all media sources
ctmode (enum, default: edit): set composition offset mode for video tracks.

  • edit: uses edit lists to shift first frame to presentation time 0
  • noedit: ignore edit lists and does not shift timeline
  • negctts: uses ctts v1 with possibly negative offsets and no edit lists

idur (fraction, default: 0): only import the specified duration
pack3gp (unsigned int, default: 1): pack a given number of 3GPP audio frames in one sample
importer (boolean, default: false): compatibility with old importer, displays import progress
pack_nal (boolean, default: false): repack NALU size length to minimum possible size for AVC/HEVC/...
xps_inband (enum, default: no): use inband (in sample data) param set for AVC/HEVC/...

  • no: paramater sets are not inband, several sample descriptions might be created
  • all: paramater sets are inband, no param sets in sample description
  • both: paramater sets are inband, signaled as inband, and also first set is kept in sample descripton
  • mix: creates non-standard files using single sample entry with first PSs found, and moves other PS inband

store (enum, default: inter): file storage mode

  • inter: perform precise interleave of the file using cdur (requires temporary storage of all media)
  • flat: write samples as they arrive and moov at end (fastest mode)
  • fstart: write samples as they arrive and moov before mdat
  • tight: uses per-sample interleaving of all tracks (requires temporary storage of all media)
  • frag: fragments the file using cdur duration
  • sfrag: framents the file using cdur duration but adjusting to start with SAP1/3

cdur (number, default: -1.0): chunk duration for interleaving and fragmentation modes

  • 0: no specific interleaving but moov first
  • negative: defaults to 1.0 unless overriden by storage profile
    moovts (int, default: 600): timescale to use for movie. A negative value picks the media timescale of the first track added
    moof_first (boolean, default: true): generate fragments starting with moof then mdat
    abs_offset (boolean, default: false): use absolute file offset in fragments rather than offsets from moof
    fsap (boolean, default: true): split truns in video fragments at SAPs to reduce file size
    subs_sidx (int, default: -1): number of subsegments per sidx. negative value disables sidx, -2 removes sidx if present in source pid
    m4cc (string): 4 character code of empty box to appen at the end of a segment
    chain_sidx (boolean, default: false): use daisy-chaining of SIDX
    msn (unsigned int, default: 1): sequence number of first moof to N
    msninc (unsigned int, default: 1): sequence number increase between moofs
    tfdt (64-bit fraction, default: 0): set TFDT of first traf
    tfdt_traf (boolean, default: false): set TFDT in each traf
    nofragdef (boolean, default: false): disable default flags in fragments
    straf (boolean, default: false): use a single traf per moov (smooth streaming and co)
    strun (boolean, default: false): use a single trun per traf (smooth streaming and co)
    psshs (enum, default: moov): set PSSH boxes store mode
  • moof: in first moof of each segments
  • moov: in movie box
  • none: pssh is discarded

sgpd_traf (boolean, default: false): store sample group descriptions in traf (duplicated for each traf). If not used, sample group descriptions are stored in the movie box
cache (boolean, default: false): enable temp storage for VoD dash modes - see filter help
noinit (boolean, default: false): do not produce initial moov, used for DASH bitstream switching mode
tktpl (enum, default: yes): use track box from input if any as a template to create new track

  • no: disables template
  • yes: clones the track (except edits and decoder config)
  • udta: only loads udta

mudta (enum, default: yes): use udta and other moov extension boxes from input if any

  • no: disables import
  • yes: clones all extension boxes
  • udta: only loads udta

tmpd (string): set temp directory for intermediate file(s)
mvex (boolean, default: false): set mvex after tracks
sdtp_traf (enum, default: no): use sdtp in traf rather than using flags in trun sample entries

  • no: do not use sdtp
  • sdtp: use sdtp box to indicate sample dependencies and don't write info in trun sample flags
  • both: use sdtp box to indicate sample dependencies and also write info in trun sample flags

tkid (unsigned int, default: 0): track ID of created track for single track. Default 0 uses next available trackID
fdur (boolean, default: false): fragment based on fragment duration rather than CTS. Mostly used for MP4Box -frag option
btrt (boolean, default: true): set btrt box in sample description
styp (string): set segment styp major brand to the given 4CC[.version]
mediats (int, default: 0): set media timescale. A value of 0 means inherit from pid, a value of -1 means derive from samplerate or frame rate
ase (enum, default: v0): set audio sample entry mode for more than stereo layouts

  • v0: use v0 signaling but channel count from stream, recommended for backward compatibility
  • v0s: use v0 signaling and force channel count to 2 (stereo) if more than 2 channels
  • v1: use v1 signaling, ISOBMFF style
  • v1qt: use v1 signaling, QTFF style

ssix (boolean, default: false): create ssix when sidx is present, level 1 mappping I-frames byte ranges, level 0xFF mapping the rest
ccst (boolean, default: false): insert coding constraint box for video tracks
maxchunk (unsigned int, default: 0): set max chunk size in bytes for runs (only used in non-fragmented mode). 0 means no constraints
noroll (boolean, default: false): disable roll sample grouping
saio32 (boolean, default: false): set single segment mode for dash
ctrn (boolean, default: false): use compact track run (experimental)
ctrni (boolean, default: false): use inheritance in compact track run for HEVC tile tracks (highly experimental)
compress (enum, default: no): set top-level box compression mode

  • no: disable box compression
  • moov: compress only moov box
  • moof: compress only moof boxes
  • sidx: compress moof and sidx boxes
  • ssix: compress moof, sidx and ssix boxes
  • all: compress moov, moof, sidx and ssix boxes

fcomp (boolean, default: false): force using compress box even when compressed size is larger than uncompressed
trun_inter (enum, default: no): interleave samples in trun based on the temporal level, the lowest level are stored first

  • no: disable sample interleaving
  • runs: create multiple track runs to reorder sample (vanilla ISOBMFF)
  • merge: create a single track run with a sample reorder map - EXPERIMENTAL

block_size (unsigned int, default: 10000): target output block size, 0 for default internal value (10k)
boxpatch (string): apply box patch before writing
deps (boolean, default: true): add samples dependencies information

HOME » Filters

GPAC Configuration

Configuration File
Global Options

Filters Overview

General Filters Concepts
gpac General Usage
Built-in Properties

Filters Help

Inspect packets (inspect)
Probe source (probe)
Compositor (compositor)
ISOBMFF/QT demuxer (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)
XVid decoder (xviddec)
OpenJPEG2000 decoder (j2kdec)
AC3 reframer (rfac3)
A52 decoder (a52dec)
AMR/EVRC reframer (rfamr)
OGG demuxer (oggdmx)
Vorbis decoder (vorbisdec)
Theora decoder (theoradec)
MPEG-2 TS demuxer (m2tsdmx)
UDP/TCP input (sockin)
OpenSVC decoder (osvcdec)
VideoToolBox decoder (vtbdec)
MPEG-4 LASeR decoder (lsrdec)
SAF demuxer (safdmx)
MPEG-DASH and HLS client (dashin)
CENC decryptor (cdcrypt)
CENC encryptor (cecrypt)
ISOBMFF/QT muxer (mp4mx)
QCP reframer (rfqcp)
H263 reframer (rfh263)
M1V/M2V/M4V reframer (rfmpgvid)
NHNT reader (nhntr)
NHML parser (nhmlr)
AVC/HEVC reframer (rfnalu)
MPEG PS demuxer (m2psdmx)
AVI demuxer (avidmx)
Subtitle loader (txtin)
TTXT/TX3G decoder (ttxtdec)
WebVTT decoder (vttdec)
RTP/RTSP/SDP input (rtpin)
File output (fout)
Raw AAC to LATM writer (uflatm)
ADTS writer (ufadts)
Media Reframer (reframer)
Stream to file (writegen)
AVC/HEVC to AnnexB writer (ufnalu)
QCP writer (writeqcp)
WebVTT writer (writevtt)
NHNT writer (nhntw)
NHML writer (nhmlw)
VobSub demuxer (vobsubdmx)
AVI muxer (avimx)
Audio output (aout)
M4V writer (ufm4v)
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 muxer (m2tsmx)
DASH and HLS segmenter (dasher)
HEVC tile aggregator (tileagg)
pipe input (pin)
pipe output (pout)
GSF Muxer (gsfmx)
GSF Demuxer (gsfdmx)
UDP/TCP output (sockout)
AV1/IVF/VP9 reframer (rfav1)
IVF/OBU/annexB writer (ufobu)
ATSC input (atscin)
RTP Streamer (rtpout)
RTSP Server (rtspout)
HTTP Server (httpout)
HEVC tile spliter (hevcsplit)
HEVC Tile merger (hevcmerge)
FLAC reframer (rfflac)
ProRes reframer (rfprores)
MPEG Transport Stream splitter (tssplit)
FFMPEG demuxer (ffdmx)
FFMPEG decoder (ffdec)
FFMPEG AV Capture (ffavin)
FFMPEG video rescaler (ffsws)
FFMPEG encoder (ffenc)
FFMPEG muxer (ffmx)
FFMPEG AVFilter (ffavf)
JavaScript filter (jsf)
OpenHEVC decoder (ohevcdec)

Clone this wiki locally
You can’t perform that action at this time.