Skip to content

mp4box dash opts

jeanlf edited this page May 18, 2022 · 50 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. If not set, a default value is computed and all selected tracks from the source will be in the same output multiplex.
  • :dur=VALUE: process VALUE seconds (fraction) 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. Periods 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
  • :pdur=VALUE: sets the duration of the associated period to VALUE seconds (fraction) (alias for period_duration:VALUE). This is only used when no input media is specified (remote period insertion), e.g. :period=X:xlink=Z:pdur=Y
  • :ddur=VALUE: override target DASH segment duration to VALUE seconds (fraction) for this input (alias for duration:VALUE)
  • :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 VALUE (unsigned int)
  • :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][@@fK: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 if separated by a single @
    • a new filter chain will be created if separated by a double @@. In this case, no representation ID is assigned to the source.
      Example
source.mp4:@c=avc:b=1M@@c=avc:b=500k

This will load a filter chain with two encoders connected to the source and to the dasher.
Example

source.mp4:@c=avc:b=1M@c=avc:b=500k

This will load a filter chain with the second encoder connected to the output of the first (!!).

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

Options

-dash (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=F will 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
-profile,-dash-profile (string): 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 (old syntax using :live instead of .live as separator still possible). Defined values are onDemand, live, main, simple, full, hbbtv1.5.live, dashavc264.live, dashavc264.onDemand, dashif.ll
-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
  • $Index=NAME$ is replaced by NAME for index segments, ignored otherwise
  • $Path=PATH$ is replaced by PATH when creating segments, ignored otherwise
  • $Segment=NAME$ is replaced by NAME for media segments, ignored for init segments

-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 (string): add a box of given type (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: same as -dynamic but close the period (insert lmsg brand if needed and update duration)
-mpd-duration (number): 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 (int): specify MPD time shift buffer depth in seconds, -1 to keep all files)
-subdur (number): 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): specify MPD AvailabilityStartTime offset in ms if positive, or availabilityTimeOffset of each representation if negative
-dash-scale (int): specify that timing for -dash, -dash-live, -subdur and -do_frag are expressed in given timescale (units per seconds) rather than ms
-mem-frags: fragmentation happens in memory rather than on disk before flushing to disk
-pssh (int): 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
  • n: remove PSSH from MPD, initial movie and movie fragments

-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 (int): use sdtp box in traf (Smooth-like)

  • no: do not use sdtp
  • sdtp: use sdtp box to indicate sample dependencies and do not 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: segmentation will always try to split before or at, but never after, the segment boundary
-closest: segmentation will use the closest frame to the segment boundary (before or after)
-subsegs-per-sidx,-frags-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
-url-template-sim: use SegmentTemplate simulation while converting HLS to MPD
-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
  • pps: use out of band VPS,SPS,DCI, inband for PPS,APS and a single init segment
  • 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): 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, e.g. 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
-merge-last-seg: merge last segment if shorter than half the target duration

Clone this wiki locally