Skip to content

mp4box dash opts

jeanlf edited this page Jan 21, 2020 · 16 revisions

HOME » MP4Box » Media DASH

DASH Options

Also see:

Specifying input files

Input media files to dash can use the following modifiers

  • #trackID=N: only use the track ID N from the source file
  • #N: only use the track ID N from the source file (mapped to -tkid)
  • #video: only use the first video track from the source file
  • #audio: only use the first audio track from the source file
  • :id=NAME: set the representation ID to NAME. Reserved value NULL disables representation ID for multiplexed inputs
  • :dur=VALUE: process VALUE seconds from the media. If VALUE is longer than media duration, last sample duration is extended.
  • :period=NAME: set the representation's period to NAME. Multiple periods may be used period appear in the MPD in the same order as specified with this option
  • :BaseURL=NAME: set the BaseURL. Set multiple times for multiple BaseURLs

Warning: This does not modify generated files location (see segment template).

  • :bandwidth=VALUE: set the representation's bandwidth to a given value
  • :period_duration=VALUE: increase the duration of this period by the given duration in seconds. This is only used when no input media is specified (remote period insertion), eg :period=X:xlink=Z:duration=Y
  • :duration=VALUE: override target DASH segment duration for this input
  • :xlink=VALUE: set the xlink value for the period containing this element. Only the xlink declared on the first rep of a period will be used
  • :asID=VALUE: set the AdaptationSet ID to NAME
  • :role=VALUE: set the role of this representation (cf DASH spec). Media with different roles belong to different adaptation sets.
  • :desc_p=VALUE: add a descriptor at the Period level. Value must be a properly formatted XML element.
  • :desc_as=VALUE: add a descriptor at the AdaptationSet level. Value must be a properly formatted XML element. Two input files with different values will be in different AdaptationSet elements.
  • :desc_as_c=VALUE: add a descriptor at the AdaptationSet level. Value must be a properly formatted XML element. Value is ignored while creating AdaptationSet elements.
  • :desc_rep=VALUE: add a descriptor at the Representation level. Value must be a properly formatted XML element. Value is ignored while creating AdaptationSet elements.
  • :sscale: force movie timescale to match media timescale of the first track in the segment.
  • :trackID=N: only use the track ID N from the source file
  • @@f1[:args][@@fN:args]: set a filter chain to insert between the source and the dasher. Each filter in the chain is formatted as a regular filter, see filter doc gpac -h doc. If several filters are set, they will be chained in the given order.

Note: @@f must be placed after all other options.


-mpd (string): convert given HLS or smooth manifest (local or remote http) to MPD.

Warning: This is not compatible with other DASH options and does not convert associated segments

-dash,--dash-strict (number): create DASH from input files with given segment (subsegment for onDemand profile) duration in ms
-dash-live (number): generate a live DASH session using the given segment duration in ms; using -dash-live=Fwill also write the live context to F. MP4Box will run the live session until q is pressed or a fatal error occurs
-ddbg-live (number): same as -dash-live without time regulation for debug purposes
-frag (number): specify the fragment duration in ms. If not set, this is the DASH duration (one fragment per segment)
-out (string): specify the output MPD file name
-tmp (string): specify directory for temporary file creation
-profile (string, values: onDemand|live|main|simple|full|hbbtv1.5:live|dashavc264:live|dashavc264:onDemand): specify the target DASH profile, and set default options to ensure conformance to the desired profile. Default profile is full in static mode, live in dynamic mode
-profile-ext (string): specify a list of profile extensions, as used by DASH-IF and DVB. The string will be colon-concatenated with the profile used
-rap: ensure that segments begin with random access points, segment durations might vary depending on the source encoding
-frag-rap: ensure that all fragments begin with random access points (duration might vary depending on the source encoding)
-segment-name (string): set the segment name for generated segments. If not set (default), segments are concatenated in output file except in live profile where dash_%%s. Supported replacement strings are:

  • $Number[%%0Nd]$ is replaced by the segment number, possibly prefixed with 0.
  • $RepresentationID$ is replaced by representation name.
  • $Time$ is replaced by segment start time.
  • $Bandwidth$ is replaced by representation bandwidth.
  • $Init=NAME$ is replaced by NAME for init segment, ignored otherwise. May occur multiple times.
  • $Index=NAME$ is replaced by NAME for index segments, ignored otherwise. May occur multiple times.
  • $Path=PATH$ is replaced by PATH when creating segments, ignored otherwise. May occur multiple times.
  • $Segment=NAME$ is replaced by NAME for media segments, ignored for init segments. May occur multiple times

-segment-ext (string, default: m4s): set the segment extension, null means no extension
-init-segment-ext (string, default: mp4): set the segment extension for init, index and bitstream switching segments, null means no extension

