qtmux

qtmux — Muxer for quicktime(.mov) files

Synopsis

struct              GstQTMux;

Object Hierarchy

  GObject
   +----GInitiallyUnowned
         +----GstObject
               +----GstElement
                     +----GstQTMux

Implemented Interfaces

GstQTMux implements GstTagSetter, GstTagXmpWriter and GstPreset.

Properties

  "dts-method"               GstQTMuxDtsMethods    : Read / Write / Construct
  "faststart"                gboolean              : Read / Write
  "faststart-file"           gchar*                : Read / Write / Construct
  "fragment-duration"        guint                 : Read / Write / Construct
  "moov-recovery-file"       gchar*                : Read / Write / Construct
  "movie-timescale"          guint                 : Read / Write / Construct
  "presentation-time"        gboolean              : Read / Write / Construct
  "streamable"               gboolean              : Read / Write / Construct
  "trak-timescale"           guint                 : Read / Write / Construct
  "reserved-bytes-per-sec"   guint                 : Read / Write / Construct
  "reserved-duration-remaining" guint64               : Read
  "reserved-max-duration"    guint64               : Read / Write
  "reserved-moov-update-period" guint64               : Read / Write

Description

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 ("movie-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 "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 "fragment-duration". If such fragmented layout is intended for streaming purposes, then "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 "reserved-moov-update-period" and "reserved-max-duration" property. Also present is the "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 "reserved-duration-remaining" property to see how close to full the reserved space is becoming.

Example pipelines

1
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.

Synopsis

Element Information

plugin

isomp4

author

Thiago Sousa Santos <thiagoss@embedded.ufcg.edu.br>

class

Codec/Muxer

Element Pads

name

audio_%u

direction

sink

presence

request

details

audio/x-raw, format=(string){ S32LE, S32BE, S24LE, S24BE, S16LE, S16BE, S8, U8 }, layout=(string)interleaved, channels=(int)[ 1, 2 ], rate=(int)[ 1, 2147483647 ]

audio/mpeg, mpegversion=(int)1, layer=(int)3, channels=(int)[ 1, 2 ], rate=(int)[ 1, 2147483647 ]

audio/mpeg, mpegversion=(int)4, stream-format=(string)raw, channels=(int)[ 1, 8 ], rate=(int)[ 1, 2147483647 ]

audio/x-adpcm, layout=(string)dvi, block_align=(int)[ 64, 8096 ], channels=(int)[ 1, 2 ], rate=(int)[ 1, 2147483647 ]

audio/x-alaw, channels=(int)[ 1, 2 ], rate=(int)[ 1, 2147483647 ]

audio/x-mulaw, channels=(int)[ 1, 2 ], rate=(int)[ 1, 2147483647 ]

audio/AMR, rate=(int)8000, channels=(int)[ 1, 2 ]

audio/AMR-WB, rate=(int)16000, channels=(int)[ 1, 2 ]

audio/x-alac, channels=(int)[ 1, 2 ], rate=(int)[ 1, 2147483647 ]

name

subtitle_%u

direction

sink

presence

request

details

text/x-raw, format=(string)utf8

name

video_%u

direction

sink

presence

request

details

video/x-raw, format=(string){ RGB, UYVY, v210 }, width=(int)[ 16, 2147483647 ], height=(int)[ 16, 2147483647 ]

video/mpeg, mpegversion=(int)4, systemstream=(boolean)false, width=(int)[ 16, 2147483647 ], height=(int)[ 16, 2147483647 ]

video/x-divx, divxversion=(int)5, width=(int)[ 16, 2147483647 ], height=(int)[ 16, 2147483647 ]

video/x-prores, variant=(string){ standard, lt, hq, proxy }, width=(int)[ 16, 2147483647 ], height=(int)[ 16, 2147483647 ]

video/x-h263, width=(int)[ 16, 2147483647 ], height=(int)[ 16, 2147483647 ]

video/x-h264, stream-format=(string)avc, alignment=(string)au, width=(int)[ 16, 2147483647 ], height=(int)[ 16, 2147483647 ]

video/x-svq, svqversion=(int)3, width=(int)[ 16, 2147483647 ], height=(int)[ 16, 2147483647 ]

video/x-dv, systemstream=(boolean)false, width=(int)[ 16, 2147483647 ], height=(int)[ 16, 2147483647 ]

image/jpeg, width=(int)[ 16, 2147483647 ], height=(int)[ 16, 2147483647 ]

video/x-vp8, width=(int)[ 16, 2147483647 ], height=(int)[ 16, 2147483647 ]

video/x-dirac, width=(int)[ 16, 2147483647 ], height=(int)[ 16, 2147483647 ]

video/x-qt-part, width=(int)[ 16, 2147483647 ], height=(int)[ 16, 2147483647 ]

name

src

direction

source

presence

always

details

video/quicktime, variant=(string)apple

video/quicktime

Details

struct GstQTMux

struct GstQTMux;

Property Details

The "dts-method" property

  "dts-method"               GstQTMuxDtsMethods    : Read / Write / Construct

Method to determine DTS time (DEPRECATED).

Default value: reorder


The "faststart" property

  "faststart"                gboolean              : Read / Write

If the file should be formatted for faststart (headers first).

Default value: FALSE


The "faststart-file" property

  "faststart-file"           gchar*                : Read / Write / Construct

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.

Default value: NULL


The "fragment-duration" property

  "fragment-duration"        guint                 : Read / Write / Construct

Fragment durations in ms (produce a fragmented file if > 0).

Default value: 0


The "moov-recovery-file" property

  "moov-recovery-file"       gchar*                : Read / Write / Construct

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).

Default value: NULL


The "movie-timescale" property

  "movie-timescale"          guint                 : Read / Write / Construct

Timescale to use in the movie (units per second).

Allowed values: >= 1

Default value: 1800


The "presentation-time" property

  "presentation-time"        gboolean              : Read / Write / Construct

Calculate and include presentation/composition time (in addition to decoding time).

Default value: TRUE


The "streamable" property

  "streamable"               gboolean              : Read / Write / Construct

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).

Default value: FALSE


The "trak-timescale" property

  "trak-timescale"           guint                 : Read / Write / Construct

Timescale to use for the tracks (units per second, 0 is automatic).

Default value: 0


The "reserved-bytes-per-sec" property

  "reserved-bytes-per-sec"   guint                 : Read / Write / Construct

Multiplier for converting reserved-max-duration into bytes of header to reserve, per second, per track.

Allowed values: <= 10000

Default value: 550


The "reserved-duration-remaining" property

  "reserved-duration-remaining" guint64               : Read

Reports the approximate amount of remaining moov header space reserved using reserved-max-duration.

Default value: 0


The "reserved-max-duration" property

  "reserved-max-duration"    guint64               : Read / Write

When set to a value > 0, reserves space for index tables at the beginning of the file.

Default value: 18446744073709551615


The "reserved-moov-update-period" property

  "reserved-moov-update-period" guint64               : Read / Write

When used with reserved-max-duration, periodically updates the index tables with information muxed so far.

Default value: 18446744073709551615