qtmux
This element merges streams (audio and video) into QuickTime(.mov) files.
The following background intends to explain why various similar muxers are present in this plugin.
The QuickTime file format specification served as basis for the MP4 file format specification (mp4mux), and as such the QuickTime file structure is nearly identical to the so-called ISO Base Media file format defined in ISO 14496-12 (except for some media specific parts).
In turn, the latter ISO Base Media format was further specialized as a Motion JPEG-2000 file format in ISO 15444-3 (mj2mux) and in various 3GPP(2) specs (gppmux). The fragmented file features defined (only) in ISO Base Media are used by ISMV files making up (a.o.) Smooth Streaming (ismlmux).
A few properties (#GstQTMux:movie-timescale, GstQTMux:trak-timescale, trak-timescale) allow adjusting some technical parameters, which might be useful in (rare) cases to resolve compatibility issues in some situations.
Some other properties influence the result more fundamentally. A typical mov/mp4 file's metadata (aka moov) is located at the end of the file, somewhat contrary to this usually being called "the header". However, a GstQTMux:faststart file will (with some effort) arrange this to be located near start of the file, which then allows it e.g. to be played while downloading. Alternatively, rather than having one chunk of metadata at start (or end), there can be some metadata at start and most of the other data can be spread out into fragments of GstQTMux:fragment-duration. If such fragmented layout is intended for streaming purposes, then GstQTMux:streamable allows foregoing to add index metadata (at the end of file).
When the maximum duration to be recorded can be known in advance, GstQTMux also supports a 'Robust Muxing' mode. In robust muxing mode, space for the headers are reserved at the start of muxing, and rewritten at a configurable interval, so that the output file is always playable, even if the recording is interrupted uncleanly by a crash. Robust muxing mode requires a seekable output, such as filesink, because it needs to rewrite the start of the file.
To enable robust muxing mode, set the GstQTMux:reserved-moov-update-period and GstQTMux:reserved-max-duration property. Also present is the GstQTMux:reserved-bytes-per-sec property, which can be increased if for some reason the default is not large enough and the initial reserved space for headers is too small. Applications can monitor the GstQTMux:reserved-duration-remaining property to see how close to full the reserved space is becoming.
Applications that wish to be able to use/edit a file while it is being written to by live content, can use the "Robust Prefill Muxing" mode. That mode is a variant of the "Robust Muxing" mode in that it will pre-allocate a completely valid header from the start for all tracks (i.e. it appears as though the file is "reserved-max-duration" long with all samples present). This mode can be enabled by setting the GstQTMux:reserved-moov-update-period and GstQTMux:reserved-prefill properties. Note that this mode is only possible with input streams that have a fixed sample size (such as raw audio and Prores Video) and that don't have reordered samples.
Example pipelines
gst-launch-1.0 v4l2src num-buffers=500 ! video/x-raw,width=320,height=240 ! videoconvert ! qtmux ! filesink location=video.mov
Records a video stream captured from a v4l2 device and muxes it into a qt file.
Hierarchy
GObject ╰──GInitiallyUnowned ╰──GstObject ╰──GstElement ╰──GstAggregator ╰──qtmux
Implemented interfaces
Factory details
Authors: – Thiago Sousa Santos
Classification: – Codec/Muxer
Rank – primary
Plugin – isomp4
Package – GStreamer Good Plug-ins
Pad Templates
audio_%u
audio/x-raw:
format: { S32LE, S32BE, S24LE, S24BE, S16LE, S16BE, S8, U8 }
layout: interleaved
channels: [ 1, 2 ]
rate: [ 1, 2147483647 ]
audio/x-raw:
format: { S32LE, S32BE, S24LE, S24BE, S16LE, S16BE, S8, U8 }
layout: interleaved
channel-mask: 0x0000000000000000
channels: [ 1, 16 ]
rate: [ 1, 2147483647 ]
audio/mpeg:
mpegversion: 1
layer: [ 1, 3 ]
channels: [ 1, 2 ]
rate: [ 1, 2147483647 ]
audio/mpeg:
mpegversion: 4
stream-format: raw
channels: [ 1, 8 ]
rate: [ 1, 2147483647 ]
audio/x-ac3:
channels: [ 1, 6 ]
rate: [ 1, 2147483647 ]
audio/x-adpcm:
layout: dvi
block_align: [ 64, 8096 ]
channels: [ 1, 2 ]
rate: [ 1, 2147483647 ]
audio/x-alaw:
channels: [ 1, 2 ]
rate: [ 1, 2147483647 ]
audio/x-mulaw:
channels: [ 1, 2 ]
rate: [ 1, 2147483647 ]
audio/AMR:
rate: 8000
channels: [ 1, 2 ]
audio/AMR-WB:
rate: 16000
channels: [ 1, 2 ]
audio/x-alac:
channels: [ 1, 2 ]
rate: [ 1, 2147483647 ]
audio/x-opus:
channel-mapping-family: [ 0, 255 ]
channels: [ 1, 8 ]
rate: [ 1, 2147483647 ]
caption_%u
closedcaption/x-cea-608:
format: s334-1a
closedcaption/x-cea-708:
format: cdp
src
video/quicktime:
variant: apple
video/quicktime:
subtitle_%u
text/x-raw:
format: utf8
video_%u
video/x-raw:
format: { RGB, UYVY, v210 }
width: [ 16, 2147483647 ]
height: [ 16, 2147483647 ]
video/mpeg:
mpegversion: 4
systemstream: false
width: [ 16, 2147483647 ]
height: [ 16, 2147483647 ]
video/x-divx:
divxversion: 5
width: [ 16, 2147483647 ]
height: [ 16, 2147483647 ]
video/x-prores:
variant: { (string)standard, (string)lt, (string)hq, (string)proxy, (string)4444, (string)4444xq }
width: [ 16, 2147483647 ]
height: [ 16, 2147483647 ]
video/x-cineform:
width: [ 16, 2147483647 ]
height: [ 16, 2147483647 ]
video/x-h263:
width: [ 16, 2147483647 ]
height: [ 16, 2147483647 ]
video/x-h264:
stream-format: avc
alignment: au
width: [ 16, 2147483647 ]
height: [ 16, 2147483647 ]
video/x-h265:
stream-format: { (string)hvc1, (string)hev1 }
alignment: au
width: [ 16, 2147483647 ]
height: [ 16, 2147483647 ]
video/x-svq:
svqversion: 3
width: [ 16, 2147483647 ]
height: [ 16, 2147483647 ]
video/x-dv:
systemstream: false
width: [ 16, 2147483647 ]
height: [ 16, 2147483647 ]
image/jpeg:
width: [ 16, 2147483647 ]
height: [ 16, 2147483647 ]
image/png:
width: [ 16, 2147483647 ]
height: [ 16, 2147483647 ]
video/x-vp8:
width: [ 16, 2147483647 ]
height: [ 16, 2147483647 ]
video/x-vp9:
width: [ 16, 2147483647 ]
height: [ 16, 2147483647 ]
video/x-dirac:
width: [ 16, 2147483647 ]
height: [ 16, 2147483647 ]
video/x-qt-part:
width: [ 16, 2147483647 ]
height: [ 16, 2147483647 ]
video/x-av1:
width: [ 16, 2147483647 ]
height: [ 16, 2147483647 ]
Properties
dts-method
“dts-method” GstQTMuxDtsMethods *
Method to determine DTS time (DEPRECATED)
Flags : Read / Write / Construct
Default value : reorder (1)
faststart
“faststart” gboolean
If the file should be formatted for faststart (headers first)
Flags : Read / Write
Default value : false
faststart-file
“faststart-file” gchararray
File that will be used temporarily to store data from the stream when creating a faststart file. If null a filepath will be created automatically
Flags : Read / Write / Construct
Default value : NULL
force-chunks
“force-chunks” gboolean
Force multiple chunks to be created even for single-stream files
Flags : Read / Write
Default value : false
force-create-timecode-trak
“force-create-timecode-trak” gboolean
Create a timecode trak even in unsupported flavors
Flags : Read / Write / Construct
Default value : false
fragment-duration
“fragment-duration” guint
Fragment durations in ms (produce a fragmented file if > 0)
Flags : Read / Write / Construct
Default value : 0
interleave-bytes
“interleave-bytes” guint64
Interleave between streams in bytes
Flags : Read / Write
Default value : 0
interleave-time
“interleave-time” guint64
Interleave between streams in nanoseconds
Flags : Read / Write
Default value : 250000000
max-raw-audio-drift
“max-raw-audio-drift” guint64
Maximum allowed drift of raw audio samples vs. timestamps in nanoseconds
Flags : Read / Write
Default value : 40000000
moov-recovery-file
“moov-recovery-file” gchararray
File to be used to store data for moov atom making movie file recovery possible in case of a crash during muxing. Null for disabled. (Experimental)
Flags : Read / Write / Construct
Default value : NULL
movie-timescale
“movie-timescale” guint
Timescale to use in the movie (units per second, 0 == default)
Flags : Read / Write / Construct
Default value : 0
presentation-time
“presentation-time” gboolean
Calculate and include presentation/composition time (in addition to decoding time)
Flags : Read / Write / Construct
Default value : true
reserved-bytes-per-sec
“reserved-bytes-per-sec” guint
Multiplier for converting reserved-max-duration into bytes of header to reserve, per second, per track
Flags : Read / Write / Construct
Default value : 550
reserved-duration-remaining
“reserved-duration-remaining” guint64
Reports the approximate amount of remaining moov header space reserved using reserved-max-duration
Flags : Read
Default value : 18446744073709551615
reserved-max-duration
“reserved-max-duration” guint64
When set to a value > 0, reserves space for index tables at the beginning of the file.
Flags : Read / Write
Default value : 18446744073709551615
reserved-moov-update-period
“reserved-moov-update-period” guint64
When used with reserved-max-duration, periodically updates the index tables with information muxed so far.
Flags : Read / Write
Default value : 18446744073709551615
reserved-prefill
“reserved-prefill” gboolean
Prefill samples table of reserved duration
Flags : Read / Write / Construct
Default value : false
start-gap-threshold
“start-gap-threshold” guint64
Threshold for creating an edit list for gaps at the start in nanoseconds
Flags : Read / Write
Default value : 0
streamable
“streamable” gboolean
If set to true, the output should be as if it is to be streamed and hence no indexes written or duration written. (DEPRECATED, only valid for fragmented MP4)
Flags : Read / Write / Construct
Default value : false
trak-timescale
“trak-timescale” guint
Timescale to use for the tracks (units per second, 0 is automatic)
Flags : Read / Write / Construct
Default value : 0
Named constants
GstQTMuxDtsMethods
Members
dd
(0) – delta/duration
reorder
(1) – reorder
asc
(2) – ascending
The results of the search are