-segment-timeline: use SegmentTimeline when generating segments
-segment-marker MARK (string): add a box of type MARK (4CC) at the end of each DASH segment
-insert-utc: insert UTC clock at the beginning of each ISOBMF segment
-base-url (string): set Base url at MPD level. Can be used several times.

Warning: this does not modify generated files location

-mpd-title (string): set MPD title
-mpd-source (string): set MPD source
-mpd-info-url (string): set MPD info url
-cprt (string): add copyright string to MPD
-dash-ctx (string): store/restore DASH timing from indicated file
-dynamic: use dynamic MPD type instead of static
-last-dynamic (string): same as -dynamic but close the period (insert lmsg brand if needed and update duration)
-mpd-duration (number, default: 0): set the duration in second of a live session (if 0, you must use -mpd-refresh)
-mpd-refresh (number): specify MPD update time in seconds
-time-shift (number): specify MPD time shift buffer depth in seconds, -1 to keep all files)
-subdur (int): specify maximum duration in ms of the input file to be dashed in LIVE or context mode. This does not change the segment duration, but stops dashing once segments produced exceeded the duration. If there is not enough samples to finish a segment, data is looped unless -no-loop is used which triggers a period end
-run-for (int): run for given ms the dash-live session then exits
-min-buffer (int): specify MPD min buffer time in ms
-ast-offset (int, default: 0): specify MPD AvailabilityStartTime offset in ms if positive, or availabilityTimeOffset of each representation if negative
-dash-scale (int): specify that timing for -dash and -frag are expressed in given timexale (units per seconds)
-mem-frags: fragmentation happens in memory rather than on disk before flushing to disk
-pssh (Enum): set pssh store mode.

  • v: initial movie
  • f: movie fragments
  • m: MPD
  • mv, vm: in initial movie and MPD
  • mf, fm: in movie fragments and MPD

-sample-groups-traf: store sample group descriptions in traf (duplicated for each traf). If not set, sample group descriptions are stored in the initial movie
-mvex-after-traks: store mvex box after trak boxes within the moov box. If not set, mvex is before
-sdtp-traf (Enum): use sdtp box in traf (Smooth-like).

  • 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

-no-cache: disable file cache for dash inputs
-no-loop: disable looping content in live mode and uses period switch instead
-hlsc: insert UTC in variant playlists for live HLS
-bound: enable video segmentation with same method as audio (i.e.: always try to split before or at the segment boundary - not after)

-closest: enable video segmentation closest to the segment boundary (before or after)
-subsegs-per-sidx (int): set the number of subsegments to be written in each SIDX box

  • 0: a single SIDX box is used per segment
  • -1: no SIDX box is used

-ssix: enable SubsegmentIndexBox describing 2 ranges, first one from moof to end of first I-frame, second one unmapped. This does not work with daisy chaining mode enabled
-url-template: use SegmentTemplate instead of explicit sources in segments. Ignored if segments are stored in the output file
-daisy-chain: use daisy-chain SIDX instead of hierarchical. Ignored if frags/sidx is 0
-single-segment: use a single segment for the whole file (OnDemand profile)
-single-file: use a single file for the whole file (default)
-bs-switching (string, default: inband, values: inband|merge|multi|no|single): set bitstream switching mode

  • inband: use inband param set and a single init segment
  • merge: try to merge param sets in a single sample description, fallback to no
  • multi: use several sample description, one per quality
  • no: use one init segment per quality
  • single: to test with single input

-moof-sn (int): set sequence number of first moof to given value
-tfdt (int): set TFDT of first traf to given value in SCALE units (cf -dash-scale)
-no-frags-default: disable default fragments flags in trex (required by some dash-if profiles and CMAF/smooth streaming compatibility)
-single-traf: use a single track fragment per moof (smooth streaming and derived specs may require this)
-tfdt-traf: use a tfdt per track fragment (when -single-traf is used)
-dash-ts-prog (int): program_number to be considered in case of an MPTS input file
-frag-rt: when using fragments in live mode, flush fragments according to their timing
-cp-location (string, values: as|repoth): set ContentProtection element location

  • as: sets ContentProtection in AdaptationSet element
  • rep: sets ContentProtection in Representation element
  • both: sets ContentProtection in both elements

-start-date (string): for live mode, set start date (as xs:date, eg YYYY-MM-DDTHH:MM:SSZ). Default is current UTC

Warning: Do not use with multiple periods, nor when DASH duration is not a multiple of GOP size

-cues (string): ignore dash duration and segment according to cue times in given XML file (tests/media/dash_cues for examples)
-strict-cues: throw error if something is wrong while parsing cues or applying cue-based segmentation

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