|
|
| |
MP4Box - GPAC command-line media packager
MP4Box [options] [file] [options]
MP4Box is a multimedia packager, with a vast number of functionalities:
conversion, splitting, hinting, dumping, DASH-ing, encryption and others.
MP4Box provides a large set of options, classified by categories (see -h). These
options do not follow any particular ordering.
MP4Box performs in-place rewrite of IsoMedia files (the input file is
overwritten). You can change this behaviour by using the -out option.
MP4Box stores by default the file with 0.5 second interleaving and meta-data
(moov...) at the beginning, making it suitable for HTTP streaming. This may
however takes longer to store the file, use -flat to change this behaviour.
MP4Box usually generates a temporary file when creating a new IsoMedia file. The
location of this temporary file is OS-dependent, and it may happen that the
drive/partition the temporary file is created on has not enough space or no
write access. In such a case, you can specify a temporary file location with
-tmp.
Note: Track operations identify tracks through their ID (usually refered as tkID
in the help), not their order.
Option values:
Unless specified otherwise, an option of type integer expects a trackID value
following it.An option of type boolean expects no following value.
MP4Box can split IsoMedia files by size, duration or extract a given part of the
file to new IsoMedia file(s). This process requires that at most one track in
the input file has non random-access points (typically one video track at
most). This process will also ignore all MPEG-4 Systems tracks and hint
tracks, but will try to split private media tracks.
Note: The input file must have enough random access points in order to be split.
This may not be the case with some video files where only the very first
sample of the video track is a key frame (many 3GP files with H263 video are
recorded that way). In order to split such files you will have to use a real
video editor and re-encode the content.
Note: You can add media to a file and split it in the same pass. In this case,
the destination file (the one which would be obtained without spliting) will
not be stored.
Options:
- -p
-
use indicated profile for the global GPAC config. If not found, config file
is created. If a file path is indicated, this will load profile from that
file. Otherwise, this will create a directory of the specified name and
store new config there. Reserved name 0 means a new profile, not stored to
disk. Works using -p=NAME or -p NAME
- -inter (number, default: 0.5)
-
interleave file, producing track chunks with given duration in ms. A value
of 0 disables interleaving
- -old-inter (number)
-
same as -inter but wihout drift correction
- -tight (number)
-
tight interleaving (sample based) of the file. This reduces disk seek
operations but increases file size
- -flat
-
store file with all media data first, non-interleaved. This speeds up
writing time when creating new files
- -frag (number)
-
fragment file, producing track fragments of given duration in ms. This
disables interleaving
- -out (string)
-
specify output file name. By default input file is overwritten
- -tmp (string)
-
specify directory for temporary file creation
- -co64
-
force usage of 64-bit chunk offsets for ISOBMF files
- -new
-
force creation of a new destination file
- -newfs
-
force creation of a new destination file without temp file but interleaving
support
- -no-sys
-
remove all MPEG-4 Systems info except IOD, kept for profiles. This is the
default when creating regular AV content
- -no-iod
-
remove MPEG-4 InitialObjectDescriptor from file
- -mfra
-
insert movie fragment random offset when fragmenting file (ignored in dash
mode)
- -isma
-
rewrite the file as an ISMA 1.0 file
- -ismax
-
same as -isma and remove all clock references
- -3gp
-
rewrite as 3GPP(2) file (no more MPEG-4 Systems Info), always enabled if
destination file extension is .3gp, .3g2 or .3gpp. Some tracks may be
removed in the process
- -ipod
-
rewrite the file for iPod/old iTunes
- -psp
-
rewrite the file for PSP devices
- -brand (string)
-
set major brand of file (ABCD) or brand with optional version (ABCD:v)
- -ab (string)
-
add given brand to file's alternate brand list
- -rb (string)
-
remove given brand to file's alternate brand list
- -cprt (string)
-
add copyright string to file
- -chap (string)
-
set chapter information from given file
- -chapqt (string)
-
set chapter information from given file, using QT signaling for text tracks
- -set-track-id id1:id2 (string)
-
change id of track with id1 to id2
- -swap-track-id id1:id2 (string)
-
swap the id between tracks with id1 to id2
- -rem (int)
-
remove given track from file
- -rap (int)
-
remove all non-RAP samples from given track
- -refonly (int)
-
remove all non-reference pictures from given track
- -enable (int)
-
enable given track
- -disable (int)
-
disable given track
- -timescale (int, default: 600)
-
set movie timescale to given value (ticks per second)
- -lang [tkID=]LAN (string)
-
set language. LAN is the BCP-47 code (eng, en-UK, ...). If no track ID is
given, sets language to all tracks
- -delay tkID=TIME (string)
-
set track start delay in ms
- -par tkID=PAR (string)
-
set visual track pixel aspect ratio. PAR is:
* N:D: set PAR to N:D in track, do not modify the bitstream
* wN:D: set PAR to N:D in track and try to modify the bitstream
* none: remove PAR info from track, do not modify the bitstream
* auto: retrieve PAR info from bitstream and set it in track
* force: force 1:1 PAR in track, do not modify the bitstream
- -clap tkID=CLAP (string)
-
set visual track clean aperture. CLAP is Wn,Wd,Hn,Hd,HOn,HOd,VOn,VOd or none
* n, d: numerator, denominator
* W, H, HO, VO: clap width, clap height, clap horizontal offset, clap
vertical offset
- -mx tkID=MX (string)
-
set track matrix, with MX is M1:M2:M3:M4:M5:M6:M7:M8:M9 in 16.16 fixed point
intergers or hexa
- -name tkID=NAME (string)
-
set track handler name to NAME (UTF-8 string)
- -itags tag1[:tag2] (string)
-
set iTunes tags to file, see -tag-list
- -tag-list
-
print the set of supported iTunes tags
- -split (string)
-
split in files of given max duration
- -split-size,-splits (string)
-
split in files of given max size (in kb)
- -split-rap,-splitr (string)
-
split in files at each new RAP
- -split-chunk,-splitx VAL (string)
-
extract a new file from source. VAL can be formated as:
* `S:E`: S (number of seconds) to E with E a number (in seconds), end or
end-N, N number of seconds before the end
* `S-E`: start and end dates, each formatted as HH:MM:SS.ms or MM:SS.ms
- -splitz S:E (string)
-
same as -split-chunk, but adjust the end time to be before the last RAP
sample
- -group-add (string)
-
create a new grouping information in the file. Format is a colon-separated
list of following options:
* refTrack=ID: ID of the track used as a group reference. If not set, the
track will belong to the same group as the previous trackID specified. If
0 or no previous track specified, a new alternate group will be created
* switchID=ID: ID of the switch group to create. If 0, a new ID will be
computed for you. If <0, disables SwitchGroup
* criteria=string: list of space-separated 4CCs.
* trackID=ID: ID of the track to add to this group.
Warning: Options modify state as they are parsed,
trackID=1:criteria=lang:trackID=2 is different from
criteria=lang:trackID=1:trackID=2
- -group-rem-track (int)
-
remove given track from its group
- -group-rem (int)
-
remove the track's group
- -group-clean
-
remove all group information from all tracks
- -ref id:XXXX:refID (string)
-
add a reference of type 4CC from track ID to track refID
- -keep-utc
-
keep UTC timing in the file after edit
- -udta tkID:[OPTS] (string)
-
set udta for given track or movie if tkID is 0. OPTS is a colon separated
list of:
* type=CODE: 4CC code of the UDTA (not needed for box= option)
* box=FILE: location of the udta data, formatted as serialized boxes
* box=base64,DATA: base64 encoded udta data, formatted as serialized boxes
* src=FILE: location of the udta data (will be stored in a single box of
type CODE)
* src=base64,DATA: base64 encoded udta data (will be stored in a single box
of type CODE)
Note: If no source is set, UDTA of type CODE will be removed
- -patch [tkID=]FILE (string)
-
apply box patch described in FILE, for given trackID if set
- -bo
-
freeze the order of boxes in input file
- -init-seg (string)
-
use the given file as an init segment for dumping or for encryption
- -zmov
-
compress movie box according to ISOBMFF box compression
MP4Box can be used to extract media tracks from MP4 files. If you need to
convert these tracks however, please check the filters doc.
Options:
- -raw (string)
-
extract given track in raw format when supported. Use tkID:output=FileName
to set output file name
- -raws (string)
-
extract each sample of the given track to a file. Use tkID:Nto extract the
Nth sample
- -nhnt (int)
-
extract given track to NHNT format
- -nhml (string)
-
extract given track to NHML format. Use tkID:full for full NHML dump with
all packet properties
- -webvtt-raw (string)
-
extract given track as raw media in WebVTT as metadata. Use tkID:embedded to
include media data in the WebVTT file
- -single (int)
-
extract given track to a new mp4 file
- -six (int)
-
extract given track as raw media in experimental XML streaming instructions
- -avi (int)
-
extract given track to an avi file
- -avi (int)
-
same as -raw but defaults to QCP file for EVRC/SMV
- -aviraw (string, values: video|audio)
-
extract AVI track in raw format; parameter can be video, audioor audioN
- -saf
-
remux file to SAF multiplex
- -dvbhdemux
-
demux DVB-H file into IP Datagrams sent on the network
- -raw-layer (int)
-
same as -raw but skips SVC/MVC/LHVC extractors when extracting
- -diod
-
extract file IOD in raw format
Also see:
- the dasher `gpac -h dash` filter documentation
- [[online DASH Intro doc|DASH Introduction]].
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. 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: increase the duration of this period by the given duration in
seconds (alias for period_duration:VALUE). This is only used when no input
media is specified (remote period insertion), eg :period=X:xlink=Z:pdur=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|rep?oth)
-
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
MP4Box has many dump functionalities, from simple track listing to more complete
reporting of special tracks.
Options:
- -stdb
-
dump/write to stdout and assume stdout is opened in binary mode
- -stdb
-
dump/write to stdout and try to reopen stdout in binary mode
- -tracks
-
print the number of tracks on stdout
- -info (string)
-
print movie info (no parameter) or track info with specified ID
- -infon (string)
-
print track info for given track number, 1 being the first track in the file
- -diso
-
dump IsoMedia file boxes in XML output
- -dxml
-
dump IsoMedia file boxes and known track samples in XML output
- -disox
-
dump IsoMedia file boxes except sample tables in XML output
- -keep-ods
-
do not translate ISOM ODs and ESDs tags (debug purpose only)
- -bt
-
dump scene to BT format
- -xmt
-
dump scene to XMT format
- -wrl
-
dump scene to VRML format
- -x3d
-
dump scene to X3D XML format
- -x3dc
-
dump scene to X3D VRML format
- -lsr
-
dump scene to LASeR XML (XSR) format
- -drtp
-
dump rtp hint samples structure to XML output
- -dts
-
print sample timing, size and position in file to text output
- -dtsx
-
same as -dts but does not print offset
- -dtsc
-
same as -dts but analyse each sample for duplicated dts/cts (slow !)
- -dtsxc
-
same as -dtsc but does not print offset (slow !)
- -dnal (int)
-
print NAL sample info of given track
- -dnalc (int)
-
print NAL sample info of given track, adding CRC for each nal
- -dnald (int)
-
print NAL sample info of given track without DTS and CTS info
- -dnalx (int)
-
print NAL sample info of given track without DTS and CTS info and adding CRC
for each nal
- -sdp
-
dump SDP description of hinted file
- -dsap (int)
-
dump DASH SAP cues (see -cues) for a given track
- -dsaps (int)
-
same as -dsap but only print sample number
- -dsapc (int)
-
same as -dsap but only print CTS
- -dsapd (int)
-
same as -dsap but only print DTS, -dsapp to only print presentation time
- -dsapp (int)
-
same as -dsap but only print presentation time
- -dcr
-
dump ISMACryp samples structure to XML output
- -dump-cover
-
extract cover art
- -dump-chap
-
extract chapter file
- -dump-chap-ogg
-
extract chapter file as OGG format
- -dump-udta [tkID:]4cc (string)
-
extract udta for the given 4CC. If tkID is given, dumps from UDTA of the
given track ID, otherwise moov is used
- -mergevtt
-
merge vtt cues while dumping
- -ttxt (int)
-
convert input subtitle to GPAC TTXT format if no parameter. Otherwise, dump
given text track to GPAC TTXT format
- -srt
-
convert input subtitle to SRT format if no parameter. Otherwise, dump given
text track to SRT format
- -rip-mpd
-
download manifest and segments of an MPD. Does not work with live sessions
- -stat
-
generate node/field statistics for scene
- -stats
-
generate node/field statistics per Access Unit
- -statx
-
generate node/field statistics for scene after each AU
- -hash
-
generate SHA-1 Hash of the input file
- -comp (string)
-
replace with compressed version all top level box types given as parameter,
formated as orig_4cc_1=comp_4cc_1[,orig_4cc_2=comp_4cc_2]
- -bin
-
convert input XML file using NHML bitstream syntax to binary
- -topcount (string)
-
print to stdout the number of top-level boxes matching box types given as
parameter, formated as 4cc_1,4cc_2N
- -topsize (string)
-
print to stdout the number of bytes of top-level boxes matching types given
as parameter, formated as 4cc_1,4cc_2N or all for all boxes
Syntax is -add / -cat filename[#FRAGMENT][:opt1...:optN=val]
This process will create the destination file if not existing, and add the
track(s) to it. If you wish to always create a new destination file, add -new.
The supported input media types depend on your installation, check filters
documentation for more info.
To select a desired media track, the following syntax is used:
* `-add inputFile#video`: adds the first video track in inputFile.
* `-add inputFile#audio`: adds the first audio track in inputFile.
* `-add inputFile#trackID=ID` or `-add inputFile#ID`: adds the specified
track. For IsoMedia files, ID is the track ID. For other media files, ID is
the value indicated by MP4Box -info inputFile.
By default all imports are performed sequentially, and final
interleaving is done at the end; this however requires a temporary file
holding input isobmf file (if any) and added files before creating the final
output. Since this can become quite large, it is possible to add media to a
new file without temporary storage, using -flat option, but this disables
media interleaving.
If you wish to create an interleaved new file with no temporary
storage, use the -newfs option. The interleaving might not be as precise as
when using -new since it is dependent on muxer input scheduling (each
execution might lead to a slightly different result).
- Some muxing options (marked with * below) will be activated for all inputs
(i.e. in this mode, it is not possible to import one AVC track with
xps_inband and another without).
- Some muxing options (marked as ! below) cannot be used in this mode as they
require temporary storage for file edition.
- Usage of -cat is possible in this mode, but concatenated sources will not
be interleaved in the output . If you wish to perforom more complex cat/add
operations without temp file, use the gpac application.
MP4Box can import a desired amount of the input file rather than
the whole file. To do this, use the syntax -add inputFile:dur=N, where N is
the number of seconds you wish to import from input. MP4Box cannot start
importing from a random point in the input, it always import from the
begining.
Note: When importing SRT or SUB files, MP4Box will choose default layout
options to make the subtitle appear at the bottom of the video. You SHOULD
NOT import such files before any video track is added to the destination
file, otherwise the results will likelly not be useful (default SRT/SUB
importing uses default serif font, fontSize 18 and display size 400x60).
Check TTXT doc for more details.
When importing several tracks/sources in one pass, all options
will be applied if relevant to each source. These options are set for all
imported streams. If you need to specify these options par stream, set
per-file options using the syntax -add stream[:opt1:...:optN].
Allowed per-file options:
* #video, #audio: base import for most AV files
* #trackID=ID: track import for IsoMedia and other files
* #pid=ID: stream import from MPEG-2 TS
* :dur=D: * import only the specified duration from the media. D can be:
* positive float: specifies duration in seconds
* fraction: specifies duration as NUM/DEN fraction
* negative integer: specifies duration in number of coded frames
* :lang=LAN: set imported media language code
* :delay=delay_ms: set imported media initial delay in ms
* :par=PAR: set visual pixel aspect ratio (see -par )
* :clap=CLAP: set visual clean aperture (see -clap )
* :mx=MX: sets track matrix (see -mx )
* :name=NAME: set track handler name
* :ext=EXT: override file extension when importing
* :hdlr=code: set track handler type to the given code point (4CC)
* :disable: imported track(s) will be disabled
* :group=G: add the track as part of the G alternate group. If G is 0, the
first available GroupID will be picked.
* :fps=VAL: same as -fps
* :rap: ! import only RAP samples
* :refs: ! import only reference pictures
* :trailing: keep trailing 0-bytes in AVC/HEVC samples
* :agg=VAL: * same as -agg
* :dref: * same as -dref
* :keep_refs: keeps track reference when importing a single track
* :nodrop: same as -nodrop
* :packed: * same as -packed
* :sbr: same as -sbr
* :sbrx: same as -sbrx
* :ovsbr: same as -ovsbr
* :ps: same as -ps
* :psx: same as -psx
* :asemode=MODE: * set the mode to create the AudioSampleEntry
* v0-bs: use MPEG AudioSampleEntry v0 and the channel count from the
bitstream (even if greater than 2) - default
* v0-2: use MPEG AudioSampleEntry v0 and the channel count is forced to 2
* v1: use MPEG AudioSampleEntry v1 and the channel count from the bitstream
* v1-qt: use QuickTime Sound Sample Description Version 1 and the channel
count from the bitstream (even if greater than 2). This will also trigger
using alis data references instead of url, even for non-audio tracks
* :audio_roll=N: add a roll sample group with roll_distance N
* :mpeg4: * same as -mpeg4 option
* :nosei: discard all SEI messages during import
* :svc: import SVC/LHVC with explicit signaling (no AVC base compatibility)
* :nosvc: discard SVC/LHVC data when importing
* :svcmode=MODE: ! set SVC/LHVC import mode
* split: each layer is in its own track
* merge: all layers are merged in a single track
* splitbase: all layers are merged in a track, and the AVC base in another
* splitnox: each layer is in its own track, and no extractors are written
* splitnoxib: each layer is in its own track, no extractors are written,
using inband param set signaling
* :temporal: ! set HEVC/LHVC temporal sublayer import mode
* split: each sublayer is in its own track
* splitbase: all sublayers are merged in a track, and the HEVC base in
another
* splitnox: each layer is in its own track, and no extractors are written
* :subsamples: add SubSample information for AVC+SVC
* :deps: import sample dependency information for AVC and HEVC
* :ccst: add default HEIF ccst box to visual sample entry
* :forcesync: force non IDR samples with I slices to be marked as sync points
(AVC GDR)
Warning: RESULTING FILE IS NOT COMPLIANT WITH THE SPEC but will fix seeking in
most players
* :xps_inband: * set xPS inband for AVC/H264 and HEVC (for reverse operation,
re-import from raw media)
* :xps_inbandx: * same as xps_inband and also keep first xPS in sample
desciption
* :au_delim: keep AU delimiter NAL units in the imported file
* :max_lid=N: set HEVC max layer ID to be imported to N (by default imports
all layers)
* :max_tid=N: set HEVC max temporal ID to be imported to N (by default imports
all temporal sublayers)
* :tiles: add HEVC tiles signaling and NALU maps without splitting the tiles
into different tile tracks
* :split_tiles: ! split HEVC tiles into different tile tracks, one tile (or
all tiles of one slice) per track.
* :negctts: use negative CTS-DTS offsets (ISO4 brand)
* :chap: specify the track is a chapter track
* :chapter=NAME: add a single chapter (old nero format) with given name
lasting the entire file
* :chapfile=file: adds a chapter file (old nero format)
* :layout=WxHxXxY: specify the track layout
* if W (resp H) = 0: the max width (resp height) of the tracks in the file
are used
* if Y=-1: the layout is moved to the bottom of the track area
* X and Y can be omitted: :layout=WxH
* :rescale=TS: force media timescale to TS !! changes the media duration
* :timescale=TS: set imported media timescale to TS.
* :moovts=TS: set movie timescale to TS. A negative value picks the media
timescale of the first track imported.
* :noedit: * do not set edit list when importing B-frames video tracks
* :rvc=FILENAME: set RVC configuration for the media
* :fmt=FORMAT: override format detection with given format (cf BT/XMTA doc)
* :profile=INT: override AVC profile
* :level=INT: override AVC level
* :novpsext: remove VPS extensions from HEVC VPS
* :keepav1t: keep AV1 temporal delimiter OBU in samples, might help if source
file had losses
* :font=name: specify font name for text import (default Serif)
* :size=s: specify font size for text import (default 18)
* :text_layout=WxHxXxY: specify the track text layout
* if W (resp H) = 0: the max width (resp height) of the tracks in the file
are used.
* if Y=-1: the layout is moved to the bottom of the track area
* X and Y can be omitted: :layout=WxH
* :swf-global: all SWF defines are placed in first scene replace rather than
when needed
* :swf-no-ctrl: use a single stream for movie control and dictionary (this
will disable ActionScript)
* :swf-no-text: remove all SWF text
* :swf-no-font: remove all embedded SWF Fonts (local playback host fonts used)
* :swf-no-line: remove all lines from SWF shapes
* :swf-no-grad: remove all gradients from SWF shapes
* :swf-quad: use quadratic bezier curves instead of cubic ones
* :swf-xlp: support for lines transparency and scalability
* :swf-ic2d: use indexed curve 2D hardcoded proto
* :swf-same-app: appearance nodes are reused
* :swf-flatten=ang: complementary angle below which 2 lines are merged, 0
means no flattening
* :kind=schemeURI=value: set kind for the track
* :txtflags=flags: set display flags (hexa number) of text track
* :txtflags+=flags: add display flags (hexa number) to text track
* :txtflags-=flags: remove display flags (hexa number) from text track
* :rate=VAL: force average rate and max rate to VAL (in bps) in btrt box. If
0, removes btrt box
* :stz2: use compact size table (for low-bitrates)
* :bitdepth=VAL: set bit depth to VAL for imported video content (default is
24)
* :colr=OPT: set color profile for imported video content (see ISO/IEC
23001-8). OPT is formatted as:
* nclc,p,t,m: with p colour primary, t transfer characteristics and m matrix
coef
* nclx,p,t,m,r: same as nclx with r full range flag
* prof,path: with path indicating the file containing the ICC color profile
* rICC,path: with path indicating the file containing the restricted ICC
color profile
* :dv-profile=VAL: set the Dolby Vision profile
* :tc=VAL: inject a single QT timecode. VAL is formated as:
* [d]FPS[/FPS_den],h,m,s,f[,framespertick]: optional drop flag, framerate
(integer or fractional), hours, minutes, seconds and frame number
* : d is an optional flag used to indicate that the counter is in drop-frame
format
* : the framespertick is optional and defaults to round(framerate); it
indicates the number of frames per counter tick
- :lastsampdur[=VAL]" sets duration of the last sample. VAL is formated
as:
* no value: use the previous sample duration
* integer: indicate the duration in milliseconds
* N/D: indicate the duration as fractional second
* :fstat: print filter session stats after import
* :fgraph: print filter session graph after import
* :sopt:[OPTS]: set OPTS as additional arguments to source filter. OPTS can be
any usual filter argument, see filter doc `gpac -h doc`
* :dopt:[OPTS]: * set OPTS as additional arguments to destination filter. OPTS
can be any usual filter argument, see filter doc `gpac -h doc`
* @@f1[:args][@@fN:args]: set a filter chain to insert before the muxer. 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. The last filter shall not have any Filter ID specified
Note: sopt, dopt and @@f must be placed after all other
options.
- -add (string)
-
add given file tracks to file. Multiple inputs can be specified using +, eg
-add url1+url2
- -cat (string)
-
concatenate given file samples to file, creating tracks if needed. Multiple
inputs can be specified using +(eg -cat url1+url2).
Note: Note: This aligns initial timestamp of the file to be concatenated
- -catx (string)
-
same as -cat but new tracks can be imported before concatenation by
specifying +ADD_COMMAND where ADD_COMMAND is a regular -add syntax
- -catpl (string)
-
concatenate files listed in the given playlist file (one file per line,
lines starting with # are comments).
Note: Each listed file is concatenated as if called with -cat
- -unalign-cat (string)
-
do not attempt to align timestamps of samples inbetween tracks
- -force-cat (string)
-
skip media configuration check when concatenating file.
Warning: THIS MAY BREAK THE CONCATENATED TRACK(S)
- -keep-sys
-
keep all MPEG-4 Systems info when using -add and -cat (only used when adding
IsoMedia files)
- -dref
-
keep media data in original file using data referencing. The resulting file
only contains the meta-data of the presentation (frame sizes, timing,
etc...) and references media data in the original file. This is extremely
useful when developping content, since importing and storage of the MP4
file is much faster and the resulting file much smaller.
Note: Data referencing may fail on some files because it requires the framed
data (eg an IsoMedia sample) to be continuous in the original file, which
is not always the case depending on the original interleaving or bitstream
format (AVC or HEVC cannot use this option)
- -no-drop
-
force constant FPS when importing AVI video
- -packed
-
force packed bitstream when importing raw MPEG-4 part 2 Advanced Simple
Profile
- -sbr
-
backward compatible signaling of AAC-SBR
- -sbrx
-
non-backward compatible signaling of AAC-SBR
- -ps
-
backward compatible signaling of AAC-PS
- -psx
-
non-backward compatible signaling of AAC-PS
- -ovsbr
-
oversample SBR import (SBR AAC, PS AAC and oversampled SBR cannot be
detected at import time)
- -fps (string, default: 25)
-
force frame rate for video and SUB subtitles import to the given value,
expressed as a number or as timescale-increment.
Note: For raw H263 import, default FPS is 15, otherwise 25
Warning: This is ignored for ISOBMFF import, use :rescale option for that
- -mpeg4
-
force MPEG-4 sample descriptions when possible. For AAC, forces MPEG-4 AAC
signaling even if MPEG-2
- -agg (int)
-
aggregate N audio frames in 1 sample (3GP media only).
Note: Maximum value is 15
IsoMedia hinting consists in creating special tracks in the file that contain
transport protocol specific information and optionally multiplexing
information. These tracks are then used by the server to create the actual
packets being sent over the network, in other words they provide the server
with hints on how to build packets, hence their names hint tracks.
MP4Box supports creation of hint tracks for RTSP servers supporting these such
as QuickTime Streaming Server, DarwinStreaming Server or 3GPP-compliant RTSP
servers.
Note: GPAC streaming tools rtp output and rtsp server do not use hint tracks,
they use on-the-fly packetization from any media sources, not just MP4
Options:
- -hint
-
hint the file for RTP/RTSP
- -hint (int, default: 1450)
-
specify RTP MTU (max size) in bytes (this includes 12 bytes RTP header)
- -copy
-
copy media data to hint track rather than reference (speeds up server but
takes much more space)
- -multi [maxptime] (int)
-
enable frame concatenation in RTP packets if possible (with max duration 100
ms or maxptime ms if given)
- -rate (int, default: 90000)
-
specify rtp rate in Hz when no default for payload
- -mpeg4
-
force MPEG-4 generic payload whenever possible
- -latm
-
force MPG4-LATM transport for AAC streams
- -static
-
enable static RTP payload IDs whenever possible (by default, dynamic
payloads are always used)
- -add-sdp (string)
-
add given SDP string to hint track (tkID:string) or movie (string)
- -unhint
-
remove all hinting information from file
- -group-single
-
put all tracks in a single hint group
- -ocr
-
force all MPEG-4 streams to be synchronized (MPEG-4 Systems only)
- -rap
-
signal random access points in RTP packets (MPEG-4 Systems)
- -ts
-
signal AU Time Stamps in RTP packets (MPEG-4 Systems)
- -size
-
signal AU size in RTP packets (MPEG-4 Systems)
- -idx
-
signal AU sequence numbers in RTP packets (MPEG-4 Systems)
- -iod
-
prevent systems tracks embedding in IOD (MPEG-4 Systems), not compatible
with -isma
General considerations
MP4Box supports encoding and decoding of of BT, XMT, VRML and (partially) X3D
formats int MPEG-4 BIFS, and encoding and decoding of XSR and SVG into MPEG-4
LASeR
Any media track specified through a MuxInfo element will be imported in the
resulting MP4 file.
See https://wiki.gpac.io/MPEG-4-BIFS-Textual-Format and related pages.
Scene Random Access
MP4Box can encode BIFS or LASeR streams and insert random access points at a
given frequency. This is useful when packaging content for broadcast, where
users will not turn in the scene at the same time. In MPEG-4 terminology,
this is called the scene carousel.## BIFS Chunk Processing
The BIFS chunk encoding mode alows encoding single BIFS access units from an
initial context and a set of commands.
The generated AUs are raw BIFS (not SL-packetized), in files called
FILE-ESID-AUIDX.bifs, with FILE the basename of the input file.
Commands with a timing of 0 in the input will modify the carousel version only
(i.e. output context).
Commands with a timing different from 0 in the input will generate new
AUs.
Options:
- -mp4
-
specify input file is for encoding
- -def
-
encode DEF names in BIFS
- -sync (int)
-
force BIFS sync sample generation every given time in ms.
Note: cannot be used with -shadow
- -shadow (int)
-
force BIFS sync shadow sample generation every given time in ms.
Note: cannot be used with -sync
- -log
-
generate scene codec log file if available
- -ms (string)
-
import tracks from the given file
- -ctx-in (string)
-
specify initial context (MP4/BT/XMT) file for chunk processing. Input file
must be a commands-only file
- -ctx-out (string)
-
specify storage of updated context (MP4/BT/XMT) file for chunk processing,
optional
- -resolution (int)
-
resolution factor (-8 to 7, default 0) for LASeR encoding, and all coords
are multiplied by 2^res before truncation (LASeR encoding)
- -coord-bits (int)
-
number of bits used for encoding truncated coordinates (0 to 31, default 12)
(LASeR encoding)
- -scale-bits (int)
-
extra bits used for encoding truncated scales (0 to 4, default 0) (LASeR
encoding)
- -auto-quant (int)
-
resolution is given as if using -resolution but coord-bits and scale-bits
are infered (LASeR encoding)
MP4Box supports encryption and decryption of ISMA, OMA and CENC content, see
encryption filter `gpac -h cecrypt`.
It requires a specific XML file called CryptFile, whose syntax is available at
https://wiki.gpac.io/Common-Encryption
Options:
- -crypt (string)
-
encrypt the input file using the given CryptFile
- -decrypt (string)
-
decrypt the input file, potentially using the given CryptFile. If CryptFile
is not given, will fail if the key management system is not supported
- -set-kms (string)
-
change ISMA/OMA KMS location for all tracks, or for a given one if
ID=kms_uri is used
IsoMedia files can be used as generic meta-data containers, for examples storing
XML information and sample images for a movie. The resulting file may not
always contain a movie as is the case with some HEIF files or MPEG-21 files.
These information can be stored at the file root level, as is the
case for HEIF/IFF and MPEG-21 file formats, or at the moovie or track level
for a regular movie.
- -set-meta ABCD[:tk=tkID] (string)
-
set meta box type, with ABCD the four char meta type (NULL or 0 to remove
meta)
* tk not set: use root (file) meta
* tkID == 0: use moov meta
* tkID != 0: use meta of given track
- -add-items (string)
-
add resource to meta, with parameter syntax file_path[:opt1:optN]
* file_path `this` or `self`: item is the file itself
* tk=tkID: meta location (file, moov, track)
* name=str: item name
* type=itype: item 4cc type (not needed if mime is provided)
* mime=mtype: item mime type
* encoding=enctype: item content-encoding type
* id=ID: item ID
* ref=4cc,id: reference of type 4cc to an other item
- -add-image (string)
-
add the given file (with parameters) as HEIF image item. Same syntax as
-add-item
* name=str: see -add-item
* id=id: see -add-item
* ref=4cc, id: see -add-item
* primary: indicate that this item should be the primary item
* time=t: use the next sync sample after time t (float, in sec, default 0).
A negative time imports ALL frames as items
* split_tiles: for an HEVC tiled image, each tile is stored as a separate
item
* rotation=a: set the rotation angle for this image to 90*a degrees
anti-clockwise
* hidden: indicate that this image item should be hidden
* icc_path: path to icc to add as colr
* alpha: indicate that the image is an alpha image (should use ref=auxl
also)
- any other option will be passed as options to the media importer, see -add
- -rem-item item_ID[:tk=tkID] (string)
-
remove resource from meta
- -set-primary item_ID[:tk=tkID] (string)
-
set item as primary for meta
- -set-xml xml_file_path[:tk=tkID][:binary] (string)
-
set meta XML data
- -rem-xml [tk=tkID] (string)
-
remove meta XML data
- -dump-xml file_path[:tk=tkID] (string)
-
dump meta XML to file
- -dump-item item_ID[:tk=tkID][:path=fileName] (string)
-
dump item to file
- -package (string)
-
package input XML file into an ISO container, all media referenced except
hyperlinks are added to file
- -package (string)
-
package input XML file into an MPEG-U widget with ISO container, all files
contained in the current folder are added to the widget package
MP4Box can import simple Macromedia Flash files (".SWF")
You can specify a SWF input file with '-bt', '-xmt' and '-mp4' options
Options:
- -global
-
all SWF defines are placed in first scene replace rather than when needed
- -no-ctrl
-
use a single stream for movie control and dictionary (this will disable
ActionScript)
- -no-text
-
remove all SWF text
- -no-font
-
remove all embedded SWF Fonts (local playback host fonts used)
- -no-line
-
remove all lines from SWF shapes
- -no-grad
-
remove all gradients from swf shapes
- -quad
-
use quadratic bezier curves instead of cubic ones
- -xlp
-
support for lines transparency and scalability
- -flatten (number)
-
complementary angle below which 2 lines are merged, value 0means no
flattening
The options shall be specified as òpt_name=opt_val.
Options:
- -dst (string)
-
destination IP
- -port (int, default: 7000)
-
destination port
- -mtu (int, default: 1450)
-
path MTU for RTP packets
- -ifce (string)
-
IP address of the physical interface to use
- -ttl (int, default: 1)
-
time to live for multicast packets
- -sdp (string, default: session.sdp)
-
output SDP file
- -dims
-
turn on DIMS mode for SVG input
- -no-rap
-
disable RAP sending and carousel generation
- -src (string)
-
source of scene updates
- -rap (int)
-
duration in ms of base carousel; you can specify the RAP period of a single
ESID (not in DIMS) using ESID=X:time
Runtime options:
* q: quits
* u: inputs some commands to be sent
* U: same as u but signals the updates as critical
* e: inputs some commands to be sent without being aggregated
* E: same as e but signals the updates as critical
* f: forces RAP sending
* F: forces RAP regeneration and sending
* p: dumps current scene
- Basic and advanced examples are available at
https://wiki.gpac.io/MP4Box-Introduction
Authors: GPAC developers, see git repo history (-log)
For bug reports, feature requests, more information and source code, visit
http://github.com/gpac/gpac
build: 1.0.0-rev0-g747808797-master
Copyright: (c) 2000-2020 Telecom Paris distributed under LGPL v2.1+ -
http://gpac.io
Visit the GSP FreeBSD Man Page Interface. Output converted with ManDoc. |